2 * Copyright (c) 2015 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 #ifndef WRT_RUNTIME_WEB_VIEW_H_
19 #define WRT_RUNTIME_WEB_VIEW_H_
21 #include <Elementary.h>
22 #include <ewk_ipc_message.h>
36 virtual void OnLoadStart(WebView* /*view*/) {}
37 virtual void OnLoadProgress(WebView* /*view*/, double /*persent*/ ) {}
38 virtual void OnLoadFinished(WebView* /*view*/) {}
39 virtual void OnRendered(WebView* /*view*/) {}
40 virtual void OnCreatedNewWebView(WebView* /*view*/,
41 WebView* /*new_view*/) {}
42 virtual void OnClosedWebView(WebView* /*view*/) {}
43 virtual void OnCrashed(WebView* /*view*/) {}
44 virtual bool OnDidOpenWindow(
45 WebView* /*view*/, const std::string& /*url*/) { return true; }
46 virtual bool OnDidNavigation(
47 WebView* /*view*/, const std::string& /*url*/) { return true; }
48 virtual void OnHardwareKey(
49 WebView* /*view*/, const std::string& /*keyname*/) {}
50 virtual void OnReceivedWrtMessage(
51 WebView* /*view*/, Ewk_IPC_Wrt_Message_Data* /*msg*/) {}
52 virtual void OnOrientationLock(
55 int /*preferred_rotation*/) {}
56 virtual void OnConsoleMessage(const std::string& /*msg*/, int /*level*/) {}
57 virtual bool OnContextMenuDisabled(WebView* /*view*/) { return false; }
59 virtual void OnNotificationPermissionRequest(
61 const std::string& /*url*/,
62 std::function<void(bool)> /*result_handler*/) {}
63 virtual void OnGeolocationPermissionRequest(
65 const std::string& /*url*/,
66 std::function<void(bool)> /*result_handler*/) {}
67 virtual void OnQuotaExceed(
69 const std::string& /*url*/,
70 std::function<void(bool)> /*result_handler*/) {}
71 virtual void OnAuthenticationRequest(
73 const std::string& /*url*/,
74 const std::string& /*message*/,
75 std::function<void(bool /*submit*/,
76 const std::string& /*id*/,
77 const std::string& /*password*/)
78 > /*result_handler*/) {}
79 virtual void OnCertificateAllowRequest(
81 const std::string& /*url*/,
82 const std::string& /*pem*/,
83 std::function<void(bool allow)> result_handler) {
84 result_handler(false);
88 WebView(wrt::NativeWindow* window, Ewk_Context* context);
91 void LoadUrl(const std::string& url);
97 void SetVisibility(bool show);
98 bool EvalJavascript(const std::string& script);
99 void SetAppInfo(const std::string& app_name, const std::string& version);
100 bool SetUserAgent(const std::string& user_agent);
102 void SetEventListener(EventListener* listener);
103 Evas_Object* evas_object() const;
111 #endif // WRT_RUNTIME_WEB_VIEW_H_