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_APPLICATION_H_
6 #define WRT_RUNTIME_WEB_APPLICATION_H_
13 #include "runtime/web_view.h"
20 class ApplicationData;
22 class ResourceManager;
24 class WebApplication : public WebView::EventListener {
26 WebApplication(NativeWindow* window,
27 std::unique_ptr<ApplicationData> app_data);
28 virtual ~WebApplication();
30 void AppControl(std::unique_ptr<wrt::AppControl> appcontrol);
31 void Launch(std::unique_ptr<wrt::AppControl> appcontrol);
35 std::string data_path() const { return app_data_path_; }
36 void set_terminator(std::function<void(void)> terminator)
37 { terminator_ = terminator; }
38 bool launched() const { return launched_; }
40 virtual void OnCreatedNewWebView(WebView* view, WebView* new_view);
41 virtual void OnClosedWebView(WebView * view);
42 virtual void OnReceivedWrtMessage(WebView* view,
43 Ewk_IPC_Wrt_Message_Data* message);
44 virtual void OnOrientationLock(WebView* view,
46 int preferred_rotation);
47 virtual void OnHardwareKey(WebView* view, const std::string& keyname);
48 virtual void OnConsoleMessage(const std::string& msg, int level);
50 virtual void OnLoadStart(WebView* view);
51 virtual void OnLoadFinished(WebView* view);
52 virtual void OnRendered(WebView* view);
53 virtual void OnLanguageChanged();
54 virtual void OnLowMemory();
55 virtual bool OnContextMenuDisabled(WebView* view);
57 std::string uuid() const { return uuid_; }
62 void ClearViewStack();
63 void SendAppControlEvent();
64 void LaunchInspector(wrt::AppControl* appcontrol);
68 Ewk_Context* ewk_context_;
69 NativeWindow* window_;
71 std::string app_data_path_;
72 std::list<WebView*> view_stack_;
73 std::unique_ptr<LocaleManager> locale_manager_;
74 std::unique_ptr<ApplicationData> app_data_;
75 std::unique_ptr<ResourceManager> resource_manager_;
76 std::unique_ptr<wrt::AppControl> received_appcontrol_;
77 std::function<void(void)> terminator_;
83 #endif // WRT_RUNTIME_WEB_APPLICATION_H_