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.
18 * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
19 * @brief Declaration file for view logic for Webkit2
25 #include <i_view_module.h>
27 //#include "view_logic.h"
30 #include <dpl/log/log.h>
31 #include <dpl/assert.h>
33 #include <widget_model.h>
34 #include <i_runnable_widget_object.h>
35 #include <common/view_logic_apps_support.h>
36 #include <common/view_logic_vibration_support.h>
43 class ViewLogic : public ViewModule::IViewModule
46 void createWebView(Ewk_Context* context,
48 void destroyWebView();
51 void prepareView(WidgetModel* m, const std::string &startUrl);
54 void suspendWidget(const OperationStatusStruct &);
55 void resumeWidget(const OperationStatusStruct &);
58 Evas_Object* getCurrentWebview();
59 void setUserCallbacks(WRT::UserCallbacksPtr cbs, void *data);
61 // Ewk_Context operations
62 void initializeEwkContext(Ewk_Context* context);
63 void finalizeEwkContext();
68 void initializeSupport();
69 void initializePluginLoading();
72 void ewkClientInit(Evas_Object *wkView);
73 void ewkClientDeinit(Evas_Object *wkView);
76 void prepareEwkView(Evas_Object *wkView);
77 void removeEwkView(Evas_Object *wkView);
78 void resumeEwkView(Evas_Object *wkView);
79 void suspendEwkView(Evas_Object *wkView);
80 void resumeWebkit(Evas_Object *wkView);
81 void suspendWebkit(Evas_Object *wkView);
83 // message from injected bundle Callback
84 static void contextMessageFromInjectedBundleCallback(
90 // EWK Context Callback
91 static void didStartDownloadCallback(
92 const char* downloadUrl,
95 // WKPageLoaderClient Callback
96 static void didStartProvisionalLoadForFrameCallback(
100 const void *clientInfo);
101 static void didFinishLoadForFrameCallback(
105 const void *clientInfo);
106 static void didReceiveTitleForFrameCallback(
111 const void* clientinfo);
112 static void didStartProgressCallback(
114 const void* clientinfo);
115 static void didChangeProgressCallback(
117 const void* clientinfo);
118 static void didFinishProgressCallback(
120 const void* clientinfo);
123 static void createWindowCallback(
127 static void closeWindowCallback(
132 // WKPagePolicyClient Callback
133 static void pageDecidePolicyForNavigationActionCallback(
136 WKFrameNavigationType navigationType,
137 WKEventModifiers modifiers,
138 WKEventMouseButton mouseButton,
139 WKURLRequestRef request,
140 WKFramePolicyListenerRef listener,
142 const void* clientinfo);
143 static void pageDecidePolicyForResponseCallback(
146 WKURLResponseRef response,
147 WKURLRequestRef request,
148 WKFramePolicyListenerRef listener,
150 const void* clientinfo);
151 static void pageDecidePolicyForNewWindowActionCallback(
154 WKFrameNavigationType navigationType,
155 WKEventModifiers modifiers,
156 WKEventMouseButton mouseButton,
157 WKURLRequestRef request,
158 WKStringRef frameName,
159 WKFramePolicyListenerRef listener,
161 const void* clientInfo);
163 // EWK ContextMenu Callback
164 static void contextmenuCustomizeCallback(
169 // EWK FormClient Callback
170 static void formSubmitCallback(
175 // EWK Geolocation Callback
176 static void geolocationPermissionRequestCallback(
181 // EWK Notification Callback
182 static void notificationShowCallback(
186 static void notificationCancelCallback(
190 static void notificationPermissionRequestCallback(
195 // EWK Vibration Callback
196 static void vibrationVibrateCallback(
200 static void vibrationCancelCallback(
205 // EWK Orientation Callback
206 static Eina_Bool orientationLockCallback(
212 // JS execute callback
213 static void didRunJavaScriptCallback(
219 static void backButtonCallback(void* data,
224 static Eina_Bool windowCloseIdlerCallback(void *data);
226 // process crash callback
227 static void processDidCrashCallback(WKPageRef page,
228 const void* clientInfo);
230 // appcore event callback
231 static int appcoreLowMemoryCallback(void *data);
234 void didRecieveMessageFromInjectedBundle(
237 void didReceiveSynchronousMessage(
243 DPL::Optional<DPL::String> requestWillSend(const DPL::String& str,
245 std::string requestUriChanged(const DPL::String& changedURL);
246 void disconnectNetworkConnectionsFunction();
249 void windowClose(void);
252 Ewk_Context* m_ewkContext;
253 std::list<Evas_Object*> m_ewkViewList;
254 Evas_Object* m_currentEwkView;
255 Evas_Object* m_window;
256 WidgetModel* m_model;
257 std::string m_currentUri;
258 std::string m_blockedUri;
261 std::string m_startUrl;
262 WRT::UserCallbacksPtr m_cbs;
265 std::unique_ptr<SchemeSupport> m_schemeSupport;
266 std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
267 std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
270 #endif //VIEW_LOGIC_H_