Title: [119092] trunk/Source/WebKit2
Revision
119092
Author
[email protected]
Date
2012-05-31 05:30:02 -0700 (Thu, 31 May 2012)

Log Message

[EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl
https://bugs.webkit.org/show_bug.cgi?id=70231

Patch by Keunsoon Lee <[email protected]> on 2012-05-31
Reviewed by Chang Shu.

These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks.
The callback conveys WKURLResponseRef and WKURLRequestRef as parameter.

By the way, EFL browser needs content type from response to decide correct policy.
Another information, cookie, is necessary with similar reason.
But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL().

So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef,
and not to desturb WebKit2 main stream.

* Shared/API/c/efl/WKURLRequestEfl.cpp: Added.
(WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef.
* Shared/API/c/efl/WKURLRequestEfl.h: Added.
* Shared/API/c/efl/WKURLResponseEfl.cpp: Added.
(WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef.
* Shared/API/c/efl/WKURLResponseEfl.h: Added.
* Shared/efl/WebCoreArgumentCodersEfl.cpp: Added.
(CoreIPC):
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/efl/WebURLRequestEfl.cpp: Added.
(WebKit):
(WebKit::WebURLRequestEfl::WebURLRequestEfl):
(WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest.
* Shared/efl/WebURLRequestEfl.h: Added.
(WebKit):
(WebURLRequestEfl):
(WebKit::WebURLRequestEfl::create):
* Shared/efl/WebURLResponseEfl.cpp: Added.
(WebKit):
(WebKit::WebURLResponseEfl::WebURLResponseEfl):
(WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse.
* Shared/efl/WebURLResponseEfl.h: Added.
(WebKit):
(WebURLResponseEfl):
(WebKit::WebURLResponseEfl::create):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (119091 => 119092)


--- trunk/Source/WebKit2/ChangeLog	2012-05-31 12:06:32 UTC (rev 119091)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-31 12:30:02 UTC (rev 119092)
@@ -1,3 +1,47 @@
+2012-05-31  Keunsoon Lee  <[email protected]>
+
+        [EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl
+        https://bugs.webkit.org/show_bug.cgi?id=70231
+
+        Reviewed by Chang Shu.
+
+        These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks.
+        The callback conveys WKURLResponseRef and WKURLRequestRef as parameter.
+
+        By the way, EFL browser needs content type from response to decide correct policy.
+        Another information, cookie, is necessary with similar reason.
+        But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL().
+
+        So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef,
+        and not to desturb WebKit2 main stream. 
+
+        * Shared/API/c/efl/WKURLRequestEfl.cpp: Added.
+        (WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef.
+        * Shared/API/c/efl/WKURLRequestEfl.h: Added.
+        * Shared/API/c/efl/WKURLResponseEfl.cpp: Added.
+        (WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef.
+        * Shared/API/c/efl/WKURLResponseEfl.h: Added.
+        * Shared/efl/WebCoreArgumentCodersEfl.cpp: Added.
+        (CoreIPC):
+        (CoreIPC::::encode):
+        (CoreIPC::::decode):
+        * Shared/efl/WebURLRequestEfl.cpp: Added.
+        (WebKit):
+        (WebKit::WebURLRequestEfl::WebURLRequestEfl):
+        (WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest.
+        * Shared/efl/WebURLRequestEfl.h: Added.
+        (WebKit):
+        (WebURLRequestEfl):
+        (WebKit::WebURLRequestEfl::create):
+        * Shared/efl/WebURLResponseEfl.cpp: Added.
+        (WebKit):
+        (WebKit::WebURLResponseEfl::WebURLResponseEfl):
+        (WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse.
+        * Shared/efl/WebURLResponseEfl.h: Added.
+        (WebKit):
+        (WebURLResponseEfl):
+        (WebKit::WebURLResponseEfl::create):
+
 2012-05-31  Gyuyoung Kim  <[email protected]>
 
         [EFL][WK2] Rename ewk_private.h to ewk_view_private.h

Added: trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp (0 => 119092)


--- trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WKURLRequestEfl.h"
+
+#include "WKAPICast.h"
+#include "WebURLRequestEfl.h"
+
+using namespace WebKit;
+
+WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef requestRef)
+{
+    RefPtr<WebURLRequestEfl> requestEfl = WebURLRequestEfl::create(toImpl(requestRef));
+    return toCopiedAPI(requestEfl->cookies());
+}
Property changes on: trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h (0 => 119092)


--- trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#ifndef WKURLRequestEfl_h
+#define WKURLRequestEfl_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKURLRequestEfl_h */
Property changes on: trunk/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp (0 => 119092)


--- trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WKURLResponseEfl.h"
+
+#include "WKAPICast.h"
+#include "WebURLResponseEfl.h"
+
+using namespace WebKit;
+
+WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef responseRef)
+{
+    RefPtr<WebURLResponseEfl> responseEfl = WebURLResponseEfl::create(toImpl(responseRef));
+    return toCopiedAPI(responseEfl->contentType());
+}
Property changes on: trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h (0 => 119092)


--- trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#ifndef WKURLResponseEfl_h
+#define WKURLResponseEfl_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKURLResponseEfl_h */
Property changes on: trunk/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp (0 => 119092)


--- trunk/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebCoreArgumentCoders.h"
+
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/ResourceResponse.h>
+
+using namespace WebCore;
+
+namespace CoreIPC {
+
+void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest)
+{
+    encoder->encode(resourceRequest.url().string());
+    encoder->encode(resourceRequest.httpHeaderField("Cookie"));
+}
+
+bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest)
+{
+    ResourceRequest request;
+
+    String url;
+    if (!decoder->decode(url))
+        return false;
+    request.setURL(KURL(KURL(), url));
+
+    String cookie;
+    if (!decoder->decode(cookie))
+        return false;
+    request.setHTTPHeaderField("Cookie", cookie);
+
+    resourceRequest = request;
+    return true;
+}
+
+
+void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse)
+{
+    encoder->encode(resourceResponse.mimeType());
+}
+
+bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse)
+{
+    ResourceResponse response;
+
+    String mimeType;
+    if (!decoder->decode(mimeType))
+        return false;
+    response.setMimeType(mimeType);
+
+    resourceResponse = response;
+    return true;
+}
+
+
+void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError)
+{
+    encoder->encode(resourceError.domain());
+    encoder->encode(resourceError.errorCode());
+    encoder->encode(resourceError.failingURL());
+    encoder->encode(resourceError.localizedDescription());
+}
+
+bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError)
+{
+    String domain;
+    if (!decoder->decode(domain))
+        return false;
+
+    int errorCode;
+    if (!decoder->decode(errorCode))
+        return false;
+
+    String failingURL;
+    if (!decoder->decode(failingURL))
+        return false;
+
+    String localizedDescription;
+    if (!decoder->decode(localizedDescription))
+        return false;
+
+    resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription);
+    return true;
+}
+
+} // namespace CoreIPC
Property changes on: trunk/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp (0 => 119092)


--- trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebURLRequestEfl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebURLRequestEfl::WebURLRequestEfl(const WebURLRequest* request)
+    : m_request(request)
+{
+}
+
+const String WebURLRequestEfl::cookies() const
+{
+    if (!m_request)
+        return String();
+
+    return m_request->resourceRequest().httpHeaderField("Cookie");
+}
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.h (0 => 119092)


--- trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.h	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#ifndef WebURLRequestEfl_h
+#define WebURLRequestEfl_h
+
+#include "WebURLRequest.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+
+namespace WebKit {
+
+class WebURLRequestEfl : public RefCounted<WebURLRequestEfl> {
+public:
+    static PassRefPtr<WebURLRequestEfl> create(const WebURLRequest* request)
+    {
+        return adoptRef(new WebURLRequestEfl(request));
+    }
+
+    const String cookies() const;
+
+private:
+    explicit WebURLRequestEfl(const WebURLRequest*);
+
+    const WebURLRequest* m_request;
+};
+
+} // namespace WebKit
+
+#endif // WebURLRequestEfl_h
Property changes on: trunk/Source/WebKit2/Shared/efl/WebURLRequestEfl.h
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp (0 => 119092)


--- trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebURLResponseEfl.h"
+
+namespace WebKit {
+
+WebURLResponseEfl::WebURLResponseEfl(const WebURLResponse* response)
+    : m_response(response)
+{
+}
+
+const String& WebURLResponseEfl::contentType() const
+{
+    if (!m_response)
+        return String();
+
+    return m_response->resourceResponse().mimeType();
+}
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp
___________________________________________________________________

Added: svn:executable

Added: trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.h (0 => 119092)


--- trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.h	2012-05-31 12:30:02 UTC (rev 119092)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#ifndef WebURLResponseEfl_h
+#define WebURLResponseEfl_h
+
+#include "WebURLResponse.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+
+namespace WebKit {
+
+class WebURLResponseEfl : public RefCounted<WebURLResponseEfl> {
+public:
+    static PassRefPtr<WebURLResponseEfl> create(const WebURLResponse* response)
+    {
+        return adoptRef(new WebURLResponseEfl(response));
+    }
+
+    const String& contentType() const;
+
+private:
+    explicit WebURLResponseEfl(const WebURLResponse*);
+
+    const WebURLResponse* m_response;
+};
+
+} // namespace WebKit
+
+#endif // WebURLResponseEfl_h
Property changes on: trunk/Source/WebKit2/Shared/efl/WebURLResponseEfl.h
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to