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 e594cb76d5aef0b6545234d41d7bfa1bb0eee8c1..f984d34ee36ada2256ced4b5c228dd5ca67335f3 100644 |
--- a/content/browser/loader/resource_dispatcher_host_impl.cc |
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
@@ -100,6 +100,7 @@ |
#include "net/base/load_flags.h" |
#include "net/base/mime_util.h" |
#include "net/base/net_errors.h" |
+#include "net/base/network_delegate.h" |
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
#include "net/base/request_priority.h" |
#include "net/base/upload_data_stream.h" |
@@ -919,9 +920,24 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader, |
if (job_factory->IsHandledURL(url)) |
return false; |
+ const net::URLRequest* const req = loader->request(); |
+ const net::NetworkDelegate* const network_delegate = req->network_delegate(); |
+ // Get the state, if url is in blacklist, whitelist or in none of those. |
Thiemo Nagel
2016/04/21 14:45:10
Please add pipes around url: |url|
igorcov
2016/04/21 16:01:34
Done.
|
+ 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) { |