2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file plugin_module_support.cpp
18 * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
19 * @author Yunchan Cho (yunchan.cho@samsung.com)
20 * @brief Plugin module support for Webkit2 - implementation.
22 #include "plugin_module_support.h"
23 #include "messages_names.h"
27 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
28 #include <js_overlay_types.h>
30 namespace PluginModuleSupport {
32 void start(Ewk_Context* ewkContext,
35 const char *encodedBundle,
39 std::stringstream ssMsg;
43 ssMsg << "_" << scale << " ";
47 ssMsg << "_" << encodedBundle << " ";
51 ssMsg << "null" << " ";
56 ssMsg << "_" << theme << " ";
60 ssMsg << "null" << " ";
65 std::string msgString = ssMsg.str();
67 const char* msg = msgString.c_str();
68 const char* name = BundleMessages::START;
70 ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
73 void shutdown(Ewk_Context* ewkContext)
75 const char* name = BundleMessages::SHUTDOWN;
76 ewk_context_message_post_to_injected_bundle(ewkContext, name, name);
79 void setCustomProperties(
80 Ewk_Context* ewkContext,
82 const char* encodedBundle,
85 std::stringstream ssMsg;
89 ssMsg << "_" << *scale << " ";
93 ssMsg << "null" << " ";
98 ssMsg << "_" << encodedBundle << " ";
102 ssMsg << "null" << " ";
107 ssMsg << "_" << theme;
114 std::string msgString = ssMsg.str();
116 const char* msg = msgString.c_str();
117 const char* name = BundleMessages::SET_CUSTOM_PROPERTIES;
119 ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
122 void dispatchJavaScriptEvent(
123 Ewk_Context* ewkContext,
124 WrtPlugins::W3C::CustomEventType eventType,
127 using namespace WrtPlugins::W3C;
128 std::stringstream str;
131 // if needed, arguments for event should be set here
132 if (eventType == SoftKeyboardChangeCustomEvent) {
134 SoftKeyboardChangeArgs* args =
135 static_cast<SoftKeyboardChangeArgs *>(data);
136 str << " " << args->state;
137 str << " " << args->width;
138 str << " " << args->height;
142 std::string msgString = str.str();
143 const char* msg = msgString.c_str();
144 const char* name = BundleMessages::DISPATCH_JAVASCRIPT_EVENT;
146 ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
149 }//namespace PluginModuleSupport