Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1692503002: Functionality to allow blacklist and whitelist of custom schemes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..15fbe7fee9f08fb4066d50541912e89be1a13f7a 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -851,9 +851,24 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader,
if (job_factory->IsHandledURL(url))
return false;
+ net::URLRequest* req = loader->request();
Thiemo Nagel 2016/03/08 18:44:35 Can you make this const?
+ net::NetworkDelegate* network_delegate = req->network_delegate();
Thiemo Nagel 2016/03/08 18:44:35 Can you make this const?
+ // get the state, if url is in blacklist, whitelist or in none of those.
Thiemo Nagel 2016/03/08 18:44:35 Please start comment with capital letter.
+ net::NetworkDelegate::URLBlacklistState urlState =
Thiemo Nagel 2016/03/08 18:44:35 const
+ network_delegate->GetURLBlacklistState(url);
+
+ if(urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_BLACKLIST) {
Thiemo Nagel 2016/03/08 18:44:35 Please add a blank between "if" and "(".
+ // It's a link with custom scheme and it's blacklisted.
Thiemo Nagel 2016/03/08 18:44:35 Please wrap comment lines at 80 characters to save
+ // We return false here and let it process as a normal URL.
+ // Eventually chrome_network_delegate will see it's in the blackist and
Thiemo Nagel 2016/03/08 18:44:35 blackist --> blacklist
+ // 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) {

Powered by Google App Engine
This is Rietveld 408576698