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

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: 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 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 #include <algorithm> 10 #include <algorithm>
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); 844 ResourceRequestInfoImpl* info = loader->GetRequestInfo();
845 845
846 if (!IsResourceTypeFrame(info->GetResourceType())) 846 if (!IsResourceTypeFrame(info->GetResourceType()))
847 return false; 847 return false;
848 848
849 const net::URLRequestJobFactory* job_factory = 849 const net::URLRequestJobFactory* job_factory =
850 info->GetContext()->GetRequestContext()->job_factory(); 850 info->GetContext()->GetRequestContext()->job_factory();
851 if (job_factory->IsHandledURL(url)) 851 if (job_factory->IsHandledURL(url))
852 return false; 852 return false;
853 853
854 net::URLRequest* req = loader->request();
Thiemo Nagel 2016/03/08 18:44:35 Can you make this const?
855 net::NetworkDelegate* network_delegate = req->network_delegate();
Thiemo Nagel 2016/03/08 18:44:35 Can you make this const?
856 // 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.
857 net::NetworkDelegate::URLBlacklistState urlState =
Thiemo Nagel 2016/03/08 18:44:35 const
858 network_delegate->GetURLBlacklistState(url);
859
860 if(urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_BLACKLIST) {
Thiemo Nagel 2016/03/08 18:44:35 Please add a blank between "if" and "(".
861 // 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
862 // We return false here and let it process as a normal URL.
863 // Eventually chrome_network_delegate will see it's in the blackist and
Thiemo Nagel 2016/03/08 18:44:35 blackist --> blacklist
864 // the user will be shown the blocked content page.
865 return false;
866 }
867
854 return delegate_->HandleExternalProtocol( 868 return delegate_->HandleExternalProtocol(
855 url, info->GetChildID(), info->GetWebContentsGetterForRequest(), 869 url, info->GetChildID(), info->GetWebContentsGetterForRequest(),
856 info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture()); 870 info->IsMainFrame(), info->GetPageTransition(), info->HasUserGesture(),
871 urlState == net::NetworkDelegate::URLBlacklistState::URL_IN_WHITELIST);
857 } 872 }
858 873
859 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { 874 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) {
860 // Make sure we have the load state monitor running. 875 // Make sure we have the load state monitor running.
861 if (!update_load_states_timer_->IsRunning() && 876 if (!update_load_states_timer_->IsRunning() &&
862 scheduler_->HasLoadingClients()) { 877 scheduler_->HasLoadingClients()) {
863 update_load_states_timer_->Start( 878 update_load_states_timer_->Start(
864 FROM_HERE, TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec), 879 FROM_HERE, TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec),
865 this, &ResourceDispatcherHostImpl::UpdateLoadInfo); 880 this, &ResourceDispatcherHostImpl::UpdateLoadInfo);
866 } 881 }
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 load_flags |= net::LOAD_PREFETCH; 2581 load_flags |= net::LOAD_PREFETCH;
2567 } 2582 }
2568 2583
2569 if (is_sync_load) 2584 if (is_sync_load)
2570 load_flags |= net::LOAD_IGNORE_LIMITS; 2585 load_flags |= net::LOAD_IGNORE_LIMITS;
2571 2586
2572 return load_flags; 2587 return load_flags;
2573 } 2588 }
2574 2589
2575 } // namespace content 2590 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698