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 <dpl/log/log.h>
28 #include <dpl/assert.h>
30 #include <widget_model.h>
31 #include <i_runnable_widget_object.h>
32 #include <common/view_logic_apps_support.h>
33 #include <common/view_logic_vibration_support.h>
38 namespace ViewModule {
39 class SecurityOriginSupport;
42 class ViewLogic : public ViewModule::IViewModule
48 void createWebView(Ewk_Context* context,
50 void destroyWebView();
53 void prepareView(WidgetModel* m, const std::string &startUrl);
62 void reloadStartPage();
63 Evas_Object* getCurrentWebview();
64 void fireJavascriptEvent(int event, void* data);
65 void setUserCallbacks(const WRT::UserDelegatesPtr& cbs);
67 // Ewk_Context operations
68 void initializeEwkContext(Ewk_Context* context);
69 void finalizeEwkContext();
72 void initializeSupport();
73 void initializePluginLoading();
76 void ewkClientInit(Evas_Object *wkView);
77 void ewkClientDeinit(Evas_Object *wkView);
80 void prepareEwkView(Evas_Object *wkView);
81 void removeEwkView(Evas_Object *wkView);
82 void resumeEwkView(Evas_Object *wkView);
83 void suspendEwkView(Evas_Object *wkView);
84 void resumeWebkit(Evas_Object *wkView);
85 void suspendWebkit(Evas_Object *wkView);
87 // message from injected bundle Callback
88 static void contextMessageFromInjectedBundleCallback(
94 // EWK Context Callback
95 static void didStartDownloadCallback(
96 const char* downloadUrl,
100 static void loadStartedCallback(
104 static void loadFinishedCallback(
108 static void titleChangedCallback(
112 static void loadProgressCallback(
116 static void loadProgressFinishedCallback(
120 static void processCrashedCallback(
126 static void createWindowCallback(
130 static void closeWindowCallback(
135 // EWK PolicyDecide Callback
136 static void policyNavigationDecideCallback(
140 static void policyNewWindowDecideCallback(
144 static void pageResponseDecideCallback(
149 // EWK ContextMenu Callback
150 static void contextmenuCustomizeCallback(
155 // EWK FormClient Callback
156 static void formSubmitCallback(
161 // EWK Geolocation Callback
162 static void geolocationPermissionRequestCallback(
167 // EWK Notification Callback
168 static void notificationShowCallback(
172 static void notificationCancelCallback(
176 static void notificationPermissionRequestCallback(
181 // EWK Vibration Callback
182 static void vibrationVibrateCallback(
186 static void vibrationCancelCallback(
191 // EWK Orientation Callback
192 static Eina_Bool orientationLockCallback(
198 // EWK Fullscreen API callbacks
199 static void enterFullscreenCallback(
203 static void exitFullscreenCallback(
208 // EWK IME Show/Hide Callback
209 static void imeOpenCallback(
213 static void imeCloseCallback(
218 // JS execute callback
219 static void didRunJavaScriptCallback(
225 static Eina_Bool windowCloseIdlerCallback(void *data);
227 // appcore event callback
228 static int appcoreLowMemoryCallback(void *data);
229 // database usage permission request callback
230 static void databaseUsagePermissionRequestCallback(
234 void databaseUsagePermissionRequest(
236 bool askUserForDatabaseExceedPermission(
237 Ewk_Context_Exceeded_Quota* exceededQuota);
239 // file System Permission Request Callback
240 static void fileSystemPermissionRequestCallback(
244 void fileSystemPermissionRequest(
246 bool askUserForFileSystemPermission(
247 Ewk_Context_File_System_Permission* fileSystemPermission);
250 void didRecieveMessageFromInjectedBundle(
253 void didReceiveSynchronousMessage(
259 void rememberBlockedURI(const DPL::String& str);
260 std::string requestUriChanged(const DPL::String& changedURL);
263 void windowClose(void);
266 Ewk_Context* m_ewkContext;
267 std::list<Evas_Object*> m_ewkViewList;
268 Evas_Object* m_currentEwkView;
269 Evas_Object* m_window;
270 WidgetModel* m_model;
271 std::string m_currentUri;
272 std::string m_blockedUri;
274 std::string m_startUrl;
275 WRT::UserDelegatesPtr m_cbs;
277 std::unique_ptr<SchemeSupport> m_schemeSupport;
278 std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
279 std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
280 std::unique_ptr<ViewModule::SecurityOriginSupport> m_securityOriginSupport;
283 #endif //VIEW_LOGIC_H_