1 // Copyright 2015 Samsung Electronics Co, Ltd. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WRT_RUNTIME_WEB_VIEW_H_
6 #define WRT_RUNTIME_WEB_VIEW_H_
8 #include <Elementary.h>
9 #include <ewk_ipc_message.h>
23 virtual void OnLoadStart(WebView* /*view*/) {}
24 virtual void OnLoadProgress(WebView* /*view*/, double /*persent*/ ) {}
25 virtual void OnLoadFinished(WebView* /*view*/) {}
26 virtual void OnRendered(WebView* /*view*/) {}
27 virtual void OnCreatedNewWebView(WebView* /*view*/,
28 WebView* /*new_view*/) {}
29 virtual void OnClosedWebView(WebView* /*view*/) {}
30 virtual void OnCrashed(WebView* /*view*/) {}
31 virtual bool OnDidOpenWindow(
32 WebView* /*view*/, const std::string& /*url*/) { return true; }
33 virtual bool OnDidNavigation(
34 WebView* /*view*/, const std::string& /*url*/) { return true; }
35 virtual void OnHardwareKey(
36 WebView* /*view*/, const std::string& /*keyname*/) {}
37 virtual void OnReceivedWrtMessage(
38 WebView* /*view*/, Ewk_IPC_Wrt_Message_Data* /*msg*/) {}
39 virtual void OnOrientationLock(
42 int /*preferred_rotation*/) {}
43 virtual void OnConsoleMessage(const std::string& /*msg*/, int /*level*/) {}
44 virtual bool OnContextMenuDisabled(WebView* /*view*/) { return false; }
46 virtual void OnNotificationPermissionRequest(
48 const std::string& /*url*/,
49 std::function<void(bool)> /*result_handler*/) {}
50 virtual void OnGeolocationPermissionRequest(
52 const std::string& /*url*/,
53 std::function<void(bool)> /*result_handler*/) {}
54 virtual void OnQuotaExceed(
56 const std::string& /*url*/,
57 std::function<void(bool)> /*result_handler*/) {}
58 virtual void OnAuthenticationRequest(
60 const std::string& /*url*/,
61 const std::string& /*message*/,
62 std::function<void(bool /*submit*/,
63 const std::string& /*id*/,
64 const std::string& /*password*/)
65 > /*result_handler*/) {}
66 virtual void OnCertificateAllowRequest(
68 const std::string& /*url*/,
69 const std::string& /*pem*/,
70 std::function<void(bool allow)> result_handler) {
71 result_handler(false);
75 WebView(wrt::NativeWindow* window, Ewk_Context* context);
78 void LoadUrl(const std::string& url);
84 void SetVisibility(bool show);
85 bool EvalJavascript(const std::string& script);
86 void SetAppInfo(const std::string& app_name, const std::string& version);
87 bool SetUserAgent(const std::string& user_agent);
89 void SetEventListener(EventListener* listener);
90 Evas_Object* evas_object() const;
98 #endif // WRT_RUNTIME_WEB_VIEW_H_