break dependency to Ewk_IPC_Wrt_Message_Data (removed ewk_ipc_message.h)
authorSeungSeop Park <sns.park@samsung.com>
Sat, 14 Jun 2014 06:37:04 +0000 (15:37 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
It's renamed to tizen_webview::WrtIpcMessageData with additional methods.

In addition, following refactorings were performed during the task.
* rename function:
  - ewk_ipc_wrt_message_send_private
    => tizen_webview::WrtIpc::SendMessage
  - ewk_ipc_plugins_message_send_private
    => tizen_webview::WrtPluginsIpc::SendMessage
  - ewk_ipc_plugins_sync_message_send_private
    => tizen_webview::WrtPluginsIpc::SendSyncMessage
* delete file:
  - impl/API/ewk_ipc_message_private.h|cc => merged to tw_wrt.h|cc

Issue: CBEFL-92
Change-Id: I3bd7ee4d296a5e04b6852f357c3746af8c2b5aaa

18 files changed:
tizen_src/ewk_api_headers/public/ewk_ipc_message.h [deleted file]
tizen_src/impl/chromium-efl.gyp
tizen_src/impl/common/render_messages_efl.h
tizen_src/impl/eweb_context.cc
tizen_src/impl/eweb_context.h
tizen_src/impl/eweb_view_callbacks.h
tizen_src/impl/renderer/content_renderer_client_efl.cc
tizen_src/impl/renderer/content_renderer_client_efl.h
tizen_src/impl/renderer/render_process_observer_efl.cc
tizen_src/impl/renderer/render_process_observer_efl.h
tizen_src/impl/tizen_webview/public/tw_wrt.cc [new file with mode: 0644]
tizen_src/impl/tizen_webview/public/tw_wrt.h [new file with mode: 0644]
tizen_src/impl/web_contents_delegate_efl.cc
tizen_src/impl/web_contents_delegate_efl.h
tizen_src/impl/wrt/dynamicplugin.cc
tizen_src/impl/wrt/dynamicplugin.h
tizen_src/impl/wrt/wrtwidget.cc
tizen_src/impl/wrt/wrtwidget.h

diff --git a/tizen_src/ewk_api_headers/public/ewk_ipc_message.h b/tizen_src/ewk_api_headers/public/ewk_ipc_message.h
deleted file mode 100644 (file)
index cdc7a27..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2013 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 program 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 program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * @file    ewk_ipc_message.h
- * @brief   Custom support for ipc messages
- */
-
-#ifndef EWK_IPC_MESSAGE_H
-#define EWK_IPC_MESSAGE_H
-
-
-typedef struct Ewk_IPC_Wrt_Message_Data Ewk_IPC_Wrt_Message_Data;
-
-
-#endif // EWK_IPC_MESSAGE_H
index 5085ace..4ea4bb2 100644 (file)
@@ -61,8 +61,6 @@
       'API/ewk_geolocation_private.h',
       'API/ewk_hit_test_private.cc',
       'API/ewk_hit_test_private.h',
-      'API/ewk_ipc_message_private.cc',
-      'API/ewk_ipc_message_private.h',
       'API/ewk_notification_private.cc',
       'API/ewk_notification_private.h',
       'API/ewk_policy_decision_private.cc',
       '<(chrome_src_dir)/tizen_webview/public/tw_url.h',
       '<(chrome_src_dir)/tizen_webview/public/tw_web_context.h',
       '<(chrome_src_dir)/tizen_webview/public/tw_web_context.cc',
+      '<(chrome_src_dir)/tizen_webview/public/tw_wrt.h',
+      '<(chrome_src_dir)/tizen_webview/public/tw_wrt.cc',
       '<(chrome_src_dir)/tizen_webview/tw_misc_utility.h',
       '<(chrome_src_dir)/tizen_webview/tw_misc_utility.cc',
       'url_request_context_getter_efl.cc',
index f68bb96..df40377 100644 (file)
@@ -7,17 +7,16 @@
 #include "content/public/common/referrer.h"
 #include "API/ewk_hit_test_private.h"
 #include "API/ewk_text_style_private.h"
-#include "API/ewk_ipc_message_private.h"
 #include "cache_params_efl.h"
 #include "public/ewk_view.h"
 #include "navigation_policy_params.h"
-#include "public/ewk_ipc_message.h"
 #include "renderer/print_pages_params.h"
 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
 #include "third_party/WebKit/public/web/WebNavigationType.h"
 #include "url/gurl.h"
 
 #include "tizen_webview/public/tw_hit_test.h"
+#include "tizen_webview/public/tw_wrt.h"
 
 #include <string>
 #include <map>
@@ -112,7 +111,7 @@ IPC_STRUCT_TRAITS_BEGIN(DidPrintPagesParams)
   IPC_STRUCT_TRAITS_MEMBER(filename)
 IPC_STRUCT_TRAITS_END()
 
-IPC_STRUCT_TRAITS_BEGIN(Ewk_IPC_Wrt_Message_Data)
+IPC_STRUCT_TRAITS_BEGIN(tizen_webview::WrtIpcMessageData)
   IPC_STRUCT_TRAITS_MEMBER(type)
   IPC_STRUCT_TRAITS_MEMBER(value)
   IPC_STRUCT_TRAITS_MEMBER(id)
@@ -140,7 +139,7 @@ IPC_MESSAGE_CONTROL4(EwkViewMsg_SetWidgetInfo,
                      std::string)    // result: encodedBundle
 
 IPC_MESSAGE_CONTROL1(EwkViewMsg_SendWrtMessage,
-                     Ewk_IPC_Wrt_Message_Data /* data */);
+                     tizen_webview::WrtIpcMessageData /* data */);
 
 IPC_MESSAGE_ROUTED0(EwkViewMsg_GetSelectionStyle)
 
@@ -176,7 +175,7 @@ IPC_SYNC_MESSAGE_ROUTED0_2(EwkHostMsg_GetContentSecurityPolicy,
                            Ewk_CSP_Header_Type /* header type */)
 
 IPC_SYNC_MESSAGE_ROUTED1_1(EwkHostMsg_WrtSyncMessage,
-                           Ewk_IPC_Wrt_Message_Data /* data */,
+                           tizen_webview::WrtIpcMessageData /* data */,
                            std::string /*result*/);
 
 IPC_MESSAGE_ROUTED3(EwkViewMsg_Scale,
@@ -192,7 +191,7 @@ IPC_MESSAGE_ROUTED2(EwkHostMsg_PlainTextGetContents,
                     int /* callback id */)
 
 IPC_MESSAGE_ROUTED1(EwkHostMsg_WrtMessage,
-                    Ewk_IPC_Wrt_Message_Data /* data */);
+                    tizen_webview::WrtIpcMessageData /* data */);
 
 IPC_MESSAGE_ROUTED2(EwkHostMsg_DidChangeContentsSize,
                     int, /* width */
index 46f2e8e..3db554d 100644 (file)
@@ -44,6 +44,7 @@
 #include "common/render_messages_efl.h"
 
 #include "tizen_webview/public/tw_security_origin.h"
+#include "tizen_webview/public/tw_wrt.h"
 #include "tizen_webview/tw_misc_utility.h"
 
 using content::BrowserThread;
@@ -217,7 +218,7 @@ void EWebContext::SendWidgetInfo(int widget_id, double scale, const string &them
   }
 }
 
-void EWebContext::SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& data) {
+void EWebContext::SendWrtMessage(const tizen_webview::WrtIpcMessageData& data) {
   content::RenderProcessHost::iterator i(content::RenderProcessHost::AllHostsIterator());
   for (; !i.IsAtEnd(); i.Advance()) {
     i.GetCurrentValue()->Send(new EwkViewMsg_SendWrtMessage(data));
index c3c109f..c92044f 100644 (file)
 namespace tizen_webview {
 class URL;
 class WebContext;
+class WrtIpcMessageData;
 }
 
 typedef std::map<std::string, std::string> HTTPCustomHeadersEflMap;
 
 class CookieManager;
-struct Ewk_IPC_Wrt_Message_Data;
 
 namespace content {
 class BrowserContextEfl;
@@ -100,7 +100,7 @@ class EWebContext {
   Evas_Object *AddFaviconObject(const char* uri, Evas* canvas) const;
 
   void SendWidgetInfo(int widget_id, double scale, const std::string &theme, const std::string &encoded_bundle);
-  void SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& message);
+  void SendWrtMessage(const tizen_webview::WrtIpcMessageData& message);
 
   void SetPixmap(int pixmap) { m_pixmap = pixmap; }
   int Pixmap() const { return m_pixmap; }
index 8656d48..e6a6e7c 100644 (file)
@@ -31,7 +31,6 @@
 #include "API/ewk_user_media_private.h"
 #include "public/ewk_notification.h"
 #include "public/ewk_policy_decision.h"
-#include "public/ewk_ipc_message.h"
 #include "tizen_webview/public/tw_custom_handlers.h"
 
 #include <Evas.h>
@@ -45,6 +44,7 @@ typedef struct EwkObject Ewk_Navigation_Policy_Decision;
 
 namespace tizen_webview {
 class Notification;
+class WrtIpcMessageData;
 }
 
 namespace EWebViewCallbacks {
@@ -279,7 +279,7 @@ DECLARE_EWK_VIEW_CALLBACK(ClipboardOpened, "clipboard,opened", void*);
 DECLARE_EWK_VIEW_CALLBACK(BackForwardListChange, "back,forward,list,changed", void);
 DECLARE_EWK_VIEW_CALLBACK(WebProcessCrashed, "webprocess,crashed", bool*);
 DECLARE_EWK_VIEW_CALLBACK(ConsoleMessage, "console,message", _Ewk_Console_Message*);
-DECLARE_EWK_VIEW_CALLBACK(WrtPluginsMessage, "wrt,message", Ewk_IPC_Wrt_Message_Data*);
+DECLARE_EWK_VIEW_CALLBACK(WrtPluginsMessage, "wrt,message", tizen_webview::WrtIpcMessageData*);
 DECLARE_EWK_VIEW_CALLBACK(IconReceived, "icon,received", void);
 }
 
index b2a17f3..c507e59 100644 (file)
@@ -116,7 +116,7 @@ void ContentRendererClientEfl::SetWidgetInfo(int widgetHandle,
   wrt_widget_->SetWidgetInfo(widgetHandle, scaleFactor, encodedBundle, theme);
 }
 
-void ContentRendererClientEfl::WrtMessageReceived(const Ewk_IPC_Wrt_Message_Data& data) {
+void ContentRendererClientEfl::WrtMessageReceived(const tizen_webview::WrtIpcMessageData& data) {
   wrt_widget_->messageReceived(data);
 }
 
index bc12737..47aa3bf 100644 (file)
@@ -4,7 +4,6 @@
 #include "content/public/renderer/content_renderer_client.h"
 #include "v8/include/v8.h"
 #include "renderer/render_process_observer_efl.h"
-#include "public/ewk_ipc_message.h"
 
 namespace content {
 class RenderView;
@@ -12,6 +11,10 @@ class RenderFrame;
 class DocumentState;
 }
 
+namespace tizen_webview {
+class WrtIpcMessageData;
+}
+
 namespace visitedlink {
 class VisitedLinkSlave;
 }
@@ -33,7 +36,7 @@ class ContentRendererClientEfl : public content::ContentRendererClient
                      const std::string &encodedBundle,
                      const std::string &theme);
 
-  void WrtMessageReceived(const Ewk_IPC_Wrt_Message_Data& data);
+  void WrtMessageReceived(const tizen_webview::WrtIpcMessageData& data);
 
   virtual void DidCreateScriptContext(blink::WebFrame* frame,
                                       v8::Handle<v8::Context> context,
index eff09e0..c468e9b 100644 (file)
@@ -38,7 +38,7 @@ void RenderProcessObserverEfl::OnWidgetInfo(int widget_id,
   content_client_->SetWidgetInfo(widget_id, scale, encoded_bundle, theme);
 }
 
-void RenderProcessObserverEfl::OnWrtMessage(const Ewk_IPC_Wrt_Message_Data& data)
+void RenderProcessObserverEfl::OnWrtMessage(const tizen_webview::WrtIpcMessageData& data)
 {
   content_client_->WrtMessageReceived(data);
 }
index f65c927..464516e 100644 (file)
@@ -6,7 +6,6 @@
 #include "content/public/renderer/render_process_observer.h"
 #include "common/render_messages_efl.h"
 #include "cache_params_efl.h"
-#include "public/ewk_ipc_message.h"
 
 namespace IPC {
 class Message;
@@ -30,7 +29,7 @@ private:
                     const std::string &theme,
                     const std::string &encoded_bundle);
   void OnSetCache(const CacheParamsEfl& params);
-  void OnWrtMessage(const Ewk_IPC_Wrt_Message_Data& data);
+  void OnWrtMessage(const tizen_webview::WrtIpcMessageData& data);
   ContentRendererClientEfl* content_client_;
   bool webkit_initialized_;
   CacheParamsEfl pending_cache_params_;
diff --git a/tizen_src/impl/tizen_webview/public/tw_wrt.cc b/tizen_src/impl/tizen_webview/public/tw_wrt.cc
new file mode 100644 (file)
index 0000000..a75aa2c
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tw_wrt.h"
+
+#include "content/public/renderer/render_view.h"
+#include "common/render_messages_efl.h"
+#include "eweb_context.h"
+#include "tizen_webview/public/tw_web_context.h"
+
+namespace tizen_webview {
+
+const char* WrtIpcMessageData::GetType() const {
+  return type.c_str();
+}
+
+void WrtIpcMessageData::SetType(const char* val) {
+  type = val;
+}
+
+const char* WrtIpcMessageData::GetValue() const {
+  return value.c_str();
+}
+
+void WrtIpcMessageData::SetValue(const char* val) {
+  value = val;
+}
+
+const char* WrtIpcMessageData::GetId() const {
+  return id.c_str();
+}
+
+void WrtIpcMessageData::SetId(const char* val) {
+  id = val;
+}
+
+const char* WrtIpcMessageData::GetReferenceId() const {
+  return reference_id.c_str();
+}
+
+void WrtIpcMessageData::SetReferenceId(const char* val) {
+  reference_id = val;
+}
+
+
+bool WrtIpc::SendMessage(WebContext* ctx, const WrtIpcMessageData& data) {
+  EWebContext* web_context = ctx->GetImpl();
+  if (!web_context) {
+    return false;
+  }
+  web_context->SendWrtMessage(data);
+  return true;
+}
+
+bool WrtPluginsIpc::SendMessage(int routing_id, const WrtIpcMessageData& data) {
+  content::RenderView* rv = content::RenderView::FromRoutingID(routing_id);
+  if (!rv) {
+     return false;
+  }
+  rv->Send(new EwkHostMsg_WrtMessage(rv->GetRoutingID(), data));
+  return true;
+}
+
+bool WrtPluginsIpc::SendSyncMessage(int routing_id, WrtIpcMessageData* data) {
+  content::RenderView* rv = content::RenderView::FromRoutingID(routing_id);
+  if (!rv) {
+    return false;
+  }
+
+  rv->Send(new EwkHostMsg_WrtSyncMessage(routing_id, *data, &data->value));
+  return true;
+}
+
+} // namespace tizen_webview
diff --git a/tizen_src/impl/tizen_webview/public/tw_wrt.h b/tizen_src/impl/tizen_webview/public/tw_wrt.h
new file mode 100644 (file)
index 0000000..043f9b4
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TIZEN_WEBVIEW_PUBLIC_TW_WRT_H_
+#define TIZEN_WEBVIEW_PUBLIC_TW_WRT_H_
+
+#include <string>
+
+namespace tizen_webview {
+
+struct WrtIpcMessageData {
+  std::string type;
+  std::string value;
+  std::string id;
+  std::string reference_id;
+
+  const char* GetType() const;
+  void SetType(const char* val);
+  const char* GetValue() const;
+  void SetValue(const char* val);
+  const char* GetId() const;
+  void SetId(const char* val);
+  const char* GetReferenceId() const;
+  void SetReferenceId(const char* val);
+};
+
+class WebContext;
+
+struct WrtIpc {
+  static bool SendMessage(WebContext* ctx, const WrtIpcMessageData& data);
+};
+
+struct WrtPluginsIpc {
+  static bool SendMessage(int routing_id, const WrtIpcMessageData& data);
+  static bool SendSyncMessage(int routing_id, WrtIpcMessageData* data);
+};
+
+} // namespace tizen_webview
+
+#endif  // TIZEN_WEBVIEW_PUBLIC_TW_WRT_H_
index 0d3f606..efe9cf7 100644 (file)
@@ -28,6 +28,8 @@
 #include "printing/pdf_metafile_skia.h"
 #include "url/gurl.h"
 #include "browser/favicon/favicon_service.h"
+
+#include "tizen_webview/public/tw_web_context.h"
 #include "tizen_webview/public/tw_input_type.h"
 
 #ifdef TIZEN_AUTOFILL_SUPPORT
@@ -429,8 +431,8 @@ void WebContentsDelegateEfl::OnFormSubmit(const GURL&url) {
   web_view_->SmartCallback<EWebViewCallbacks::FormSubmit>().call(url.GetContent().c_str());
 }
 
-void WebContentsDelegateEfl::OnWrtPluginMessage(const Ewk_IPC_Wrt_Message_Data& data) {
-  scoped_ptr<Ewk_IPC_Wrt_Message_Data> p(new Ewk_IPC_Wrt_Message_Data);
+void WebContentsDelegateEfl::OnWrtPluginMessage(const tizen_webview::WrtIpcMessageData& data) {
+  scoped_ptr<tizen_webview::WrtIpcMessageData> p(new tizen_webview::WrtIpcMessageData);
   p->type = data.type;
   p->value = data.value;
   p->id = data.id;
@@ -439,9 +441,9 @@ void WebContentsDelegateEfl::OnWrtPluginMessage(const Ewk_IPC_Wrt_Message_Data&
   web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(p.get());
 }
 
-void WebContentsDelegateEfl::OnWrtPluginSyncMessage(const Ewk_IPC_Wrt_Message_Data& data,
+void WebContentsDelegateEfl::OnWrtPluginSyncMessage(const tizen_webview::WrtIpcMessageData& data,
                                                     IPC::Message* reply) {
-  scoped_ptr<Ewk_IPC_Wrt_Message_Data> tmp(new Ewk_IPC_Wrt_Message_Data);
+  scoped_ptr<tizen_webview::WrtIpcMessageData> tmp(new tizen_webview::WrtIpcMessageData);
   tmp->type = data.type;
   web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(tmp.get());
   EwkHostMsg_WrtSyncMessage::WriteReplyParams(reply, tmp->value);
index 144c47d..049e81c 100644 (file)
@@ -9,7 +9,6 @@
 #include "browser/javascript_dialog_manager_efl.h"
 #include "browser_context_efl.h"
 #include "eweb_view.h"
-#include "public/ewk_ipc_message.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_delegate.h"
 #include "content/public/common/frame_navigate_params.h"
 
 class DidPrintPagesParams;
 
+namespace tizen_webview {
+class WrtIpcMessageData;
+}
+
 namespace content {
 struct DateTimeSuggestion;
 
@@ -165,8 +168,8 @@ class WebContentsDelegateEfl
 
  private:
   void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
-  void OnWrtPluginMessage(const Ewk_IPC_Wrt_Message_Data& data);
-  void OnWrtPluginSyncMessage(const Ewk_IPC_Wrt_Message_Data& data,
+  void OnWrtPluginMessage(const tizen_webview::WrtIpcMessageData& data);
+  void OnWrtPluginSyncMessage(const tizen_webview::WrtIpcMessageData& data,
                               IPC::Message* reply);
 
   EWebView* web_view_;
index 41b1d35..fd7a3ee 100644 (file)
@@ -89,8 +89,8 @@ DynamicPlugin& DynamicPlugin::instance() {
   return dynamicPlugin;
 }
 
-void DynamicPlugin::messageReceived(const Ewk_IPC_Wrt_Message_Data& data) {
-  if(!m_onIPCMessage)
+void DynamicPlugin::messageReceived(const tizen_webview::WrtIpcMessageData& data) {
+  if (!m_onIPCMessage)
     return;
 
   m_onIPCMessage(data);
index c205310..901cfcb 100644 (file)
 
 #include <string>
 #include "v8/include/v8.h"
-#include "public/ewk_ipc_message.h"
+
+
+namespace tizen_webview {
+class WrtIpcMessageData;
+}
 
 typedef void (*startSessionFun)(int,
                                 v8::Handle<v8::Context>,
@@ -31,7 +35,7 @@ typedef void (*startSessionFun)(int,
                                 const char*,
                                 const char*);
 
-typedef void (*onIPCMessageFun)(const Ewk_IPC_Wrt_Message_Data&);
+typedef void (*onIPCMessageFun)(const tizen_webview::WrtIpcMessageData&);
 
 typedef void (*parseUrlFun)(std::string*, std::string*, int);
 typedef void (*databaseAttachFun)(int);
@@ -47,7 +51,7 @@ class DynamicPlugin {
 
   void parseURL(std::string* old_url, std::string* new_url, int widget_id);
 
-  void messageReceived(const Ewk_IPC_Wrt_Message_Data& data);
+  void messageReceived(const tizen_webview::WrtIpcMessageData& data);
 
   ~DynamicPlugin();
 
index 9bf1200..e11b9eb 100644 (file)
@@ -64,8 +64,7 @@ void WrtWidget::StopSession(v8::Handle<v8::Context> context) {
   //TODO: stop session
 }
 
-void WrtWidget::messageReceived(const Ewk_IPC_Wrt_Message_Data& data) {
-    if (widgetHandle_ != -1) {
-        DynamicPlugin::instance().messageReceived(data);
-    }
+void WrtWidget::messageReceived(const tizen_webview::WrtIpcMessageData& data) {
+  if (widgetHandle_ != -1)
+    DynamicPlugin::instance().messageReceived(data);
 }
index 1964399..5f7537e 100644 (file)
 #include <string>
 #include "url/gurl.h"
 #include "v8/include/v8.h"
-#include "public/ewk_ipc_message.h"
+
+namespace tizen_webview {
+class WrtIpcMessageData;
+}
 
 class WrtWidget {
  public:
@@ -34,7 +37,7 @@ class WrtWidget {
                      const std::string& encodedBundle,
                      const std::string& theme);
 
-  void messageReceived(const Ewk_IPC_Wrt_Message_Data& data);
+  void messageReceived(const tizen_webview::WrtIpcMessageData& data);
 
   void ParseUrl(const GURL& url, GURL& new_url);