Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index a607f6a0e6f464780a2666753cb8b2acdc8e732d..42fe082a8c61cf5d2794c04578bd6823930d71c3 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -75,6 +75,7 @@ |
#include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
#include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
#include "chrome/browser/safe_browsing/mojo_safe_browsing_impl.h" |
+#include "chrome/browser/safe_browsing/safe_browsing_browser_throttle.h" |
#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
#include "chrome/browser/search/instant_service.h" |
#include "chrome/browser/search/instant_service_factory.h" |
@@ -187,6 +188,7 @@ |
#include "content/public/common/sandbox_type.h" |
#include "content/public/common/service_manager_connection.h" |
#include "content/public/common/service_names.mojom.h" |
+#include "content/public/common/url_loader_throttle.h" |
#include "content/public/common/url_utils.h" |
#include "content/public/common/web_preferences.h" |
#include "device/bluetooth/adapter_factory.h" |
@@ -2514,6 +2516,9 @@ bool ChromeContentBrowserClient::CanCreateWindow( |
void ChromeContentBrowserClient::ResourceDispatcherHostCreated() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+ safe_browsing_ = g_browser_process->safe_browsing_service(); |
+ |
for (size_t i = 0; i < extra_parts_.size(); ++i) |
extra_parts_[i]->ResourceDispatcherHostCreated(); |
@@ -2996,11 +3001,9 @@ void ChromeContentBrowserClient::ExposeInterfacesToRenderer( |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableNetworkService)) { |
registry->AddInterface( |
- base::Bind( |
- &safe_browsing::MojoSafeBrowsingImpl::Create, |
- g_browser_process->safe_browsing_service()->database_manager(), |
- g_browser_process->safe_browsing_service()->ui_manager(), |
- render_process_host->GetID()), |
+ base::Bind(&safe_browsing::MojoSafeBrowsingImpl::Create, |
+ safe_browsing_->database_manager(), |
+ safe_browsing_->ui_manager(), render_process_host->GetID()), |
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
} |
@@ -3503,6 +3506,20 @@ bool ChromeContentBrowserClient:: |
"BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
} |
+std::vector<std::unique_ptr<content::URLLoaderThrottle>> |
+ChromeContentBrowserClient::CreateURLLoaderThrottles( |
+ const base::Callback<content::WebContents*()>& wc_getter) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableNetworkService)); |
+ |
+ std::vector<std::unique_ptr<content::URLLoaderThrottle>> result; |
+ result.push_back(base::MakeUnique<safe_browsing::SafeBrowsingBrowserThrottle>( |
+ safe_browsing_->database_manager(), safe_browsing_->ui_manager(), |
+ wc_getter)); |
+ return result; |
+} |
+ |
// static |
void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
const storage::QuotaSettings* settings) { |