[M34-Merge] Add interface for sending appID to WRT
authorDongjun Kim <djmix.kim@samsung.com>
Fri, 23 Jan 2015 11:31:11 +0000 (20:31 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
We need to add new function for sending application id to WRT.
It is a requirement from WRT.
So, we add DynamicSetWidgetInfo() for this.

Original patch:
http://165.213.202.130:8080/#/c/70427/7

BUG : http://107.108.218.239/bugzilla/show_bug.cgi?id=6168
Reviewed by: Min-Soo Koo, Piotr Tworek

Change-Id: Ic58c75caf69e2133f3c8ee091a18fed9424cf915
Signed-off-by: Dongjun Kim <djmix.kim@samsung.com>
tizen_src/impl/wrt/dynamicplugin.cc
tizen_src/impl/wrt/dynamicplugin.h
tizen_src/impl/wrt/wrtwidget.cc

index a451d4a..5124109 100644 (file)
@@ -11,6 +11,7 @@ namespace {
 const char* const INJECTED_BUNDLE_LIBRARY = "/usr/lib/libwrt-injected-bundle.so";
 const char* const START_SESSION_FUNCTION = "DynamicPluginStartSession";
 const char* const URL_PARSING_FUNCTION = "DynamicUrlParsing";
+const char* const SET_WIDGET_INFO_FUNCTION = "DynamicSetWidgetInfo";
 const char* const DATABASE_ATTACH_FUNCTION = "DynamicDatabaseAttach";
 }
 
@@ -18,6 +19,7 @@ DynamicPlugin::DynamicPlugin()
   : m_handle(0),
     m_startSession(0),
     m_parseURL(0),
+    m_setWidgetInfo(0),
     m_databaseAttach(0) {
   m_handle = dlopen(INJECTED_BUNDLE_LIBRARY, RTLD_LAZY);
   if (!m_handle) {
@@ -33,6 +35,10 @@ DynamicPlugin::DynamicPlugin()
   if (!m_parseURL) {
     LOG(ERROR) << "No " << URL_PARSING_FUNCTION << " symbol found!\n";
   }
+  *reinterpret_cast<void **>(&m_setWidgetInfo) = dlsym(m_handle, SET_WIDGET_INFO_FUNCTION);
+  if (!m_setWidgetInfo) {
+    LOG(ERROR) << "No " << SET_WIDGET_INFO_FUNCTION << " symbol found!";
+  }
   *reinterpret_cast<void **>(&m_databaseAttach) = dlsym(m_handle, DATABASE_ATTACH_FUNCTION);
   if (!m_databaseAttach) {
     LOG(ERROR) << "No " << DATABASE_ATTACH_FUNCTION << " symbol found!\n";
@@ -62,6 +68,12 @@ void DynamicPlugin::parseURL(std::string* old_url, std::string* new_url, int wid
   m_parseURL(old_url, new_url, widget_id);
 }
 
+void DynamicPlugin::setWidgetInfo(int widgetHandle) {
+  if (!m_setWidgetInfo)
+    return;
+  m_setWidgetInfo(widgetHandle);
+}
+
 DynamicPlugin::~DynamicPlugin() {
   if (m_databaseAttach)
     m_databaseAttach(0);
index 0f4b9d8..1a76aae 100644 (file)
@@ -23,6 +23,7 @@ typedef void (*startSessionFun)(int,
 typedef void (*onIPCMessageFun)(const tizen_webview::WrtIpcMessageData&);
 
 typedef void (*parseUrlFun)(std::string*, std::string*, int);
+typedef void (*setWidgetInfoFun)(int);
 typedef void (*databaseAttachFun)(int);
 
 class DynamicPlugin {
@@ -35,7 +36,7 @@ class DynamicPlugin {
                     const char* theme);
 
   void parseURL(std::string* old_url, std::string* new_url, int widget_id);
-
+  void setWidgetInfo(int widgetHandle);
   void messageReceived(const tizen_webview::WrtIpcMessageData& data);
 
   ~DynamicPlugin();
@@ -50,6 +51,7 @@ class DynamicPlugin {
   void* m_handle;
   startSessionFun m_startSession;
   parseUrlFun m_parseURL;
+  setWidgetInfoFun m_setWidgetInfo;
   databaseAttachFun m_databaseAttach;
   onIPCMessageFun m_onIPCMessage;
 };
index 883d14a..ca3d385 100644 (file)
@@ -19,6 +19,7 @@ void WrtWidget::SetWidgetInfo(int widgetHandle,
   scale_ = scaleFactor;
   theme_ = theme;
   encodedBundle_ = encodedBundle;
+  DynamicPlugin::instance().setWidgetInfo(widgetHandle_);
 }
 
 void WrtWidget::ParseUrl(const GURL& url, GURL& new_url) {