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 <efl_assist.h>
10 #include <ewk_ipc_message.h>
22 virtual void OnLoadStart(WebView* /*view*/) {}
23 virtual void OnLoadProgress(WebView* /*view*/, double /*persent*/ ) {}
24 virtual void OnLoadFinished(WebView* /*view*/) {}
25 virtual void OnRendered(WebView* /*view*/) {}
26 virtual void OnCreatedNewWebView(WebView* /*view*/,
27 WebView* /*new_view*/) {}
28 virtual void OnClosedWebView(WebView* /*view*/) {}
29 virtual void OnCrashed(WebView* /*view*/) {}
30 virtual bool OnDidOpenWindow(
31 WebView* /*view*/, const std::string& /*url*/) { return true; }
32 virtual bool OnDidNavigation(
33 WebView* /*view*/, const std::string& /*url*/) { return true; }
34 virtual void OnHardwareKey(
35 WebView* /*view*/, const std::string& /*keyname*/) {}
36 virtual void OnReceivedWrtMessage(
37 WebView* /*view*/, const Ewk_IPC_Wrt_Message_Data& /*msg*/) {}
38 virtual void OnOrientationLock(
41 int /*preferred_rotation*/) {}
44 WebView(wrt::NativeWindow* window, Ewk_Context* context);
47 void LoadUrl(const std::string& url);
53 void SetVisibility(bool show);
54 bool EvalJavascript(const std::string& script);
56 void SetEventListener(EventListener* listener);
57 Evas_Object* evas_object() const;
60 void OnKeyEvent(Ea_Callback_Type key_type);
61 void OnRotation(int degree);
63 NativeWindow* window_;
64 Ewk_Context* context_;
65 Evas_Object* ewk_view_;
66 EventListener* listener_;
67 int rotation_handler_id_;
72 #endif // WRT_RUNTIME_WEB_VIEW_H_