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) {
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)
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());
// 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_;
Browser::Browser()
: is_quiting_(false),
#if defined(OS_TIZEN)
+ locale_manager_(new common::LocaleManager()),
launched_(false),
is_electron_launch_(false),
#endif
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());
#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"
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();
#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);
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_;
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
#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"
void AtomRenderViewObserver::DidCreateDocumentElement(
blink::WebLocalFrame* frame) {
document_created_ = true;
- SetContentSecurityPolicy(frame);
}
void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
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()
}
}
-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
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.
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
'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