Fix invalid licenses
[platform/framework/web/crosswalk-tizen.git] / src / runtime / web_view.cc
index 26ed655..d76ef14 100755 (executable)
@@ -1,56 +1,81 @@
-// Copyright 2015 Samsung Electronics Co, Ltd. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
 
-#include "web_view.h"
 
-#include "native_window.h"
+#include "runtime/web_view.h"
+
+#include <ewk_chromium.h>
+#include <functional>
+#include <sstream>
+
+#include "runtime/native_window.h"
+#include "runtime/web_view_impl.h"
 
-using namespace std;
 namespace wrt {
 
-WebView::WebView(NativeWindow * window,Ewk_Context * context): window_(window), context_(context), always_run_(false) {
+WebView::WebView(wrt::NativeWindow* window, Ewk_Context* context)
+    : impl_(new WebViewImpl(this, window, context)) {
+}
+
+WebView::~WebView() {
+  delete impl_;
 }
 
 void WebView::LoadUrl(const std::string& url) {
-  //TODO. To be implemented
+  impl_->LoadUrl(url);
+}
+
+std::string WebView::GetUrl() {
+  return impl_->GetUrl();
 }
 
 void WebView::Suspend() {
-  if (!always_run_) {
-    //suspend webview
-  }
-  // change the visibility
+  impl_->Suspend();
 }
 
 void WebView::Resume() {
-  if (!always_run_) {
-    // resume webview
-  }
-  // change the visiblity
+  impl_->Resume();
 }
 
 void WebView::Reload() {
+  impl_->Reload();
 }
 
-void WebView::AlwaysRun(bool run) {
-  always_run_ = run;
+void WebView::SetVisibility(bool show) {
+  impl_->SetVisibility(show);
 }
 
 bool WebView::EvalJavascript(const std::string& script) {
-  return false;
+  return impl_->EvalJavascript(script);
 }
 
-void WebView::Initialize() {
+void WebView::SetEventListener(EventListener* listener) {
+  impl_->SetEventListener(listener);
 }
 
-std::string WebView::GetUrl() {
-  return std::string();
+Evas_Object* WebView::evas_object() const {
+  return impl_->evas_object();
 }
 
-Evas_Object* WebView::evas_object() const {
-  //TODO
-  return NULL;
+void WebView::SetAppInfo(const std::string& app_name,
+                         const std::string& version) {
+  impl_->SetAppInfo(app_name, version);
 }
 
-}
\ No newline at end of file
+bool WebView::SetUserAgent(const std::string& user_agent) {
+  return impl_->SetUserAgent(user_agent.c_str());
+}
+}  // namespace wrt