Chromium Code Reviews| Index: content/browser/loader/resource_dispatcher_host_impl.cc |
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
| index 9d02adfea06c8e5d0cbf7d655970d56b7bd54a47..e815f941ae30c16988bfc5fe33644b298bc923b7 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -20,7 +20,6 @@ |
| #include "base/logging.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "base/memory/shared_memory.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram_macros.h" |
| @@ -851,9 +850,24 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader, |
| if (job_factory->IsHandledURL(url)) |
| return false; |
| + const net::URLRequest* req = loader->request(); |
|
bartfab (slow)
2016/03/10 13:49:41
Nit: const pointer.
|
| + const net::NetworkDelegate* network_delegate = req->network_delegate(); |
|
bartfab (slow)
2016/03/10 13:49:41
Nit 1: #include "net/base/network_delegate.h"
Nit
|
| + // Get the state, if url is in blacklist, whitelist or in none of those. |
| + const net::NetworkDelegate::URLBlacklistState urlState = |
| + network_delegate->GetURLBlacklistState(url); |
| + |
| + if (urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_BLACKLIST) { |
| + // It's a link with custom scheme and it's blacklisted. We return false here |
| + // and let it process as a normal URL. Eventually chrome_network_delegate |
| + // will see it's in the blacklist and the user will be shown the blocked |
| + // content page. |
| + return false; |
| + } |
| + |
| return delegate_->HandleExternalProtocol( |
| url, info->GetChildID(), info->GetWebContentsGetterForRequest(), |
| - info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture()); |
| + info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture(), |
| + urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_WHITELIST); |
| } |
| void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { |