Title: [119223] trunk/Source/WebKit/efl
Revision
119223
Author
[email protected]
Date
2012-06-01 05:57:39 -0700 (Fri, 01 Jun 2012)

Log Message

[EFL] New signals in ewk_view to enable global history delegate functionality
https://bugs.webkit.org/show_bug.cgi?id=86343

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-06-01
Reviewed by Kenneth Rohde Christiansen.

Global history delegate is an interface for WebKit clients to manage their own global history store.
The new ewk_view signals do the following:
1) report that a navigation happened within the view and give the navigation details.
2) report that view performed a client redirect and give source and destination uris.
3) report that view performed a server redirect and give source and destination uris.

* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::updateGlobalHistoryRedirectLinks): implementation added.
(WebCore::FrameLoaderClientEfl::updateGlobalHistory): implementation added.
* ewk/ewk_view.h: Added new signals and data types.

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (119222 => 119223)


--- trunk/Source/WebKit/efl/ChangeLog	2012-06-01 12:52:27 UTC (rev 119222)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-06-01 12:57:39 UTC (rev 119223)
@@ -1,3 +1,21 @@
+2012-06-01  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL] New signals in ewk_view to enable global history delegate functionality
+        https://bugs.webkit.org/show_bug.cgi?id=86343
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Global history delegate is an interface for WebKit clients to manage their own global history store.
+        The new ewk_view signals do the following:
+        1) report that a navigation happened within the view and give the navigation details.
+        2) report that view performed a client redirect and give source and destination uris.
+        3) report that view performed a server redirect and give source and destination uris.
+
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::updateGlobalHistoryRedirectLinks): implementation added.
+        (WebCore::FrameLoaderClientEfl::updateGlobalHistory): implementation added.
+        * ewk/ewk_view.h: Added new signals and data types.
+
 2012-06-01  Sudarsana Nagineni  <[email protected]>
 
         [EFL] Implement PlatformStrategies

Modified: trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp (119222 => 119223)


--- trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-06-01 12:52:27 UTC (rev 119222)
+++ trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-06-01 12:57:39 UTC (rev 119223)
@@ -505,6 +505,27 @@
 
 void FrameLoaderClientEfl::updateGlobalHistoryRedirectLinks()
 {
+        WebCore::Frame* frame = EWKPrivate::coreFrame(m_frame);
+        if (!frame)
+            return;
+
+        WebCore::DocumentLoader* loader = frame->loader()->documentLoader();
+        if (!loader)
+            return;
+
+        if (!loader->clientRedirectSourceForHistory().isNull()) {
+            const CString& sourceURL = loader->clientRedirectSourceForHistory().utf8();
+            const CString& destinationURL = loader->clientRedirectDestinationForHistory().utf8();
+            Ewk_View_Redirection_Data data = { sourceURL.data(), destinationURL.data() };
+            evas_object_smart_callback_call(m_view, "perform,client,redirect", &data);
+        }
+
+        if (!loader->serverRedirectSourceForHistory().isNull()) {
+            const CString& sourceURL = loader->serverRedirectSourceForHistory().utf8();
+            const CString& destinationURL = loader->serverRedirectDestinationForHistory().utf8();
+            Ewk_View_Redirection_Data data = { sourceURL.data(), destinationURL.data() };
+            evas_object_smart_callback_call(m_view, "perform,server,redirect", &data);
+        }
 }
 
 bool FrameLoaderClientEfl::shouldGoToHistoryItem(HistoryItem* item) const
@@ -959,7 +980,32 @@
 
 void FrameLoaderClientEfl::updateGlobalHistory()
 {
-    notImplemented();
+    WebCore::Frame* frame = EWKPrivate::coreFrame(m_frame);
+    if (!frame)
+        return;
+
+    WebCore::DocumentLoader* loader = frame->loader()->documentLoader();
+    if (!loader)
+        return;
+
+    const FrameLoader* frameLoader = loader->frameLoader();
+    const bool isMainFrameRequest = frameLoader && (loader == frameLoader->provisionalDocumentLoader()) && frameLoader->isLoadingMainFrame();
+    const CString& urlForHistory = loader->urlForHistory().string().utf8();
+    const CString& title = loader->title().string().utf8();
+    const CString& firstParty = loader->request().firstPartyForCookies().string().utf8();
+    const CString& clientRedirectSource = loader->clientRedirectSourceForHistory().utf8();
+    const CString& originalURL = loader->originalURL().string().utf8();
+    const CString& httpMethod = loader->request().httpMethod().utf8();
+    const CString& responseURL = loader->responseURL().string().utf8();
+    const CString& mimeType = loader->response().mimeType().utf8();
+
+    Ewk_Frame_Resource_Request request = { originalURL.data(), firstParty.data(), httpMethod.data(), 0, m_frame, isMainFrameRequest };
+    Ewk_Frame_Resource_Response response = { responseURL.data(), loader->response().httpStatusCode(), 0, mimeType.data() };
+    bool hasSubstituteData = loader->substituteData().isValid();
+
+    Ewk_View_Navigation_Data data = { urlForHistory.data(), title.data(), &request, &response, hasSubstituteData, clientRedirectSource.data() };
+
+    evas_object_smart_callback_call(m_view, "navigate,with,data", &data);
 }
 
 void FrameLoaderClientEfl::savePlatformDataToCachedFrame(CachedFrame*)

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (119222 => 119223)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-06-01 12:52:27 UTC (rev 119222)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-06-01 12:57:39 UTC (rev 119223)
@@ -71,6 +71,9 @@
  *  - "menubar,visible,set", Eina_Bool: sets menubar visibility.
  *  - "mixedcontent,displayed", void: any of the containing frames has loaded and displayed mixed content.
  *  - "mixedcontent,run", void: any of the containing frames has loaded and run mixed content.
+ *  - "navigate,with,data", Ewk_View_Navigation_Data*: reports that view did navigation and gives the navigation details.
+ *  - "perform,client,redirect", Ewk_View_Redirection_Data*: reports that view performed a client redirect and gives the redirection details.
+ *  - "perform,server,redirect", Ewk_View_Redirection_Data*: reports that view performed a server redirect and gives the redirection details.
  *  - "protocolhandler,registration,requested", Ewk_Custom_Handler_Data: add a handler url for the given protocol.
  *  - "onload,event", Evas_Object*: a frame onload event has been received.
  *  - "populate,visited,links": tells the client to fill the visited links set.
@@ -294,6 +297,36 @@
     /* to be extended */
 };
 
+/// Creates a type name for @a _Ewk_View_Navigation_Data.
+typedef struct _Ewk_View_Navigation_Data Ewk_View_Navigation_Data;
+
+/**
+ * @brief Structure containing details about a view navigation.
+ *
+ * Details of a view navigation. It is used in "navigate,with,data" signal.
+ */
+struct _Ewk_View_Navigation_Data {
+    const char *url;  /**< URL for the history. */
+    const char *title;  /**< Title of the navigated page. */
+    Ewk_Frame_Resource_Request *request;  /**< Navigation request. */
+    Ewk_Frame_Resource_Response *response;  /**< Navigation response. */
+    Eina_Bool has_substitute_data;  /**< Data substitution flag. */
+    const char *client_redirect_source;  /**< Client redirect source URL. */
+};
+
+
+/// Creates a type name for @a _Ewk_View_Redirection_Data.
+typedef struct _Ewk_View_Redirection_Data Ewk_View_Redirection_Data;
+
+/**
+ * @brief Structure containing details about a view redirection.
+ *
+ * Details of a client or server redirection. It is used in "perform,client,redirect" and "perform,server,redirect" signals.
+ */
+struct _Ewk_View_Redirection_Data {
+    const char *source_url;  /**< Redirect source URL. */
+    const char *destination_url;  /**< Redirect destination URL. */ 
+};
 /// Creates a type name for @a _Ewk_Scroll_Request.
 typedef struct _Ewk_Scroll_Request Ewk_Scroll_Request;
 /// Contains the scroll request that should be processed by subclass implementations.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to