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 Evas_Object* conformant = NULL,
49 ViewModule::ProgresFinishedCallback cb = NULL);
50 void destroyWebView();
53 void prepareView(WidgetModel* m, const std::string &startUrl);
56 void suspendWidget(const OperationStatusStruct &);
57 void resumeWidget(const OperationStatusStruct &);
60 Evas_Object* getCurrentWebview();
61 void setUserCallbacks(WRT::UserCallbacksPtr cbs, void *data);
63 // Ewk_Context operations
64 void initializeEwkContext(Ewk_Context* context);
65 void finalizeEwkContext();
70 void initializeSupport();
71 void initializePluginLoading();
74 void ewkClientInit(Evas_Object *wkView);
75 void ewkClientDeinit(Evas_Object *wkView);
78 void prepareEwkView(Evas_Object *wkView);
79 void removeEwkView(Evas_Object *wkView);
80 void resumeEwkView(Evas_Object *wkView);
81 void suspendEwkView(Evas_Object *wkView);
82 void resumeWebkit(Evas_Object *wkView);
83 void suspendWebkit(Evas_Object *wkView);
85 // message from injected bundle Callback
86 static void contextMessageFromInjectedBundleCallback(
92 // EWK Context Callback
93 static void didStartDownloadCallback(
94 const char* downloadUrl,
97 // WKPageLoaderClient Callback
98 static void didStartProvisionalLoadForFrameCallback(
102 const void *clientInfo);
103 static void didFinishLoadForFrameCallback(
107 const void *clientInfo);
108 static void didReceiveTitleForFrameCallback(
113 const void* clientinfo);
114 static void didStartProgressCallback(
116 const void* clientinfo);
117 static void didChangeProgressCallback(
119 const void* clientinfo);
120 static void didFinishProgressCallback(
122 const void* clientinfo);
125 static void createWindowCallback(
129 static void closeWindowCallback(
134 // WKPagePolicyClient Callback
135 static void pageDecidePolicyForNavigationActionCallback(
138 WKFrameNavigationType navigationType,
139 WKEventModifiers modifiers,
140 WKEventMouseButton mouseButton,
141 WKURLRequestRef request,
142 WKFramePolicyListenerRef listener,
144 const void* clientinfo);
145 static void pageDecidePolicyForResponseCallback(
148 WKURLResponseRef response,
149 WKURLRequestRef request,
150 WKFramePolicyListenerRef listener,
152 const void* clientinfo);
153 static void pageDecidePolicyForNewWindowActionCallback(
156 WKFrameNavigationType navigationType,
157 WKEventModifiers modifiers,
158 WKEventMouseButton mouseButton,
159 WKURLRequestRef request,
160 WKStringRef frameName,
161 WKFramePolicyListenerRef listener,
163 const void* clientInfo);
165 // EWK ContextMenu Callback
166 static void contextmenuCustomizeCallback(
171 // EWK FormClient Callback
172 static void formSubmitCallback(
177 // EWK Geolocation Callback
178 static void geolocationPermissionRequestCallback(
183 // EWK Notification Callback
184 static void notificationShowCallback(
188 static void notificationCancelCallback(
192 static void notificationPermissionRequestCallback(
197 // EWK Vibration Callback
198 static void vibrationVibrateCallback(
202 static void vibrationCancelCallback(
207 // EWK Orientation Callback
208 static Eina_Bool orientationLockCallback(
214 // JS execute callback
215 static void didRunJavaScriptCallback(
221 static void backButtonCallback(void* data,
226 static Eina_Bool windowCloseIdlerCallback(void *data);
228 // process crash callback
229 static void processDidCrashCallback(WKPageRef page,
230 const void* clientInfo);
232 // appcore event callback
233 static int appcoreLowMemoryCallback(void *data);
236 void didRecieveMessageFromInjectedBundle(
239 void didReceiveSynchronousMessage(
245 DPL::Optional<DPL::String> requestWillSend(const DPL::String& str,
247 std::string requestUriChanged(const DPL::String& changedURL);
248 void disconnectNetworkConnectionsFunction();
251 void windowClose(void);
254 void setLayout(Evas_Object* object);
257 Ewk_Context* m_ewkContext;
258 std::list<Evas_Object*> m_ewkViewList;
259 Evas_Object* m_currentEwkView;
260 Evas_Object* m_window;
261 Evas_Object* m_conformant;
262 WidgetModel* m_model;
263 std::string m_currentUri;
264 std::string m_blockedUri;
267 std::string m_startUrl;
268 WRT::UserCallbacksPtr m_cbs;
271 ViewModule::ProgresFinishedCallback m_finishedCallback;
273 std::unique_ptr<SchemeSupport> m_schemeSupport;
274 std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
275 std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
278 #endif //VIEW_LOGIC_H_