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);
78 void createEwkView(Evas* canvas);
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 // file System Permission Request Callback
235 static void fileSystemPermissionRequestCallback(
241 void didRecieveMessageFromInjectedBundle(
244 void didReceiveSynchronousMessage(
250 void rememberBlockedURI(const DPL::String& str);
251 std::string requestUriChanged(const DPL::String& changedURL);
254 void windowClose(void);
256 Ewk_Context* m_ewkContext;
257 std::list<Evas_Object*> m_ewkViewList;
258 Evas_Object* m_currentEwkView;
259 Evas_Object* m_closedEwkView;
260 Evas_Object* m_window;
261 WidgetModel* m_model;
262 std::string m_currentUri;
263 std::string m_blockedUri;
265 std::string m_startUrl;
266 WRT::UserDelegatesPtr m_cbs;
268 std::unique_ptr<SchemeSupport> m_schemeSupport;
269 std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
270 std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
271 std::unique_ptr<ViewModule::SecurityOriginSupport> m_securityOriginSupport;
274 #endif //VIEW_LOGIC_H_