Handle AppControl in WebApplication
authorSeungkeun Lee <sngn.lee@samsung.com>
Thu, 16 Apr 2015 07:00:46 +0000 (16:00 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Thu, 16 Apr 2015 12:44:03 +0000 (21:44 +0900)
Change-Id: I887106315bf6f265d4e401001e1294f26ff6eed9

src/runtime/app_control.h [changed mode: 0644->0755]
src/runtime/runtime.cc
src/runtime/web_application.cc
src/runtime/web_application.h

old mode 100644 (file)
new mode 100755 (executable)
index 534c3f0..2ac6f84
@@ -16,6 +16,9 @@ class AppControl {
  public:
   explicit AppControl(app_control_h app_control);
   ~AppControl();
+  // disable copy
+  AppControl(const AppControl& src) = delete;
+  AppControl& operator=(const AppControl&) = delete;
 
   std::string operation() const;
   std::string mime() const;
index c620466..c3be665 100755 (executable)
@@ -6,10 +6,12 @@
 
 #include <ewk_chromium.h>
 #include <string>
+#include <memory>
 
 #include "common/logger.h"
 #include "runtime/command_line.h"
 #include "runtime/native_app_window.h"
+#include "runtime/app_control.h"
 
 namespace wrt {
 
@@ -65,11 +67,13 @@ void Runtime::OnResume() {
 }
 
 void Runtime::OnAppControl(app_control_h app_control) {
+  std::unique_ptr<AppControl> appcontrol(new AppControl(app_control));
+
   if (application_->initialized()) {
     // Process AppControl
-    application_->AppControl();
+    application_->AppControl(std::move(appcontrol));
   } else {
-    application_->Launch();
+    application_->Launch(std::move(appcontrol));
   }
 }
 
index 3d01943..9ed87f5 100755 (executable)
@@ -15,6 +15,7 @@
 #include "runtime/web_view.h"
 #include "runtime/vibration_manager.h"
 #include "common/logger.h"
+#include "runtime/app_control.h"
 
 namespace {
   // TODO(sngn.lee) : It should be declare in common header
@@ -110,7 +111,7 @@ bool WebApplication::Initialize(NativeWindow* window) {
   return true;
 }
 
-void WebApplication::Launch() {
+void WebApplication::Launch(std::unique_ptr<wrt::AppControl> appcontrol) {
   initialized_ = true;
   WebView* view = new WebView(window_, ewk_context_);
   view->SetEventListener(this);
@@ -137,7 +138,7 @@ void WebApplication::Launch() {
   window_->Show();
 }
 
-void WebApplication::AppControl() {
+void WebApplication::AppControl(std::unique_ptr<wrt::AppControl> appcontrol) {
   // TODO(sngn.lee): find the app control url and the reset options
 
   // TODO(sngn.lee): Set the injected bundle into extension process
index c4d1950..13371fa 100755 (executable)
@@ -7,6 +7,7 @@
 
 #include <string>
 #include <list>
+#include <memory>
 
 #include "runtime/web_view.h"
 #include "runtime/locale_manager.h"
@@ -16,14 +17,15 @@ class Ewk_Context;
 
 namespace wrt {
 class NativeWindow;
+class AppControl;
 
 class WebApplication : public WebView::EventListener {
  public:
   explicit WebApplication(const std::string& appid);
   virtual ~WebApplication();
 
-  void AppControl();
-  void Launch();
+  void AppControl(std::unique_ptr<wrt::AppControl> appcontrol);
+  void Launch(std::unique_ptr<wrt::AppControl> appcontrol);
   void Resume();
   void Suspend();