Add smart callback to provide the popup reply waiting status.
authorByungwoo Lee <bw80.lee@samsung.com>
Tue, 18 Jun 2013 03:48:22 +0000 (12:48 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 21 Jun 2013 01:36:14 +0000 (01:36 +0000)
[Title] Add smart callback to provide the popup reply waiting status.
[Problem] Application wants to check whether webkit is waiting for the popup reply or not, but there is no way to check if the application doesn't costomize popups.
[Cause] There is no way to notify the status.
[Solution] Add smart callback 'popup,reply,wait,start' and 'popup,reply,wait,finish' to the ewk view to provide the status.

Change-Id: I691d2566b811abe687aa1777c11693b0c6eedab2

Source/WTF/wtf/Platform.h
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebUIClient.cpp
Source/WebKit2/UIProcess/WebUIClient.h
Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp
Source/WebKit2/UIProcess/efl/PageUIClientEfl.h
Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp

index 6e8fe2f..f41038a 100755 (executable)
@@ -630,6 +630,7 @@ com) : Patch to do not adjust cover rect as fixed pixel size*/
 #define ENABLE_TIZEN_WEBKIT2_THEME_SET_INTERNAL 1 /* Ryuan Choi(ryuan.choi@samsung.com) : Set to default theme for WK2/tizen */
 #define ENABLE_TIZEN_WEBKIT2_PROXY 1 /* Ryuan Choi(ryuan.choi@samsung.com) : Provide API to set proxy */
 #define ENABLE_TIZEN_WEBKIT2_POPUP_INTERNAL 1 /* Ryuan Choi(ryuan.choi@samsung.com) : popup implementation for WK2/tizen internal */
+#define ENABLE_TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS 1 /* Byungwoo Lee(bw80.lee@samsung.com) : Notify popup reply status through the smart callback */
 #define ENABLE_TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL ENABLE_TIZEN_SCREEN_ORIENTATION_SUPPORT /* Ryuan choi9ryuan.choi@samsung.com) : temporal implementation for screen orientation lock callback */
 
 #define ENABLE_TIZEN_WEBKIT2_FOCUS_RING 1 /* Yuni Jeong(yhnet.jung@samsung.com) : Focus ring implementation for WK2 */
index f97cd44..6b8a999 100755 (executable)
@@ -210,6 +210,9 @@ typedef uint32_t WKPluginUnavailabilityReason;
 // UI Client
 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
 //#if OS(TIZEN)
+//#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+typedef void (*WKPageNotifyPopupReplyWaitingStateCallback)(WKPageRef page, bool isWaiting, const void* clientInfo);
+//#endif
 typedef bool (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo);
 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo);
 typedef bool (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void* clientInfo);
@@ -317,11 +320,14 @@ struct WKPageUIClient {
     WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
 
-//#if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
     // Version 2
+//#if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
     WKPageShowColorPickerCallback                                       showColorPicker;
     WKPageHideColorPickerCallback                                       hideColorPicker;
 //#endif
+//#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    WKPageNotifyPopupReplyWaitingStateCallback                          notifyPopupReplyWaitingState;
+//#endif
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
index 62ff9e6..f9377ae 100644 (file)
@@ -3050,6 +3050,16 @@ Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int*
     return true;
 }
 
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+void ewkViewNotifyPopupReplyWaitingState(Evas_Object* ewkView, bool isWaiting)
+{
+    if (isWaiting)
+        evas_object_smart_callback_call(ewkView, "popup,reply,wait,start", 0);
+    else
+        evas_object_smart_callback_call(ewkView, "popup,reply,wait,finish", 0);
+}
+#endif
+
 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
index a8d5239..1ccce62 100755 (executable)
@@ -148,6 +148,9 @@ void ewk_view_process_crashed(Evas_Object* ewkView);
 void ewkViewCustomizeContextMenu(Evas_Object* ewkView, Ewk_Context_Menu* menu);
 void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu_Item* item);
 uint64_t ewkContextGetDatabaseQuota(Ewk_Context* ewkContext);
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+void ewkViewNotifyPopupReplyWaitingState(Evas_Object* ewkView, bool isWaiting);
+#endif
 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText);
 bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message);
 bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue);
index f9a4d26..69074d2 100755 (executable)
@@ -2660,6 +2660,9 @@ void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, P
     process()->responsivenessTimer()->stop();
 
     m_alertReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2676,6 +2679,9 @@ void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_confirmReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2692,6 +2698,9 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_promptReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
index 2994bf3..40b4454 100644 (file)
@@ -122,6 +122,13 @@ void WebUIClient::unfocus(WebPageProxy* page)
 }
 
 #if OS(TIZEN)
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+void WebUIClient::notifyPopupReplyWaitingState(WebPageProxy* page, bool isWaiting)
+{
+    return m_client.notifyPopupReplyWaitingState(toAPI(page), isWaiting, m_client.clientInfo);
+}
+#endif
+
 bool WebUIClient::runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame)
 {
 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
index 42ca581..2470ad5 100644 (file)
@@ -68,6 +68,9 @@ public:
     void unfocus(WebPageProxy*);
 
 #if OS(TIZEN)
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    void notifyPopupReplyWaitingState(WebPageProxy*, bool);
+#endif
     bool runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
     bool runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
index a396031..7f544ec 100755 (executable)
@@ -65,6 +65,13 @@ WKPageRef PageUIClientEfl::createNewPage(WKPageRef, WKURLRequestRef, WKDictionar
 }
 
 #if OS(TIZEN)
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+void PageUIClientEfl::notifyPopupReplyWaitingState(WKPageRef, bool isWaiting, const void* clientInfo)
+{
+    ewkViewNotifyPopupReplyWaitingState(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), isWaiting);
+}
+#endif
+
 bool PageUIClientEfl::runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo)
 {
     return ewkViewRunJavaScriptAlert(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), alertText);
@@ -236,6 +243,10 @@ PageUIClientEfl::PageUIClientEfl(EwkViewImpl* viewImpl)
     uiClient.hideColorPicker = hideColorPicker;
 #endif
 
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    uiClient.notifyPopupReplyWaitingState = notifyPopupReplyWaitingState;
+#endif
+
 #if OS(TIZEN)
 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
     uiClient.runBeforeUnloadConfirmPanel = runBeforeUnloadConfirmPanel;
index 621ca8c..c897a84 100755 (executable)
@@ -48,6 +48,9 @@ private:
     static void closePage(WKPageRef, const void*);
     static WKPageRef createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
 #if OS(TIZEN)
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    static void notifyPopupReplyWaitingState(WKPageRef, bool, const void*);
+#endif
     static bool runJavaScriptAlert(WKPageRef, WKStringRef, WKFrameRef, const void*);
     static bool runJavaScriptConfirm(WKPageRef, WKStringRef, WKFrameRef, const void*);
     static bool runJavaScriptPrompt(WKPageRef, WKStringRef, WKStringRef, WKFrameRef, const void*);
index cf0398f..645ef16 100755 (executable)
@@ -731,6 +731,9 @@ void WebPageProxy::replyJavaScriptAlert()
 
     m_alertReply->send();
     m_alertReply = nullptr;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, false);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
 #endif
@@ -743,6 +746,9 @@ void WebPageProxy::replyJavaScriptConfirm(bool result)
 
     m_confirmReply->send(result);
     m_confirmReply = nullptr;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, false);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
 #endif
@@ -755,6 +761,9 @@ void WebPageProxy::replyJavaScriptPrompt(const String& result)
 
     m_promptReply->send(result);
     m_promptReply = nullptr;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, false);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
 #endif