Title: [185138] trunk/Source/WebKit2
Revision
185138
Author
commit-qu...@webkit.org
Date
2015-06-02 19:33:16 -0700 (Tue, 02 Jun 2015)

Log Message

[EFL] Implement load_started callback in EwkPageClient.
https://bugs.webkit.org/show_bug.cgi?id=145545

Patch by Hyungwook Lee <hyungwook....@navercorp.com> on 2015-06-02
Reviewed by Gyuyoung Kim.

We need to provide load_started callback to web extension module.

* UIProcess/API/efl/tests/extensions/extension_sample.cpp:
* WebProcess/InjectedBundle/API/efl/ewk_page.cpp:
(EwkPage::EwkPage):
(EwkPage::remove):
(EwkPage::didStartProvisionalLoadForFrame):
(EwkPage::didFinishDocumentLoadForFrame):
* WebProcess/InjectedBundle/API/efl/ewk_page.h:
* WebProcess/InjectedBundle/API/efl/ewk_page_private.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185137 => 185138)


--- trunk/Source/WebKit2/ChangeLog	2015-06-03 01:29:43 UTC (rev 185137)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-03 02:33:16 UTC (rev 185138)
@@ -1,3 +1,21 @@
+2015-06-02  Hyungwook Lee  <hyungwook....@navercorp.com>
+
+        [EFL] Implement load_started callback in EwkPageClient.
+        https://bugs.webkit.org/show_bug.cgi?id=145545
+
+        Reviewed by Gyuyoung Kim.
+
+        We need to provide load_started callback to web extension module.
+
+        * UIProcess/API/efl/tests/extensions/extension_sample.cpp:
+        * WebProcess/InjectedBundle/API/efl/ewk_page.cpp:
+        (EwkPage::EwkPage):
+        (EwkPage::remove):
+        (EwkPage::didStartProvisionalLoadForFrame):
+        (EwkPage::didFinishDocumentLoadForFrame):
+        * WebProcess/InjectedBundle/API/efl/ewk_page.h:
+        * WebProcess/InjectedBundle/API/efl/ewk_page_private.h:
+
 2015-06-02  Gavin Barraclough  <barraclo...@apple.com>
 
         PDFs always think they're visible on iOS.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/extensions/extension_sample.cpp (185137 => 185138)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/extensions/extension_sample.cpp	2015-06-03 01:29:43 UTC (rev 185137)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/extensions/extension_sample.cpp	2015-06-03 02:33:16 UTC (rev 185138)
@@ -30,6 +30,8 @@
 extern "C" {
 #endif
 
+static Eina_Bool pageLoadStarted = false;
+
 static JSValueRef helloCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     Ewk_Extension* extension = static_cast<Ewk_Extension*>(JSObjectGetPrivate(thisObject));
@@ -42,8 +44,17 @@
     return nullptr;
 }
 
+void loadStarted(Ewk_Page* page, void* data)
+{
+    pageLoadStarted = true;
+}
+    
 void loadFinished(Ewk_Page* page, void* data)
 {
+    if (!pageLoadStarted)
+        return;
+    pageLoadStarted = false;
+
     JSGlobalContextRef jsContext = ewk_page_js_global_context_get(page);
     JSObjectRef windowObject = JSContextGetGlobalObject(jsContext);
 
@@ -73,6 +84,7 @@
 {
     pageClient.version = 1;
     pageClient.data = ""
+    pageClient.load_started = loadStarted;
     pageClient.load_finished = loadFinished;
 
     ewk_page_client_register(page, &pageClient);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.cpp (185137 => 185138)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.cpp	2015-06-03 01:29:43 UTC (rev 185137)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.cpp	2015-06-03 02:33:16 UTC (rev 185138)
@@ -48,7 +48,7 @@
             7, // version
             this, // clientInfo
         },
-        0, // didStartProvisionalLoadForFrame,
+        didStartProvisionalLoadForFrame,
         0, // didReceiveServerRedirectForProvisionalLoadForFrame,
         0, // didFailProvisionalLoadWithErrorForFrame
         0, // didCommitLoadForFrame
@@ -97,6 +97,18 @@
     m_clients.remove(m_clients.find(client));
 }
 
+void EwkPage::didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
+{
+    if (!WKBundleFrameIsMainFrame(frame))
+        return;
+
+    EwkPage* self = toEwkPage(clientInfo);
+    for (auto& it : self->m_clients) {
+        if (it->load_started)
+            it->load_started(self, it->data);
+    }
+}
+
 void EwkPage::didFinishDocumentLoadForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
 {
     if (!WKBundleFrameIsMainFrame(frame))

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.h (185137 => 185138)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.h	2015-06-03 01:29:43 UTC (rev 185137)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page.h	2015-06-03 02:33:16 UTC (rev 185138)
@@ -49,6 +49,14 @@
     void *data;
 
     /**
+     * Callbacks to report load started.
+     *
+     * @param page page to be started
+     * @param data data of a page client
+     */
+    void (*load_started)(EwkPage *page, void *data);
+
+    /**
      * Callbacks to report load finished.
      *
      * @param page page to be finished

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page_private.h (185137 => 185138)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page_private.h	2015-06-03 01:29:43 UTC (rev 185137)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_page_private.h	2015-06-03 02:33:16 UTC (rev 185138)
@@ -42,6 +42,7 @@
     void remove(const Ewk_Page_Client*);
 
 private:
+    static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void *);
     static void didFinishDocumentLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void *);
 
     WebKit::WebPage* m_page;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to