[M69 Dev] Implements IPC::Sender in WebContentsDelegateEfl 96/193396/1
authorUzair <uzair.jaleel@samsung.com>
Tue, 20 Nov 2018 06:38:55 +0000 (22:38 -0800)
committerUzair <uzair.jaleel@samsung.com>
Tue, 20 Nov 2018 06:40:50 +0000 (22:40 -0800)
IPC::Sender of WebContentsObserver was removed in the upstream [1].
Implemented IPC::Sender to send a reply message through current
RenderViewHost by the received message as before.

[1] https://chromium-review.googlesource.com/630416

Reference:
https://review.tizen.org/gerrit/c/platform/framework/web/chromium-efl/+/175401

Change-Id: I9dcf9625544ae410831f26b726425360e40303e1
Signed-off-by: Uzair <uzair.jaleel@samsung.com>
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h

index e92a42c..142ed24 100644 (file)
@@ -518,19 +518,13 @@ void WebContentsDelegateEfl::OnUpdateSettings(const Ewk_Settings* settings) {
 bool WebContentsDelegateEfl::OnMessageReceived(const IPC::Message& message) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(WebContentsDelegateEfl, message)
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-    // FIXME: WebContentsObserver is IPC:: listener only cannot send
     IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_GetContentSecurityPolicy,
                                     OnGetContentSecurityPolicy)
-#endif
     IPC_MESSAGE_HANDLER(EwkHostMsg_DidPrintPagesToPdf,
                         OnPrintedMetafileReceived)
     IPC_MESSAGE_HANDLER(EwkHostMsg_WrtMessage, OnWrtPluginMessage)
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-    // FIXME: WebContentsObserver is IPC:: listener only cannot send
     IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_WrtSyncMessage,
                                     OnWrtPluginSyncMessage)
-#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
 
@@ -557,6 +551,14 @@ void WebContentsDelegateEfl::DidFailLoad(
                              is_main_frame);
 }
 
+bool WebContentsDelegateEfl::Send(IPC::Message* message) {
+  if (!web_contents_.GetRenderViewHost()) {
+    delete message;
+    return false;
+  }
+  return web_contents_.GetRenderViewHost()->Send(message);
+}
+
 void WebContentsDelegateEfl::OnWrtPluginMessage(
     const Ewk_Wrt_Message_Data& data) {
   std::unique_ptr<Ewk_Wrt_Message_Data> p(new Ewk_Wrt_Message_Data);
@@ -575,10 +577,7 @@ void WebContentsDelegateEfl::OnWrtPluginSyncMessage(
   Ewk_Wrt_Message_Data tmp = data;
   web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(&tmp);
   EwkHostMsg_WrtSyncMessage::WriteReplyParams(reply, tmp.value);
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-  // WebContentsObserver is IPC:: listener only cannot send
   Send(reply);
-#endif
 }
 
 void WebContentsDelegateEfl::DidFirstVisuallyNonEmptyPaint() {
@@ -603,10 +602,7 @@ void WebContentsDelegateEfl::OnGetContentSecurityPolicy(
         pending_content_security_policy_->header_type);
     pending_content_security_policy_.reset();
   }
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-  // WebContentsObserver is IPC:: listener only cannot send
   Send(reply_msg);
-#endif
 }
 
 void WebContentsDelegateEfl::OnPrintedMetafileReceived(
index 1414777..91d237a 100644 (file)
@@ -30,7 +30,8 @@ namespace content {
 struct DateTimeSuggestion;
 
 class WebContentsDelegateEfl : public WebContentsDelegate,
-                               public WebContentsObserver {
+                               public WebContentsObserver,
+                               public IPC::Sender {
  public:
   WebContentsDelegateEfl(EWebView*);
   ~WebContentsDelegateEfl();
@@ -151,6 +152,9 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
                    int error_code,
                    const base::string16& error_description) override;
 
+  // IPC::Sender-----------------------------------------------------------
+  bool Send(IPC::Message* message) override;
+
   // EWK_BRINGUP: These APIs are removed in upstream.
   void TitleWasSet(content::NavigationEntry* entry, bool explicit_set);