Revert "Implementation of Appcontrol functionalities" 80/183280/1
authorjaekuk lee <juku1999@samsung.com>
Wed, 4 Jul 2018 05:20:02 +0000 (05:20 +0000)
committerjaekuk lee <juku1999@samsung.com>
Wed, 4 Jul 2018 05:20:02 +0000 (05:20 +0000)
This reverts commit 6e80936f617d1e571ced94751ab6e1008bc4df7c.

Change-Id: Ia90ee9d72cd014c3045a960899ceb723b7320c8a

atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
atom/browser/browser.cc
atom/browser/browser.h
atom/common/api/api_messages.h
atom/renderer/atom_render_view_observer.cc
atom/renderer/atom_render_view_observer.h
tizen/browser/tizen_browser_parts.cc [deleted file]
tizen/browser/tizen_browser_parts.h [deleted file]
wrt.gyp

index 43b1940b647c5dbe7d1e8679ff23e14e9c911948..7e3e1764c36aa58f261610e8c3001640e16e47b0 100644 (file)
@@ -685,7 +685,6 @@ void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
       render_view_host->GetRoutingID());
   if (impl)
     impl->disable_hidden_ = !background_throttling_;
-  atom::Browser::Get()->RenderViewCreated(render_view_host);
 }
 
 void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
@@ -955,7 +954,6 @@ void WebContents::HandleWrtPluginMessage(Ewk_Wrt_Message_Data* msg) {
 bool WebContents::OnMessageReceived(const IPC::Message& message) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(WebContents, message)
-    IPC_MESSAGE_HANDLER_DELAY_REPLY(WrtViewMsg_GetCSP, OnGetContentSecurityPolicy)
     IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
     IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
                                     OnRendererMessageSync)
@@ -1703,14 +1701,6 @@ void WebContents::OnGetZoomLevel(IPC::Message* reply_msg) {
   Send(reply_msg);
 }
 
-void WebContents::OnGetContentSecurityPolicy(IPC::Message* reply_msg) {
-  std::string csp_rule;
-  std::string csp_report_rule;
-  atom::Browser::Get()->GetCSP(csp_rule, csp_report_rule);
-  WrtViewMsg_GetCSP::WriteReplyParams(reply_msg, csp_rule, csp_report_rule);
-  Send(reply_msg);
-}
-
 v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
   WebContentsPreferences* web_preferences =
       WebContentsPreferences::FromWebContents(web_contents());
index 6d5069484235a2c117e2c79e642acb0a8e9cd6f1..ef1578c22bcd35c19dfe8a0183637fcd2760fcb6 100644 (file)
@@ -387,8 +387,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
   // get the zoom level.
   void OnGetZoomLevel(IPC::Message* reply_msg);
 
-  void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
-
   v8::Global<v8::Value> session_;
   v8::Global<v8::Value> devtools_web_contents_;
   v8::Global<v8::Value> debugger_;
index dcfc6bc6bcdbb153e271825a927149dde189baac..aca2f68321fb38d35f2cccc55df76b8da3308d89 100644 (file)
@@ -30,6 +30,7 @@ namespace atom {
 Browser::Browser()
     : is_quiting_(false),
 #if defined(OS_TIZEN)
+      locale_manager_(new common::LocaleManager()),
       launched_(false),
       is_electron_launch_(false),
 #endif
@@ -274,6 +275,12 @@ void Browser::Show() {
     last_window->NotifyResume();
 }
 
+void Browser::Initialize() {
+  auto appdata = common::ApplicationDataManager::GetCurrentAppData();
+  resource_manager_.reset(new common::ResourceManager(appdata, locale_manager_.get()));
+  resource_manager_->set_base_resource_path(appdata->application_path());
+}
+
 void Browser::AppControl(std::unique_ptr<common::AppControl> appcontrol) {
   std::unique_ptr<common::ResourceManager::Resource> res =
       resource_manager_->GetStartResource(appcontrol.get());
index 358bcb982da27a45a4848ddc75aec3475c82ed6e..48365b868ba347544636897877f5ef36c4b84365 100644 (file)
@@ -18,7 +18,6 @@
 #include "native_mate/arguments.h"
 #if defined(OS_TIZEN)
 #include "atom/browser/splash_screen.h"
-#include "tizen/browser/tizen_browser_parts.h"
 #include "tizen/common/app_control.h"
 #include "tizen/common/application_data.h"
 #include "tizen/common/resource_manager.h"
@@ -44,14 +43,14 @@ class AtomMenuModel;
 class LoginHandler;
 
 // This class is used for control application-wide operations.
-class Browser : public WindowListObserver,
-                public tizen::TizenBrowserParts {
+class Browser : public WindowListObserver {
  public:
   Browser();
   ~Browser();
 
   static Browser* Get();
 
+  void Initialize();
   // Try to close all windows and quit the application.
   void Quit();
 
@@ -118,8 +117,8 @@ class Browser : public WindowListObserver,
 #if defined(OS_TIZEN)
   void Hide();
   void Show();
-  void AppControl(std::unique_ptr<common::AppControl> appcontrol) override;
-  void Launch(std::unique_ptr<common::AppControl> appcontrol) override;
+  void AppControl(std::unique_ptr<common::AppControl> appcontrol);
+  void Launch(std::unique_ptr<common::AppControl> appcontrol);
   void SendAppControlEvent();
   void SetSplashScreen();
   void HideSplashScreen(int reason);
@@ -263,6 +262,8 @@ class Browser : public WindowListObserver,
   base::ObserverList<BrowserObserver> observers_;
 
 #if defined(OS_TIZEN)
+  std::unique_ptr<common::ResourceManager> resource_manager_;
+  std::unique_ptr<common::LocaleManager> locale_manager_;
   std::unique_ptr<SplashScreen> splash_screen_;
   std::string start_url_;
   bool launched_;
index 44e8ad61c28a073eeb24d4e83e9975914ef6cc3c..5052c40860e1a1278c5ef6d902b62e3f60a2a850 100644 (file)
@@ -64,11 +64,3 @@ IPC_MESSAGE_ROUTED1(AtomHostMsg_WrtMessage,
 IPC_SYNC_MESSAGE_ROUTED1_1(AtomHostMsg_WrtSyncMessage,
                            Ewk_Wrt_Message_Data /* data */,
                            std::string /*result*/)
-
-// Wrt related messages
-IPC_SYNC_MESSAGE_ROUTED0_2(WrtViewMsg_GetCSP,
-                           std::string,
-                           std::string)
-
-IPC_MESSAGE_ROUTED1(WrtViewMsg_SetLongPolling,
-                    unsigned long)
\ No newline at end of file
index 8923fdfd0f60a9c591f3b552063ed48e9bb45b32..a68238ba4ced1727384fc1a7233fb17c6dbcffac 100644 (file)
@@ -23,7 +23,6 @@
 #include "native_mate/dictionary.h"
 #include "net/base/net_module.h"
 #include "net/grit/net_resources.h"
-#include "third_party/WebKit/public/web/WebContentSecurityPolicy.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebDraggableRegion.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
@@ -117,7 +116,6 @@ void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
 void AtomRenderViewObserver::DidCreateDocumentElement(
     blink::WebLocalFrame* frame) {
   document_created_ = true;
-  SetContentSecurityPolicy(frame);
 }
 
 void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
@@ -138,7 +136,6 @@ bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
     IPC_MESSAGE_HANDLER(AtomViewMsg_Message, OnBrowserMessage)
-    IPC_MESSAGE_HANDLER(WrtViewMsg_SetLongPolling, OnSetLongPolling)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
 
@@ -172,32 +169,4 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
   }
 }
 
-void AtomRenderViewObserver::SetContentSecurityPolicy(blink::WebLocalFrame* frame) {
-  std::string csp_rule;
-  std::string csp_report_rule;
-  Send(new WrtViewMsg_GetCSP(render_view()->GetRoutingID(), &csp_rule, &csp_report_rule));
-
-  if (!csp_rule.empty()) {
-    frame->document().setContentSecurityPolicyUsingHeader(
-      blink::WebString::fromUTF8(csp_rule),
-      blink::WebContentSecurityPolicyType::WebContentSecurityPolicyTypeEnforce);
-  }
-
-  if (!csp_report_rule.empty()) {
-    frame->document().setContentSecurityPolicyUsingHeader(
-      blink::WebString::fromUTF8(csp_report_rule),
-      blink::WebContentSecurityPolicyType::WebContentSecurityPolicyTypeReport);
-  }
-}
-
-void AtomRenderViewObserver::OnSetLongPolling(unsigned long timeout) {
-  if (!document_created_)
-    return;
-
-  blink::WebView* view = render_view()->GetWebView();
-  if (!view)
-    return;
-  view->setLongPollingGlobalTimeout(timeout);
-}
-
 }  // namespace atom
index cd69e2a72c6f963ea1583e3b35476d23653e62fd..e642bbe9422457b5c99b6e9cb0cd4fb18e1f324e 100644 (file)
@@ -40,9 +40,6 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
                         const base::string16& channel,
                         const base::ListValue& args);
 
-  void SetContentSecurityPolicy(blink::WebLocalFrame* frame);
-  void OnSetLongPolling(unsigned long);
-
   AtomRendererClient* renderer_client_;
 
   // Whether the document object has been created.
diff --git a/tizen/browser/tizen_browser_parts.cc b/tizen/browser/tizen_browser_parts.cc
deleted file mode 100644 (file)
index 231a9b3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 "atom/common/api/api_messages.h"
-#include "base/logging.h"
-#include "tizen/browser/tizen_browser_parts.h"
-
-namespace tizen {
-
-namespace {
-
-const char* kDefaultCSPRule =
-  "default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
-
-} // namespace
-
-TizenBrowserParts::TizenBrowserParts()
-    : locale_manager_(new common::LocaleManager()) {
-}
-
-void TizenBrowserParts::Initialize() {
-  app_data_ = common::ApplicationDataManager::GetCurrentAppData();
-  resource_manager_.reset(new common::ResourceManager(app_data_, locale_manager_.get()));
-  resource_manager_->set_base_resource_path(app_data_->application_path());
-
-  if (app_data_->csp_info() != NULL || app_data_->csp_report_info() != NULL ||
-    app_data_->allowed_navigation_info() != NULL) {
-    security_model_version_ = 2;
-    if (app_data_->csp_info() == NULL ||
-        app_data_->csp_info()->security_rules().empty()) {
-      csp_rule_ = kDefaultCSPRule;
-    } else {
-      csp_rule_ = app_data_->csp_info()->security_rules();
-    }
-    if (app_data_->csp_report_info() != NULL &&
-        !app_data_->csp_report_info()->security_rules().empty()) {
-      csp_report_rule_ = app_data_->csp_report_info()->security_rules();
-    }
-  } else {
-    security_model_version_ = 1;
-  }
-}
-
-void TizenBrowserParts::GetCSP(std::string &csp_rule, std::string &csp_report_rule) {
-  csp_rule = csp_rule_;
-  csp_report_rule = csp_report_rule_;
-}
-
-void TizenBrowserParts::SetLongPollingTimeout(content::RenderViewHost* rvh) {
-  if (app_data_->setting_info() != NULL &&
-     app_data_->setting_info()->long_polling()) {
-    boost::optional <unsigned int> polling_val(app_data_->setting_info()->long_polling());
-    unsigned long *ptr =  reinterpret_cast <unsigned long *> (&polling_val.get());
-    rvh->Send(new WrtViewMsg_SetLongPolling(rvh->GetRoutingID(), *ptr));
-  }
-}
-
-void TizenBrowserParts::RenderViewCreated(content::RenderViewHost* render_view_host) {
-  SetLongPollingTimeout(render_view_host);
-}
-
-}
\ No newline at end of file
diff --git a/tizen/browser/tizen_browser_parts.h b/tizen/browser/tizen_browser_parts.h
deleted file mode 100644 (file)
index 4f6d552..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-
-#ifndef TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
-#define TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
-
-#include "content/public/browser/render_view_host.h"
-#include "tizen/common/app_control.h"
-#include "tizen/common/application_data.h"
-#include "tizen/common/resource_manager.h"
-#include "tizen/common/locale_manager.h"
-
-namespace tizen {
-
-class TizenBrowserParts {
- public:
-  TizenBrowserParts();
-  virtual void AppControl(std::unique_ptr<common::AppControl> appcontrol) = 0;
-  virtual void Launch(std::unique_ptr<common::AppControl> appcontrol) = 0;
-  virtual bool launched() const = 0;
-  void RenderViewCreated(content::RenderViewHost* render_view_host);
-  void GetCSP(std::string &csp_rule, std::string &csp_report_rule);
-  void Initialize();
-
- protected:
-  std::unique_ptr<common::LocaleManager> locale_manager_;
-  std::unique_ptr<common::ResourceManager> resource_manager_;
-  virtual ~TizenBrowserParts() {}
-
- private:
-  void SetLongPollingTimeout(content::RenderViewHost* render_view_host);
-
-  common::ApplicationData* app_data_;
-  int security_model_version_;
-  std::string csp_rule_;
-  std::string csp_report_rule_;
-};
-
-} // namespace tizen
-
-#endif  // TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
\ No newline at end of file
diff --git a/wrt.gyp b/wrt.gyp
index 2410d1c270564dadad445d71455e869aa6aac5f2..32f0a97f8a91032fd27ca8f8e0c33a29242a638b 100644 (file)
--- a/wrt.gyp
+++ b/wrt.gyp
         'tizen/src/browser/wrt_ipc.h',
         'tizen/src/browser/wrt_service.cc',
         'tizen/src/browser/wrt_service.h',
-        'tizen/browser/tizen_browser_parts.cc',
-        'tizen/browser/tizen_browser_parts.h',
       ],
       'sources/': [
         # chromium-efl supports only tizen webrtc using CAPI