NativeWindow : Rotation Support
[platform/framework/web/crosswalk-tizen.git] / src / runtime / web_view.cc
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.
4
5 #include "runtime/web_view.h"
6
7 #include <functional>
8
9 #include "runtime/native_window.h"
10
11 namespace wrt {
12
13 WebView::WebView(NativeWindow* window, Ewk_Context* context)
14     : window_(window),
15       context_(context),
16       always_run_(false) {
17   rotation_handler_id_ = window->AddRotationHandler(
18                                     std::bind(&WebView::OnRotation,
19                                     this,
20                                     std::placeholders::_1));
21 }
22
23 WebView::~WebView() {
24   window_->RemoveRotationHandler(rotation_handler_id_);
25 }
26
27 void WebView::LoadUrl(const std::string& url) {
28   // TODO(sngn.lee): To be implemented
29 }
30
31 void WebView::Suspend() {
32   if (!always_run_) {
33     // suspend webview
34   }
35   // change the visibility
36 }
37
38 void WebView::Resume() {
39   if (!always_run_) {
40     // resume webview
41   }
42   // change the visiblity
43 }
44
45 void WebView::Reload() {
46 }
47
48 void WebView::AlwaysRun(bool run) {
49   always_run_ = run;
50 }
51
52 bool WebView::EvalJavascript(const std::string& script) {
53   return false;
54 }
55
56 void WebView::Initialize() {
57 }
58
59 std::string WebView::GetUrl() {
60   return std::string();
61 }
62
63 Evas_Object* WebView::evas_object() const {
64   // TODO(sngn.lee): To be implemented
65   return NULL;
66 }
67
68 void WebView::OnRotation(int degree) {
69   // TOOD(sngn.lee): To be impelmented
70 }
71
72 }  // namespace wrt
73