Update wrt_0.8.85
[platform/framework/web/wrt.git] / src / plugin-service / wrt_plugin_module.cpp
index 556c6cc..cda29b3 100644 (file)
  *    limitations under the License.
  */
 /**
- * @file    plugin_module.cpp
+ * @file    wrt_plugin_module.cpp
  * @author  Lukasz Marek (l.marek@samgsung.com)
+ * @author  Yunchan Cho (yunchan.cho@samgsung.com)
  * @version
  * @brief
  */
 
 #include "wrt_plugin_module.h"
 
-#include <plugin_logic.h>
 #include <dpl/log/log.h>
 #include <dpl/string.h>
 #include <dpl/assert.h>
+#include <plugin_logic.h>
+#include <js_overlay_types.h>
 
 namespace PluginModule {
 
-void start(int widgetHandle, JSGlobalContextRef context, double scale, const char *encodedBundle)
+void start(int widgetHandle,
+           JSGlobalContextRef context,
+           double scale,
+           const char *encodedBundle,
+           const char *theme)
 {
     LogDebug("starting plugins module with");
     LogDebug("handle:  " << widgetHandle);
     LogDebug("context: " << context);
     LogDebug("scale:   " << scale);
     LogDebug("Bundle:  " << encodedBundle);
+    LogDebug("theme:  " << theme);
 
-    PluginLogicSingleton::Instance().startSession(widgetHandle, context, scale, encodedBundle);
+    PluginLogicSingleton::Instance().startSession(widgetHandle,
+                                                  context,
+                                                  scale,
+                                                  encodedBundle,
+                                                  theme);
 }
 
 void shutdown()
@@ -46,16 +57,42 @@ void shutdown()
     PluginLogicSingleton::Instance().performLibrariesUnload();
 }
 
-void stop()
+void stop(JSGlobalContextRef context)
 {
     LogDebug("stopping plugins module");
-    PluginLogicSingleton::Instance().stopSession();
+    PluginLogicSingleton::Instance().stopSession(context);
+}
+
+void setCustomProperties(JSGlobalContextRef context,
+                         double scale,
+                         const char* encodedBundle,
+                         const char* theme)
+{
+    LogDebug("reset custom properties of window object");
+    PluginLogicSingleton::Instance().setCustomProperties(context,
+                                                         scale,
+                                                         encodedBundle,
+                                                         theme);
 }
 
-void loadPluginsIntoIFrame()
+void dispatchJavaScriptEvent(JSGlobalContextRef context,
+                             WrtPlugins::W3C::CustomEventType eventType)
 {
-    LogDebug("loaing plugins into IFrame");
-    PluginLogicSingleton::Instance().loadPluginsIntoIframes();
+    LogDebug("dispatching javascript event");
+    PluginLogicSingleton::Instance().dispatchJavaScriptEvent(context,
+                                                             eventType);
 }
 
+void loadFrame(JSGlobalContextRef context)
+{
+    LogDebug("load frame into web page (context:" << context << ")");
+    PluginLogicSingleton::Instance().loadFrame(context);
 }
+
+void unloadFrame(JSGlobalContextRef context)
+{
+    LogDebug("unload frame from web page (context:" << context << ")");
+    PluginLogicSingleton::Instance().unloadFrame(context);
+}
+
+} // PluginModule