From b32a40790959838f4f0605cf61d5735cb186988a Mon Sep 17 00:00:00 2001 From: jaekuk lee Date: Wed, 4 Jul 2018 05:20:02 +0000 Subject: [PATCH] Revert "Implementation of Appcontrol functionalities" This reverts commit 6e80936f617d1e571ced94751ab6e1008bc4df7c. Change-Id: Ia90ee9d72cd014c3045a960899ceb723b7320c8a --- atom/browser/api/atom_api_web_contents.cc | 10 ---- atom/browser/api/atom_api_web_contents.h | 2 - atom/browser/browser.cc | 7 +++ atom/browser/browser.h | 11 +++-- atom/common/api/api_messages.h | 8 ---- atom/renderer/atom_render_view_observer.cc | 31 ------------ atom/renderer/atom_render_view_observer.h | 3 -- tizen/browser/tizen_browser_parts.cc | 75 ------------------------------ tizen/browser/tizen_browser_parts.h | 54 --------------------- wrt.gyp | 2 - 10 files changed, 13 insertions(+), 190 deletions(-) delete mode 100644 tizen/browser/tizen_browser_parts.cc delete mode 100644 tizen/browser/tizen_browser_parts.h diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 43b1940..7e3e176 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -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 WebContents::GetWebPreferences(v8::Isolate* isolate) { WebContentsPreferences* web_preferences = WebContentsPreferences::FromWebContents(web_contents()); diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 6d50694..ef1578c 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -387,8 +387,6 @@ class WebContents : public mate::TrackableObject, // get the zoom level. void OnGetZoomLevel(IPC::Message* reply_msg); - void OnGetContentSecurityPolicy(IPC::Message* reply_msg); - v8::Global session_; v8::Global devtools_web_contents_; v8::Global debugger_; diff --git a/atom/browser/browser.cc b/atom/browser/browser.cc index dcfc6bc..aca2f68 100644 --- a/atom/browser/browser.cc +++ b/atom/browser/browser.cc @@ -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 appcontrol) { std::unique_ptr res = resource_manager_->GetStartResource(appcontrol.get()); diff --git a/atom/browser/browser.h b/atom/browser/browser.h index 358bcb9..48365b8 100644 --- a/atom/browser/browser.h +++ b/atom/browser/browser.h @@ -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 appcontrol) override; - void Launch(std::unique_ptr appcontrol) override; + void AppControl(std::unique_ptr appcontrol); + void Launch(std::unique_ptr appcontrol); void SendAppControlEvent(); void SetSplashScreen(); void HideSplashScreen(int reason); @@ -263,6 +262,8 @@ class Browser : public WindowListObserver, base::ObserverList observers_; #if defined(OS_TIZEN) + std::unique_ptr resource_manager_; + std::unique_ptr locale_manager_; std::unique_ptr splash_screen_; std::string start_url_; bool launched_; diff --git a/atom/common/api/api_messages.h b/atom/common/api/api_messages.h index 44e8ad6..5052c40 100644 --- a/atom/common/api/api_messages.h +++ b/atom/common/api/api_messages.h @@ -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 diff --git a/atom/renderer/atom_render_view_observer.cc b/atom/renderer/atom_render_view_observer.cc index 8923fdf..a68238b 100644 --- a/atom/renderer/atom_render_view_observer.cc +++ b/atom/renderer/atom_render_view_observer.cc @@ -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 diff --git a/atom/renderer/atom_render_view_observer.h b/atom/renderer/atom_render_view_observer.h index cd69e2a..e642bbe 100644 --- a/atom/renderer/atom_render_view_observer.h +++ b/atom/renderer/atom_render_view_observer.h @@ -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 index 231a9b3..0000000 --- a/tizen/browser/tizen_browser_parts.cc +++ /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 polling_val(app_data_->setting_info()->long_polling()); - unsigned long *ptr = reinterpret_cast (&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 index 4f6d552..0000000 --- a/tizen/browser/tizen_browser_parts.h +++ /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 appcontrol) = 0; - virtual void Launch(std::unique_ptr 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 locale_manager_; - std::unique_ptr 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 2410d1c..32f0a97 100644 --- a/wrt.gyp +++ b/wrt.gyp @@ -122,8 +122,6 @@ '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 -- 2.7.4