2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-04-12 01:46:58 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/atom_browser_client.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2015-08-04 09:13:05 +00:00
|
|
|
#if defined(OS_WIN)
|
|
|
|
#include <shlobj.h>
|
|
|
|
#endif
|
|
|
|
|
2018-09-13 00:25:56 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <utility>
|
|
|
|
|
2016-03-31 14:21:18 +00:00
|
|
|
#include "atom/browser/api/atom_api_app.h"
|
2016-08-24 14:52:35 +00:00
|
|
|
#include "atom/browser/api/atom_api_protocol.h"
|
2018-03-20 04:54:47 +00:00
|
|
|
#include "atom/browser/api/atom_api_web_contents.h"
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/atom_browser_context.h"
|
|
|
|
#include "atom/browser/atom_browser_main_parts.h"
|
2018-09-15 15:42:43 +00:00
|
|
|
#include "atom/browser/atom_navigation_throttle.h"
|
2015-05-12 12:22:30 +00:00
|
|
|
#include "atom/browser/atom_quota_permission_context.h"
|
2015-09-30 02:56:42 +00:00
|
|
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
2014-10-08 03:55:14 +00:00
|
|
|
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
2017-04-06 03:15:27 +00:00
|
|
|
#include "atom/browser/child_web_contents_tracker.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "atom/browser/io_thread.h"
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/native_window.h"
|
2017-12-05 06:59:15 +00:00
|
|
|
#include "atom/browser/session_preferences.h"
|
2016-01-23 13:29:47 +00:00
|
|
|
#include "atom/browser/web_contents_permission_helper.h"
|
2015-09-04 17:12:32 +00:00
|
|
|
#include "atom/browser/web_contents_preferences.h"
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/window_list.h"
|
2018-03-14 07:55:59 +00:00
|
|
|
#include "atom/common/google_api_key.h"
|
2014-10-25 12:52:42 +00:00
|
|
|
#include "atom/common/options_switches.h"
|
2018-07-21 15:05:21 +00:00
|
|
|
#include "atom/common/platform_util.h"
|
2014-10-24 10:44:15 +00:00
|
|
|
#include "base/command_line.h"
|
2018-03-16 02:05:51 +00:00
|
|
|
#include "base/environment.h"
|
2015-06-10 11:34:30 +00:00
|
|
|
#include "base/files/file_util.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "base/json/json_reader.h"
|
2018-09-13 00:25:56 +00:00
|
|
|
#include "base/no_destructor.h"
|
2015-08-11 07:39:17 +00:00
|
|
|
#include "base/stl_util.h"
|
2015-06-26 02:48:36 +00:00
|
|
|
#include "base/strings/string_number_conversions.h"
|
2016-08-24 00:16:54 +00:00
|
|
|
#include "base/strings/string_util.h"
|
2018-07-31 21:38:37 +00:00
|
|
|
#include "base/strings/utf_string_conversions.h"
|
2014-08-22 07:03:39 +00:00
|
|
|
#include "chrome/browser/printing/printing_message_filter.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "components/net_log/chrome_net_log.h"
|
2015-04-28 15:45:58 +00:00
|
|
|
#include "content/public/browser/browser_ppapi_host.h"
|
2015-06-03 20:57:06 +00:00
|
|
|
#include "content/public/browser/client_certificate_delegate.h"
|
2018-03-06 06:24:54 +00:00
|
|
|
#include "content/public/browser/render_frame_host.h"
|
2014-01-30 13:57:01 +00:00
|
|
|
#include "content/public/browser/render_process_host.h"
|
2014-03-06 03:07:04 +00:00
|
|
|
#include "content/public/browser/render_view_host.h"
|
2015-09-29 12:17:26 +00:00
|
|
|
#include "content/public/browser/resource_dispatcher_host.h"
|
2014-01-31 02:30:16 +00:00
|
|
|
#include "content/public/browser/site_instance.h"
|
2014-01-30 13:57:01 +00:00
|
|
|
#include "content/public/browser/web_contents.h"
|
2018-01-22 22:49:30 +00:00
|
|
|
#include "content/public/common/content_paths.h"
|
2017-07-07 22:14:25 +00:00
|
|
|
#include "content/public/common/content_switches.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "content/public/common/service_names.mojom.h"
|
2016-09-29 17:20:53 +00:00
|
|
|
#include "content/public/common/url_constants.h"
|
2014-10-11 11:11:34 +00:00
|
|
|
#include "content/public/common/web_preferences.h"
|
2018-10-01 20:00:53 +00:00
|
|
|
#include "electron/buildflags/buildflags.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "electron/grit/electron_resources.h"
|
2018-07-21 15:05:21 +00:00
|
|
|
#include "net/base/escape.h"
|
2015-06-03 20:57:06 +00:00
|
|
|
#include "net/ssl/ssl_cert_request_info.h"
|
2015-04-28 15:45:58 +00:00
|
|
|
#include "ppapi/host/ppapi_host.h"
|
2018-10-02 22:01:24 +00:00
|
|
|
#include "services/device/public/cpp/geolocation/location_provider.h"
|
2018-04-11 08:42:14 +00:00
|
|
|
#include "services/network/public/cpp/resource_request_body.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
2014-05-29 07:21:15 +00:00
|
|
|
#include "ui/base/l10n/l10n_util.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
2015-09-04 17:33:13 +00:00
|
|
|
#include "v8/include/v8.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2018-04-12 08:48:50 +00:00
|
|
|
#if defined(USE_NSS_CERTS)
|
|
|
|
#include "net/ssl/client_cert_store_nss.h"
|
|
|
|
#elif defined(OS_WIN)
|
|
|
|
#include "net/ssl/client_cert_store_win.h"
|
|
|
|
#elif defined(OS_MACOSX)
|
|
|
|
#include "net/ssl/client_cert_store_mac.h"
|
|
|
|
#elif defined(USE_OPENSSL)
|
|
|
|
#include "net/ssl/client_cert_store.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
2018-06-20 00:44:24 +00:00
|
|
|
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
2018-10-01 20:00:53 +00:00
|
|
|
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
|
2018-06-20 00:44:24 +00:00
|
|
|
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2018-08-23 15:51:46 +00:00
|
|
|
#include "atom/browser/fake_location_provider.h"
|
2018-10-01 20:00:53 +00:00
|
|
|
#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2018-08-23 15:51:46 +00:00
|
|
|
|
2018-10-11 13:52:12 +00:00
|
|
|
#if BUILDFLAG(ENABLE_TTS)
|
|
|
|
#include "chrome/browser/speech/tts_message_filter.h"
|
|
|
|
#endif // BUILDFLAG(ENABLE_TTS)
|
|
|
|
|
2018-03-14 07:55:59 +00:00
|
|
|
using content::BrowserThread;
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
namespace atom {
|
|
|
|
|
2014-01-31 02:30:16 +00:00
|
|
|
namespace {
|
|
|
|
|
2015-05-11 06:40:40 +00:00
|
|
|
// Next navigation should not restart renderer process.
|
|
|
|
bool g_suppress_renderer_process_restart = false;
|
|
|
|
|
2015-12-08 19:21:46 +00:00
|
|
|
// Custom schemes to be registered to handle service worker.
|
2018-09-13 00:25:56 +00:00
|
|
|
base::NoDestructor<std::string> g_custom_service_worker_schemes;
|
2015-06-12 07:58:23 +00:00
|
|
|
|
2018-04-06 07:22:52 +00:00
|
|
|
bool IsSameWebSite(content::BrowserContext* browser_context,
|
|
|
|
const GURL& src_url,
|
|
|
|
const GURL& dest_url) {
|
|
|
|
return content::SiteInstance::IsSameWebSite(browser_context, src_url,
|
|
|
|
dest_url) ||
|
|
|
|
// `IsSameWebSite` doesn't seem to work for some URIs such as `file:`,
|
|
|
|
// handle these scenarios by comparing only the site as defined by
|
|
|
|
// `GetSiteForURL`.
|
|
|
|
content::SiteInstance::GetSiteForURL(browser_context, dest_url) ==
|
|
|
|
src_url;
|
2016-05-23 03:57:46 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 02:30:16 +00:00
|
|
|
} // namespace
|
|
|
|
|
2015-05-11 06:40:40 +00:00
|
|
|
// static
|
|
|
|
void AtomBrowserClient::SuppressRendererProcessRestartForOnce() {
|
|
|
|
g_suppress_renderer_process_restart = true;
|
|
|
|
}
|
|
|
|
|
2015-12-08 19:21:46 +00:00
|
|
|
void AtomBrowserClient::SetCustomServiceWorkerSchemes(
|
|
|
|
const std::vector<std::string>& schemes) {
|
2018-09-13 00:25:56 +00:00
|
|
|
*g_custom_service_worker_schemes = base::JoinString(schemes, ",");
|
2015-12-08 19:21:46 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 22:18:38 +00:00
|
|
|
AtomBrowserClient::AtomBrowserClient() {}
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
AtomBrowserClient::~AtomBrowserClient() {}
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2016-05-27 00:20:46 +00:00
|
|
|
content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID(
|
|
|
|
int process_id) {
|
2017-07-10 22:48:12 +00:00
|
|
|
// If the process is a pending process, we should use the web contents
|
|
|
|
// for the frame host passed into OverrideSiteInstanceForNavigation.
|
2016-11-30 07:30:03 +00:00
|
|
|
if (base::ContainsKey(pending_processes_, process_id))
|
2017-07-10 22:48:12 +00:00
|
|
|
return pending_processes_[process_id];
|
2016-05-27 00:20:46 +00:00
|
|
|
|
|
|
|
// Certain render process will be created with no associated render view,
|
|
|
|
// for example: ServiceWorker.
|
|
|
|
return WebContentsPreferences::GetWebContentsFromProcessID(process_id);
|
|
|
|
}
|
|
|
|
|
2016-08-15 10:59:08 +00:00
|
|
|
bool AtomBrowserClient::ShouldCreateNewSiteInstance(
|
2017-04-05 04:47:02 +00:00
|
|
|
content::RenderFrameHost* render_frame_host,
|
2016-08-15 10:59:08 +00:00
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
content::SiteInstance* current_instance,
|
|
|
|
const GURL& url) {
|
|
|
|
if (url.SchemeIs(url::kJavaScriptScheme))
|
|
|
|
// "javacript:" scheme should always use same SiteInstance
|
|
|
|
return false;
|
|
|
|
|
2017-03-19 08:47:26 +00:00
|
|
|
int process_id = current_instance->GetProcess()->GetID();
|
2017-04-05 08:51:17 +00:00
|
|
|
if (!IsRendererSandboxed(process_id)) {
|
2017-08-07 10:50:23 +00:00
|
|
|
if (!RendererUsesNativeWindowOpen(process_id)) {
|
2017-04-05 08:51:17 +00:00
|
|
|
// non-sandboxed renderers without native window.open should always create
|
|
|
|
// a new SiteInstance
|
|
|
|
return true;
|
|
|
|
}
|
2018-04-17 22:41:47 +00:00
|
|
|
auto* web_contents =
|
2017-08-07 10:50:23 +00:00
|
|
|
content::WebContents::FromRenderFrameHost(render_frame_host);
|
2017-04-06 03:15:27 +00:00
|
|
|
if (!ChildWebContentsTracker::IsChildWebContents(web_contents)) {
|
2017-04-12 03:25:56 +00:00
|
|
|
// Root WebContents should always create new process to make sure
|
|
|
|
// native addons are loaded correctly after reload / navigation.
|
|
|
|
// (Non-root WebContents opened by window.open() should try to
|
|
|
|
// reuse process to allow synchronous cross-window scripting.)
|
2017-04-05 08:51:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2016-08-15 10:59:08 +00:00
|
|
|
|
|
|
|
// Create new a SiteInstance if navigating to a different site.
|
|
|
|
auto src_url = current_instance->GetSiteURL();
|
2018-04-06 07:22:52 +00:00
|
|
|
return !IsSameWebSite(browser_context, src_url, url);
|
2016-08-15 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
2017-03-19 09:24:05 +00:00
|
|
|
void AtomBrowserClient::AddProcessPreferences(
|
2018-04-18 01:55:30 +00:00
|
|
|
int process_id,
|
|
|
|
AtomBrowserClient::ProcessPreferences prefs) {
|
2017-03-19 08:25:45 +00:00
|
|
|
process_preferences_[process_id] = prefs;
|
2016-08-15 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
2017-03-19 08:25:45 +00:00
|
|
|
void AtomBrowserClient::RemoveProcessPreferences(int process_id) {
|
|
|
|
process_preferences_.erase(process_id);
|
2016-08-15 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
2018-03-09 07:13:51 +00:00
|
|
|
bool AtomBrowserClient::IsProcessObserved(int process_id) {
|
|
|
|
return process_preferences_.find(process_id) != process_preferences_.end();
|
|
|
|
}
|
|
|
|
|
2016-08-15 10:59:08 +00:00
|
|
|
bool AtomBrowserClient::IsRendererSandboxed(int process_id) {
|
2017-03-19 08:25:45 +00:00
|
|
|
auto it = process_preferences_.find(process_id);
|
|
|
|
return it != process_preferences_.end() && it->second.sandbox;
|
|
|
|
}
|
|
|
|
|
2017-03-19 08:47:26 +00:00
|
|
|
bool AtomBrowserClient::RendererUsesNativeWindowOpen(int process_id) {
|
2017-03-19 08:25:45 +00:00
|
|
|
auto it = process_preferences_.find(process_id);
|
|
|
|
return it != process_preferences_.end() && it->second.native_window_open;
|
2016-08-15 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
2017-05-23 22:59:17 +00:00
|
|
|
bool AtomBrowserClient::RendererDisablesPopups(int process_id) {
|
|
|
|
auto it = process_preferences_.find(process_id);
|
|
|
|
return it != process_preferences_.end() && it->second.disable_popups;
|
|
|
|
}
|
|
|
|
|
2014-08-21 13:19:43 +00:00
|
|
|
void AtomBrowserClient::RenderProcessWillLaunch(
|
2018-04-11 09:26:56 +00:00
|
|
|
content::RenderProcessHost* host,
|
2018-04-12 08:48:50 +00:00
|
|
|
service_manager::mojom::ServiceRequest* service_request) {
|
2018-03-09 07:13:51 +00:00
|
|
|
// When a render process is crashed, it might be reused.
|
2015-06-26 02:48:36 +00:00
|
|
|
int process_id = host->GetID();
|
2018-03-09 07:13:51 +00:00
|
|
|
if (IsProcessObserved(process_id))
|
|
|
|
return;
|
|
|
|
|
2015-06-26 02:48:36 +00:00
|
|
|
host->AddFilter(new printing::PrintingMessageFilter(process_id));
|
2018-10-11 13:52:12 +00:00
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_TTS)
|
|
|
|
host->AddFilter(new TtsMessageFilter(host->GetBrowserContext()));
|
|
|
|
#endif
|
2016-08-15 10:59:08 +00:00
|
|
|
|
2018-03-08 07:36:21 +00:00
|
|
|
ProcessPreferences prefs;
|
2018-04-18 01:55:30 +00:00
|
|
|
auto* web_preferences =
|
|
|
|
WebContentsPreferences::From(GetWebContentsFromProcessID(process_id));
|
2018-03-08 07:36:21 +00:00
|
|
|
if (web_preferences) {
|
2018-05-29 08:09:51 +00:00
|
|
|
prefs.sandbox = web_preferences->IsEnabled(options::kSandbox);
|
|
|
|
prefs.native_window_open =
|
|
|
|
web_preferences->IsEnabled(options::kNativeWindowOpen);
|
2018-03-08 07:36:21 +00:00
|
|
|
prefs.disable_popups = web_preferences->IsEnabled("disablePopups");
|
|
|
|
}
|
|
|
|
AddProcessPreferences(host->GetID(), prefs);
|
2017-03-19 08:25:45 +00:00
|
|
|
// ensure the ProcessPreferences is removed later
|
|
|
|
host->AddObserver(this);
|
2014-08-21 13:19:43 +00:00
|
|
|
}
|
|
|
|
|
2014-10-08 03:55:14 +00:00
|
|
|
content::SpeechRecognitionManagerDelegate*
|
2018-04-18 01:55:30 +00:00
|
|
|
AtomBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
2014-10-08 03:55:14 +00:00
|
|
|
return new AtomSpeechRecognitionManagerDelegate;
|
|
|
|
}
|
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host,
|
|
|
|
content::WebPreferences* prefs) {
|
2013-04-12 12:48:02 +00:00
|
|
|
prefs->javascript_enabled = true;
|
2014-03-04 13:23:18 +00:00
|
|
|
prefs->web_security_enabled = true;
|
2014-10-26 06:05:54 +00:00
|
|
|
prefs->plugins_enabled = true;
|
2013-04-12 12:48:02 +00:00
|
|
|
prefs->dom_paste_enabled = true;
|
|
|
|
prefs->allow_scripts_to_close_windows = true;
|
|
|
|
prefs->javascript_can_access_clipboard = true;
|
|
|
|
prefs->local_storage_enabled = true;
|
|
|
|
prefs->databases_enabled = true;
|
|
|
|
prefs->application_cache_enabled = true;
|
|
|
|
prefs->allow_universal_access_from_file_urls = true;
|
|
|
|
prefs->allow_file_access_from_file_urls = true;
|
2017-12-18 01:47:10 +00:00
|
|
|
prefs->webgl1_enabled = true;
|
|
|
|
prefs->webgl2_enabled = true;
|
2015-01-07 04:53:25 +00:00
|
|
|
prefs->allow_running_insecure_content = false;
|
2018-04-26 15:27:35 +00:00
|
|
|
prefs->default_minimum_page_scale_factor = 1.f;
|
|
|
|
prefs->default_maximum_page_scale_factor = 1.f;
|
2018-04-26 15:23:27 +00:00
|
|
|
prefs->navigate_on_drag_drop = false;
|
2014-03-06 03:07:04 +00:00
|
|
|
|
2014-12-18 02:13:39 +00:00
|
|
|
// Custom preferences of guest page.
|
2018-03-08 08:01:54 +00:00
|
|
|
auto* web_contents = content::WebContents::FromRenderViewHost(host);
|
|
|
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
|
|
|
if (web_preferences)
|
|
|
|
web_preferences->OverrideWebkitPrefs(prefs);
|
2013-04-12 12:48:02 +00:00
|
|
|
}
|
|
|
|
|
2015-04-26 04:28:27 +00:00
|
|
|
void AtomBrowserClient::OverrideSiteInstanceForNavigation(
|
2018-02-13 06:57:54 +00:00
|
|
|
content::RenderFrameHost* rfh,
|
2015-04-26 04:28:27 +00:00
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const GURL& url,
|
2018-04-06 07:22:52 +00:00
|
|
|
bool has_request_started,
|
|
|
|
content::SiteInstance* candidate_instance,
|
2015-04-26 04:28:27 +00:00
|
|
|
content::SiteInstance** new_instance) {
|
2017-04-04 04:48:17 +00:00
|
|
|
if (g_suppress_renderer_process_restart) {
|
|
|
|
g_suppress_renderer_process_restart = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-06 07:22:52 +00:00
|
|
|
content::SiteInstance* current_instance = rfh->GetSiteInstance();
|
2018-02-13 06:57:54 +00:00
|
|
|
if (!ShouldCreateNewSiteInstance(rfh, browser_context, current_instance, url))
|
2015-06-03 05:45:06 +00:00
|
|
|
return;
|
|
|
|
|
2017-12-13 10:57:41 +00:00
|
|
|
// Do we have an affinity site to manage ?
|
2018-02-13 06:57:54 +00:00
|
|
|
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
2018-03-08 07:12:45 +00:00
|
|
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
2018-08-03 21:23:07 +00:00
|
|
|
std::string affinity;
|
2018-02-13 06:57:54 +00:00
|
|
|
if (web_preferences &&
|
2018-08-03 21:23:07 +00:00
|
|
|
web_preferences->GetPreference("affinity", &affinity) &&
|
2018-02-13 06:57:54 +00:00
|
|
|
!affinity.empty()) {
|
2017-12-13 10:57:41 +00:00
|
|
|
affinity = base::ToLowerASCII(affinity);
|
|
|
|
auto iter = site_per_affinities.find(affinity);
|
2018-04-06 07:22:52 +00:00
|
|
|
GURL dest_site = content::SiteInstance::GetSiteForURL(browser_context, url);
|
|
|
|
if (iter != site_per_affinities.end() &&
|
|
|
|
IsSameWebSite(browser_context, iter->second->GetSiteURL(), dest_site)) {
|
|
|
|
*new_instance = iter->second;
|
2017-12-13 10:57:41 +00:00
|
|
|
} else {
|
2018-04-06 07:22:52 +00:00
|
|
|
site_per_affinities[affinity] = candidate_instance;
|
|
|
|
*new_instance = candidate_instance;
|
|
|
|
// Remember the original web contents for the pending renderer process.
|
2018-04-17 22:41:47 +00:00
|
|
|
auto* pending_process = candidate_instance->GetProcess();
|
2018-04-06 07:22:52 +00:00
|
|
|
pending_processes_[pending_process->GetID()] = web_contents;
|
2017-12-13 10:57:41 +00:00
|
|
|
}
|
|
|
|
} else {
|
2018-04-06 07:22:52 +00:00
|
|
|
// OverrideSiteInstanceForNavigation will be called more than once during a
|
|
|
|
// navigation (currently twice, on request and when it's about to commit in
|
|
|
|
// the renderer), look at RenderFrameHostManager::GetFrameHostForNavigation.
|
|
|
|
// In the default mode we should resuse the same site instance until the
|
|
|
|
// request commits otherwise it will get destroyed. Currently there is no
|
|
|
|
// unique lifetime tracker for a navigation request during site instance
|
|
|
|
// creation. We check for the state of the request, which should be one of
|
|
|
|
// (WAITING_FOR_RENDERER_RESPONSE, STARTED, RESPONSE_STARTED, FAILED) along
|
|
|
|
// with the availability of a speculative render frame host.
|
|
|
|
if (has_request_started) {
|
|
|
|
*new_instance = current_instance;
|
|
|
|
return;
|
|
|
|
}
|
2017-12-13 10:57:41 +00:00
|
|
|
|
2018-04-06 07:22:52 +00:00
|
|
|
*new_instance = candidate_instance;
|
2017-12-13 10:57:41 +00:00
|
|
|
// Remember the original web contents for the pending renderer process.
|
2018-04-17 22:41:47 +00:00
|
|
|
auto* pending_process = candidate_instance->GetProcess();
|
2017-12-13 10:57:41 +00:00
|
|
|
pending_processes_[pending_process->GetID()] = web_contents;
|
|
|
|
}
|
|
|
|
}
|
2016-05-23 03:57:46 +00:00
|
|
|
|
2014-01-30 13:57:01 +00:00
|
|
|
void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
2014-06-28 14:33:00 +00:00
|
|
|
base::CommandLine* command_line,
|
2015-06-03 05:45:06 +00:00
|
|
|
int process_id) {
|
2018-01-22 22:49:30 +00:00
|
|
|
// Make sure we're about to launch a known executable
|
2018-01-23 15:25:01 +00:00
|
|
|
{
|
|
|
|
base::FilePath child_path;
|
2018-09-15 00:09:42 +00:00
|
|
|
base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
|
2018-01-23 15:25:01 +00:00
|
|
|
|
|
|
|
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
|
|
|
CHECK(base::MakeAbsoluteFilePath(command_line->GetProgram()) == child_path);
|
|
|
|
}
|
2018-01-22 22:49:30 +00:00
|
|
|
|
2017-07-07 22:14:25 +00:00
|
|
|
std::string process_type =
|
|
|
|
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
|
|
|
if (process_type != ::switches::kRendererProcess)
|
2015-04-26 09:26:25 +00:00
|
|
|
return;
|
|
|
|
|
2016-06-08 06:46:50 +00:00
|
|
|
// Copy following switches to child process.
|
2018-04-18 01:55:30 +00:00
|
|
|
static const char* const kCommonSwitchNames[] = {switches::kStandardSchemes,
|
|
|
|
switches::kEnableSandbox,
|
|
|
|
switches::kSecureSchemes};
|
|
|
|
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
|
|
|
kCommonSwitchNames,
|
|
|
|
arraysize(kCommonSwitchNames));
|
2016-06-08 06:46:50 +00:00
|
|
|
|
2015-12-08 19:21:46 +00:00
|
|
|
// The registered service worker schemes.
|
2018-09-13 00:25:56 +00:00
|
|
|
if (!g_custom_service_worker_schemes->empty())
|
2015-12-08 19:21:46 +00:00
|
|
|
command_line->AppendSwitchASCII(switches::kRegisterServiceWorkerSchemes,
|
2018-09-13 00:25:56 +00:00
|
|
|
*g_custom_service_worker_schemes);
|
2015-12-08 19:21:46 +00:00
|
|
|
|
2015-08-04 09:13:05 +00:00
|
|
|
#if defined(OS_WIN)
|
|
|
|
// Append --app-user-model-id.
|
|
|
|
PWSTR current_app_id;
|
|
|
|
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(¤t_app_id))) {
|
|
|
|
command_line->AppendSwitchNative(switches::kAppUserModelId, current_app_id);
|
|
|
|
CoTaskMemFree(current_app_id);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-04-04 00:36:01 +00:00
|
|
|
if (delegate_) {
|
|
|
|
auto app_path = static_cast<api::App*>(delegate_)->GetAppPath();
|
2017-04-13 01:59:12 +00:00
|
|
|
command_line->AppendSwitchPath(switches::kAppPath, app_path);
|
2017-04-04 00:36:01 +00:00
|
|
|
}
|
|
|
|
|
2016-05-27 00:20:46 +00:00
|
|
|
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
|
2017-12-05 06:59:15 +00:00
|
|
|
if (web_contents) {
|
2018-03-08 08:01:54 +00:00
|
|
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
|
|
|
if (web_preferences)
|
|
|
|
web_preferences->AppendCommandLineSwitches(command_line);
|
2017-12-05 06:59:15 +00:00
|
|
|
SessionPreferences::AppendExtraCommandLineSwitches(
|
|
|
|
web_contents->GetBrowserContext(), command_line);
|
|
|
|
}
|
2014-01-30 13:57:01 +00:00
|
|
|
}
|
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) {
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
2015-07-02 17:54:43 +00:00
|
|
|
host->GetPpapiHost()->AddHostFactoryFilter(
|
2018-06-20 00:44:24 +00:00
|
|
|
base::WrapUnique(new ChromeBrowserPepperHostFactory(host)));
|
|
|
|
#endif
|
2015-04-28 15:45:58 +00:00
|
|
|
}
|
|
|
|
|
2018-03-14 07:55:59 +00:00
|
|
|
std::string AtomBrowserClient::GetGeolocationApiKey() {
|
|
|
|
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
|
|
|
std::string api_key;
|
|
|
|
if (!env->GetVar("GOOGLE_API_KEY", &api_key))
|
|
|
|
api_key = GOOGLEAPIS_API_KEY;
|
|
|
|
return api_key;
|
|
|
|
}
|
|
|
|
|
2015-05-12 12:22:30 +00:00
|
|
|
content::QuotaPermissionContext*
|
2018-04-18 01:55:30 +00:00
|
|
|
AtomBrowserClient::CreateQuotaPermissionContext() {
|
2015-05-12 12:22:30 +00:00
|
|
|
return new AtomQuotaPermissionContext;
|
|
|
|
}
|
|
|
|
|
2015-11-18 02:39:25 +00:00
|
|
|
void AtomBrowserClient::AllowCertificateError(
|
2016-03-08 14:28:53 +00:00
|
|
|
content::WebContents* web_contents,
|
2015-11-18 02:39:25 +00:00
|
|
|
int cert_error,
|
|
|
|
const net::SSLInfo& ssl_info,
|
|
|
|
const GURL& request_url,
|
|
|
|
content::ResourceType resource_type,
|
|
|
|
bool strict_enforcement,
|
|
|
|
bool expired_previous_decision,
|
2016-11-30 07:30:03 +00:00
|
|
|
const base::Callback<void(content::CertificateRequestResultType)>&
|
|
|
|
callback) {
|
2015-11-18 02:39:25 +00:00
|
|
|
if (delegate_) {
|
|
|
|
delegate_->AllowCertificateError(
|
2018-04-18 01:55:30 +00:00
|
|
|
web_contents, cert_error, ssl_info, request_url, resource_type,
|
|
|
|
strict_enforcement, expired_previous_decision, callback);
|
2015-11-18 02:39:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-03 20:57:06 +00:00
|
|
|
void AtomBrowserClient::SelectClientCertificate(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
net::SSLCertRequestInfo* cert_request_info,
|
2017-08-20 21:35:04 +00:00
|
|
|
net::ClientCertIdentityList client_certs,
|
2016-05-23 01:59:39 +00:00
|
|
|
std::unique_ptr<content::ClientCertificateDelegate> delegate) {
|
2017-08-04 21:11:01 +00:00
|
|
|
if (!client_certs.empty() && delegate_) {
|
|
|
|
delegate_->SelectClientCertificate(web_contents, cert_request_info,
|
|
|
|
std::move(client_certs),
|
|
|
|
std::move(delegate));
|
2015-11-18 02:07:03 +00:00
|
|
|
}
|
2015-06-03 20:57:06 +00:00
|
|
|
}
|
|
|
|
|
2015-09-29 12:17:26 +00:00
|
|
|
void AtomBrowserClient::ResourceDispatcherHostCreated() {
|
|
|
|
resource_dispatcher_host_delegate_.reset(
|
|
|
|
new AtomResourceDispatcherHostDelegate);
|
|
|
|
content::ResourceDispatcherHost::Get()->SetDelegate(
|
|
|
|
resource_dispatcher_host_delegate_.get());
|
|
|
|
}
|
|
|
|
|
2016-03-31 00:58:23 +00:00
|
|
|
bool AtomBrowserClient::CanCreateWindow(
|
2017-08-04 21:38:06 +00:00
|
|
|
content::RenderFrameHost* opener,
|
2016-03-31 00:58:23 +00:00
|
|
|
const GURL& opener_url,
|
|
|
|
const GURL& opener_top_level_frame_url,
|
|
|
|
const GURL& source_origin,
|
2017-04-04 04:50:44 +00:00
|
|
|
content::mojom::WindowContainerType container_type,
|
2016-03-31 00:58:23 +00:00
|
|
|
const GURL& target_url,
|
|
|
|
const content::Referrer& referrer,
|
2016-11-30 07:30:03 +00:00
|
|
|
const std::string& frame_name,
|
2016-03-31 00:58:23 +00:00
|
|
|
WindowOpenDisposition disposition,
|
2017-04-04 04:50:44 +00:00
|
|
|
const blink::mojom::WindowFeatures& features,
|
2017-01-23 08:44:42 +00:00
|
|
|
const std::vector<std::string>& additional_features,
|
2018-04-11 08:42:14 +00:00
|
|
|
const scoped_refptr<network::ResourceRequestBody>& body,
|
2016-03-31 00:58:23 +00:00
|
|
|
bool user_gesture,
|
|
|
|
bool opener_suppressed,
|
|
|
|
bool* no_javascript_access) {
|
2018-03-14 07:55:59 +00:00
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
2016-03-31 14:21:18 +00:00
|
|
|
|
2017-08-04 21:38:06 +00:00
|
|
|
int opener_render_process_id = opener->GetProcess()->GetID();
|
|
|
|
|
2017-05-23 22:59:17 +00:00
|
|
|
if (IsRendererSandboxed(opener_render_process_id)) {
|
2016-08-15 10:59:08 +00:00
|
|
|
*no_javascript_access = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-23 22:59:17 +00:00
|
|
|
if (RendererUsesNativeWindowOpen(opener_render_process_id)) {
|
|
|
|
if (RendererDisablesPopups(opener_render_process_id)) {
|
|
|
|
// <webview> without allowpopups attribute should return
|
|
|
|
// null from window.open calls
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
*no_javascript_access = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-31 00:58:23 +00:00
|
|
|
if (delegate_) {
|
2017-12-07 04:12:38 +00:00
|
|
|
return delegate_->CanCreateWindow(
|
|
|
|
opener, opener_url, opener_top_level_frame_url, source_origin,
|
|
|
|
container_type, target_url, referrer, frame_name, disposition, features,
|
|
|
|
additional_features, body, user_gesture, opener_suppressed,
|
|
|
|
no_javascript_access);
|
2016-03-31 00:58:23 +00:00
|
|
|
}
|
2016-03-31 14:21:18 +00:00
|
|
|
|
|
|
|
return false;
|
2016-03-31 00:58:23 +00:00
|
|
|
}
|
|
|
|
|
2016-08-24 00:16:54 +00:00
|
|
|
void AtomBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
|
|
|
std::vector<std::string>* additional_schemes) {
|
2016-08-24 14:52:35 +00:00
|
|
|
auto schemes_list = api::GetStandardSchemes();
|
|
|
|
if (!schemes_list.empty())
|
2018-04-18 01:55:30 +00:00
|
|
|
additional_schemes->insert(additional_schemes->end(), schemes_list.begin(),
|
2016-08-24 00:16:54 +00:00
|
|
|
schemes_list.end());
|
2016-09-29 17:20:53 +00:00
|
|
|
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
2016-08-24 00:16:54 +00:00
|
|
|
}
|
|
|
|
|
2018-02-13 06:57:54 +00:00
|
|
|
void AtomBrowserClient::SiteInstanceDeleting(
|
|
|
|
content::SiteInstance* site_instance) {
|
|
|
|
// We are storing weak_ptr, is it fundamental to maintain the map up-to-date
|
|
|
|
// when an instance is destroyed.
|
|
|
|
for (auto iter = site_per_affinities.begin();
|
2018-04-18 01:55:30 +00:00
|
|
|
iter != site_per_affinities.end(); ++iter) {
|
2018-02-13 06:57:54 +00:00
|
|
|
if (iter->second == site_instance) {
|
|
|
|
site_per_affinities.erase(iter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-12 08:48:50 +00:00
|
|
|
std::unique_ptr<net::ClientCertStore> AtomBrowserClient::CreateClientCertStore(
|
|
|
|
content::ResourceContext* resource_context) {
|
|
|
|
#if defined(USE_NSS_CERTS)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreNSS>(
|
|
|
|
net::ClientCertStoreNSS::PasswordDelegateFactory());
|
2018-04-12 08:48:50 +00:00
|
|
|
#elif defined(OS_WIN)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreWin>();
|
2018-04-12 08:48:50 +00:00
|
|
|
#elif defined(OS_MACOSX)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreMac>();
|
2018-04-12 08:48:50 +00:00
|
|
|
#elif defined(USE_OPENSSL)
|
|
|
|
return std::unique_ptr<net::ClientCertStore>();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-08-23 15:51:46 +00:00
|
|
|
std::unique_ptr<device::LocationProvider>
|
|
|
|
AtomBrowserClient::OverrideSystemLocationProvider() {
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2018-08-23 15:51:46 +00:00
|
|
|
return std::make_unique<FakeLocationProvider>();
|
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-10-04 18:08:56 +00:00
|
|
|
network::mojom::NetworkContextPtr AtomBrowserClient::CreateNetworkContext(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
bool /*in_memory*/,
|
|
|
|
const base::FilePath& /*relative_partition_path*/) {
|
|
|
|
if (!browser_context)
|
|
|
|
return nullptr;
|
|
|
|
return static_cast<AtomBrowserContext*>(browser_context)->GetNetworkContext();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AtomBrowserClient::RegisterOutOfProcessServices(
|
|
|
|
OutOfProcessServiceMap* services) {
|
|
|
|
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
2018-10-04 22:56:04 +00:00
|
|
|
base::BindRepeating(&l10n_util::GetStringUTF16,
|
|
|
|
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
2018-10-04 18:08:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<base::Value> AtomBrowserClient::GetServiceManifestOverlay(
|
|
|
|
base::StringPiece name) {
|
|
|
|
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
|
|
|
int id = -1;
|
|
|
|
if (name == content::mojom::kBrowserServiceName)
|
|
|
|
id = IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY;
|
|
|
|
else if (name == content::mojom::kPackagedServicesServiceName)
|
|
|
|
id = IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY;
|
|
|
|
|
|
|
|
if (id == -1)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
base::StringPiece manifest_contents = rb.GetRawDataResource(id);
|
|
|
|
return base::JSONReader::Read(manifest_contents);
|
|
|
|
}
|
|
|
|
|
|
|
|
net::NetLog* AtomBrowserClient::GetNetLog() {
|
|
|
|
return AtomBrowserMainParts::Get()->net_log();
|
|
|
|
}
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
|
2018-10-04 18:08:56 +00:00
|
|
|
const content::MainFunctionParams& params) {
|
|
|
|
return new AtomBrowserMainParts(params);
|
2013-04-12 01:46:58 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 16:37:15 +00:00
|
|
|
void AtomBrowserClient::WebNotificationAllowed(
|
|
|
|
int render_process_id,
|
2016-07-02 07:54:12 +00:00
|
|
|
const base::Callback<void(bool, bool)>& callback) {
|
2016-03-13 22:23:39 +00:00
|
|
|
content::WebContents* web_contents =
|
|
|
|
WebContentsPreferences::GetWebContentsFromProcessID(render_process_id);
|
2016-01-23 13:29:47 +00:00
|
|
|
if (!web_contents) {
|
2016-07-02 07:54:12 +00:00
|
|
|
callback.Run(false, false);
|
2016-01-23 13:29:47 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-04-17 22:41:47 +00:00
|
|
|
auto* permission_helper =
|
2016-01-23 13:29:47 +00:00
|
|
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
|
|
|
if (!permission_helper) {
|
2016-07-02 07:54:12 +00:00
|
|
|
callback.Run(false, false);
|
2016-01-23 13:29:47 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-07-02 07:54:12 +00:00
|
|
|
permission_helper->RequestWebNotificationPermission(
|
|
|
|
base::Bind(callback, web_contents->IsAudioMuted()));
|
2016-01-23 13:29:47 +00:00
|
|
|
}
|
|
|
|
|
2015-08-11 07:39:17 +00:00
|
|
|
void AtomBrowserClient::RenderProcessHostDestroyed(
|
|
|
|
content::RenderProcessHost* host) {
|
|
|
|
int process_id = host->GetID();
|
2017-07-10 22:48:12 +00:00
|
|
|
pending_processes_.erase(process_id);
|
2017-03-19 08:25:45 +00:00
|
|
|
RemoveProcessPreferences(process_id);
|
2017-05-16 00:41:45 +00:00
|
|
|
}
|
|
|
|
|
2017-05-26 14:51:17 +00:00
|
|
|
void AtomBrowserClient::RenderProcessReady(content::RenderProcessHost* host) {
|
2018-09-15 00:13:02 +00:00
|
|
|
render_process_host_pids_[host->GetID()] =
|
|
|
|
base::GetProcId(host->GetProcess().Handle());
|
2017-05-16 00:41:45 +00:00
|
|
|
if (delegate_) {
|
|
|
|
static_cast<api::App*>(delegate_)->RenderProcessReady(host);
|
|
|
|
}
|
2015-08-11 07:39:17 +00:00
|
|
|
}
|
|
|
|
|
2018-09-15 00:11:49 +00:00
|
|
|
void AtomBrowserClient::RenderProcessExited(
|
|
|
|
content::RenderProcessHost* host,
|
|
|
|
const content::ChildProcessTerminationInfo& info) {
|
2017-05-26 15:32:08 +00:00
|
|
|
auto host_pid = render_process_host_pids_.find(host->GetID());
|
|
|
|
if (host_pid != render_process_host_pids_.end()) {
|
|
|
|
if (delegate_) {
|
|
|
|
static_cast<api::App*>(delegate_)->RenderProcessDisconnected(
|
|
|
|
host_pid->second);
|
|
|
|
}
|
|
|
|
render_process_host_pids_.erase(host_pid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-21 15:05:21 +00:00
|
|
|
void OnOpenExternal(const GURL& escaped_url, bool allowed) {
|
|
|
|
if (allowed)
|
|
|
|
platform_util::OpenExternal(
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
base::UTF8ToUTF16(escaped_url.spec()),
|
|
|
|
#else
|
|
|
|
escaped_url,
|
|
|
|
#endif
|
2018-10-10 20:46:54 +00:00
|
|
|
platform_util::OpenExternalOptions());
|
2018-07-21 15:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void HandleExternalProtocolInUI(
|
|
|
|
const GURL& url,
|
|
|
|
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
|
|
|
|
bool has_user_gesture) {
|
|
|
|
content::WebContents* web_contents = web_contents_getter.Run();
|
|
|
|
if (!web_contents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto* permission_helper =
|
|
|
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
|
|
|
if (!permission_helper)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
|
|
|
|
auto callback = base::Bind(&OnOpenExternal, escaped_url);
|
|
|
|
permission_helper->RequestOpenExternalPermission(callback, has_user_gesture,
|
|
|
|
url);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AtomBrowserClient::HandleExternalProtocol(
|
|
|
|
const GURL& url,
|
|
|
|
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
|
|
|
int child_id,
|
|
|
|
content::NavigationUIData* navigation_data,
|
|
|
|
bool is_main_frame,
|
|
|
|
ui::PageTransition page_transition,
|
|
|
|
bool has_user_gesture) {
|
|
|
|
BrowserThread::PostTask(
|
|
|
|
BrowserThread::UI, FROM_HERE,
|
|
|
|
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
|
|
|
|
has_user_gesture));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-09-15 15:42:43 +00:00
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
|
|
|
AtomBrowserClient::CreateThrottlesForNavigation(
|
|
|
|
content::NavigationHandle* handle) {
|
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
|
|
|
|
throttles.push_back(std::make_unique<AtomNavigationThrottle>(handle));
|
|
|
|
return throttles;
|
|
|
|
}
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
} // namespace atom
|