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

Side by Side 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: Fixed review comments and merged Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "content/public/common/browser_side_navigation_policy.h" 93 #include "content/public/common/browser_side_navigation_policy.h"
94 #include "content/public/common/content_features.h" 94 #include "content/public/common/content_features.h"
95 #include "content/public/common/content_switches.h" 95 #include "content/public/common/content_switches.h"
96 #include "content/public/common/process_type.h" 96 #include "content/public/common/process_type.h"
97 #include "ipc/ipc_message_macros.h" 97 #include "ipc/ipc_message_macros.h"
98 #include "ipc/ipc_message_start.h" 98 #include "ipc/ipc_message_start.h"
99 #include "net/base/auth.h" 99 #include "net/base/auth.h"
100 #include "net/base/load_flags.h" 100 #include "net/base/load_flags.h"
101 #include "net/base/mime_util.h" 101 #include "net/base/mime_util.h"
102 #include "net/base/net_errors.h" 102 #include "net/base/net_errors.h"
103 #include "net/base/network_delegate.h"
103 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 104 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
104 #include "net/base/request_priority.h" 105 #include "net/base/request_priority.h"
105 #include "net/base/upload_data_stream.h" 106 #include "net/base/upload_data_stream.h"
106 #include "net/cert/cert_status_flags.h" 107 #include "net/cert/cert_status_flags.h"
107 #include "net/cookies/cookie_monster.h" 108 #include "net/cookies/cookie_monster.h"
108 #include "net/http/http_response_headers.h" 109 #include "net/http/http_response_headers.h"
109 #include "net/http/http_response_info.h" 110 #include "net/http/http_response_info.h"
110 #include "net/ssl/ssl_cert_request_info.h" 111 #include "net/ssl/ssl_cert_request_info.h"
111 #include "net/url_request/url_request.h" 112 #include "net/url_request/url_request.h"
112 #include "net/url_request/url_request_context.h" 113 #include "net/url_request/url_request_context.h"
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); 913 ResourceRequestInfoImpl* info = loader->GetRequestInfo();
913 914
914 if (!IsResourceTypeFrame(info->GetResourceType())) 915 if (!IsResourceTypeFrame(info->GetResourceType()))
915 return false; 916 return false;
916 917
917 const net::URLRequestJobFactory* job_factory = 918 const net::URLRequestJobFactory* job_factory =
918 info->GetContext()->GetRequestContext()->job_factory(); 919 info->GetContext()->GetRequestContext()->job_factory();
919 if (job_factory->IsHandledURL(url)) 920 if (job_factory->IsHandledURL(url))
920 return false; 921 return false;
921 922
923 const net::URLRequest* const req = loader->request();
924 const net::NetworkDelegate* const network_delegate = req->network_delegate();
925 // 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.
926 const net::NetworkDelegate::URLBlacklistState urlState =
927 network_delegate->GetURLBlacklistState(url);
928
929 if (urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_BLACKLIST) {
930 // It's a link with custom scheme and it's blacklisted. We return false here
931 // and let it process as a normal URL. Eventually chrome_network_delegate
932 // will see it's in the blacklist and the user will be shown the blocked
933 // content page.
934 return false;
935 }
936
922 return delegate_->HandleExternalProtocol( 937 return delegate_->HandleExternalProtocol(
923 url, info->GetChildID(), info->GetWebContentsGetterForRequest(), 938 url, info->GetChildID(), info->GetWebContentsGetterForRequest(),
924 info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture()); 939 info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture(),
940 urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_WHITELIST);
925 } 941 }
926 942
927 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { 943 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) {
928 // Make sure we have the load state monitor running. 944 // Make sure we have the load state monitor running.
929 if (!update_load_states_timer_->IsRunning() && 945 if (!update_load_states_timer_->IsRunning() &&
930 scheduler_->HasLoadingClients()) { 946 scheduler_->HasLoadingClients()) {
931 update_load_states_timer_->Start( 947 update_load_states_timer_->Start(
932 FROM_HERE, TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec), 948 FROM_HERE, TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec),
933 this, &ResourceDispatcherHostImpl::UpdateLoadInfo); 949 this, &ResourceDispatcherHostImpl::UpdateLoadInfo);
934 } 950 }
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2704 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2689 response->head.security_info = SerializeSecurityInfo(ssl); 2705 response->head.security_info = SerializeSecurityInfo(ssl);
2690 } 2706 }
2691 2707
2692 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2708 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2693 return cert_store_for_testing_ ? cert_store_for_testing_ 2709 return cert_store_for_testing_ ? cert_store_for_testing_
2694 : CertStore::GetInstance(); 2710 : CertStore::GetInstance();
2695 } 2711 }
2696 2712
2697 } // namespace content 2713 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698