Skip to content

Commit

Permalink
Remove child/route parameters from ShouldBeginRequest and RequestBegi…
Browse files Browse the repository at this point in the history
…nning.

They were mostly unused. Move remaining uses to calls to GetChildID,
though we'll possibly need to adjust them later.

BUG=376003

Review URL: https://codereview.chromium.org/481593002

Cr-Commit-Position: refs/heads/master@{#291098}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291098 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
davidben@chromium.org committed Aug 21, 2014
1 parent 87bd7a4 commit b770f0f
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) {

AddExtraHeadersIfNeeded(request, resource_context);
Expand All @@ -227,7 +225,7 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
// however io_client may or may not be ready at the time depending on whether
// webcontents is created.
throttles->push_back(new IoThreadClientThrottle(
child_id, request_info->GetRenderFrameID(), request));
request_info->GetChildID(), request_info->GetRenderFrameID(), request));

// We allow intercepting only navigations within main frames. This
// is used to post onPageStarted. We handle shouldOverrideUrlLoading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class AwResourceDispatcherHostDelegate
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
content::ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
virtual void DownloadStarting(
net::URLRequest* request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,12 @@ class TestResourceDispatcherHostDelegate
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE {
ChromeResourceDispatcherHostDelegate::RequestBeginning(
request,
resource_context,
appcache_service,
resource_type,
child_id,
route_id,
throttles);
content::ResourceThrottle* throttle =
test_navigation_listener_->CreateResourceThrottle(request->url(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@ ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() {
}

bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
int child_id,
int route_id,
const std::string& method,
const GURL& url,
ResourceType resource_type,
Expand All @@ -304,8 +302,6 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) {
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
bool is_prerendering =
Expand Down Expand Up @@ -400,8 +396,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
#endif

signin::AppendMirrorRequestHeaderIfPossible(
request, GURL() /* redirect_url */,
io_data, info->GetChildID(), info->GetRouteID());
request, GURL() /* redirect_url */, io_data);

AppendStandardResourceThrottles(request,
resource_context,
Expand Down Expand Up @@ -699,9 +694,10 @@ void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
content::ResourceContext* resource_context,
content::ResourceResponse* response) {
ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);

#if defined(ENABLE_ONE_CLICK_SIGNIN)
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);

// See if the response contains the Google-Accounts-SignIn header. If so,
// then the user has just finished signing in, and the server is allowing the
// browser to suggest connecting the user's profile to the account.
Expand All @@ -716,8 +712,7 @@ void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
// response and let Chrome handle the action with native UI. The only
// exception is requests from gaia webview, since the native profile
// management UI is built on top of it.
signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data,
info->GetChildID(), info->GetRouteID());
signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data);

#if defined(ENABLE_CONFIGURATION_POLICY)
if (io_data->policy_header_helper())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class ChromeResourceDispatcherHostDelegate

// ResourceDispatcherHostDelegate implementation.
virtual bool ShouldBeginRequest(
int child_id,
int route_id,
const std::string& method,
const GURL& url,
content::ResourceType resource_type,
Expand All @@ -50,8 +48,6 @@ class ChromeResourceDispatcherHostDelegate
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
content::ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
virtual void DownloadStarting(
net::URLRequest* request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,12 @@ class TestDispatcherHostDelegate : public ChromeResourceDispatcherHostDelegate {
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE {
ChromeResourceDispatcherHostDelegate::RequestBeginning(
request,
resource_context,
appcache_service,
resource_type,
child_id,
route_id,
throttles);
request_headers_.MergeFrom(request->extra_request_headers());
}
Expand Down
4 changes: 1 addition & 3 deletions chrome/browser/signin/signin_header_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ ManageAccountsParams::ManageAccountsParams() :
bool AppendMirrorRequestHeaderIfPossible(
net::URLRequest* request,
const GURL& redirect_url,
ProfileIOData* io_data,
int child_id,
int route_id) {
ProfileIOData* io_data) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));

if (io_data->IsOffTheRecord() ||
Expand Down
4 changes: 1 addition & 3 deletions chrome/browser/signin/signin_header_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ struct ManageAccountsParams {
bool AppendMirrorRequestHeaderIfPossible(
net::URLRequest* request,
const GURL& redirect_url,
ProfileIOData* io_data,
int child_id,
int route_id);
ProfileIOData* io_data);

// Looks for the X-Chrome-Manage-Accounts response header, and if found,
// tries to show the avatar bubble in the browser identified by the
Expand Down
5 changes: 1 addition & 4 deletions content/browser/cross_site_transfer_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ class TrackingResourceDispatcherHostDelegate
ResourceContext* resource_context,
AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ShellResourceDispatcherHostDelegate::RequestBeginning(
request, resource_context, appcache_service, resource_type, child_id,
route_id, throttles);
request, resource_context, appcache_service, resource_type, throttles);
// Expect only a single request for the tracked url.
ASSERT_FALSE(throttle_created_);
// If this is a request for the tracked URL, add a throttle to track it.
Expand Down
6 changes: 1 addition & 5 deletions content/browser/loader/resource_dispatcher_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1008,9 +1008,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
}

// Allow the observer to block/handle the request.
if (delegate_ && !delegate_->ShouldBeginRequest(child_id,
route_id,
request_data.method,
if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method,
request_data.url,
request_data.resource_type,
resource_context)) {
Expand Down Expand Up @@ -1196,8 +1194,6 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
resource_context,
filter_->appcache_service(),
request_data.resource_type,
child_id,
route_id,
&throttles);
}

Expand Down
2 changes: 0 additions & 2 deletions content/browser/loader/resource_dispatcher_host_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,6 @@ class TestResourceDispatcherHostDelegate
ResourceContext* resource_context,
AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
if (user_data_) {
const void* key = user_data_.get();
Expand Down
6 changes: 1 addition & 5 deletions content/browser/transition_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,12 @@ class TransitionBrowserTestObserver
ResourceContext* resource_context,
AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ShellResourceDispatcherHostDelegate::RequestBeginning(request,
resource_context,
appcache_service,
resource_type,
child_id,
route_id,
throttles);
request_ = request;

Expand All @@ -69,7 +65,7 @@ class TransitionBrowserTestObserver

if (is_transition_request_) {
TransitionRequestManager::GetInstance()->AddPendingTransitionRequestData(
child_id, info->GetRenderFrameID(), "*", "", "");
info->GetChildID(), info->GetRenderFrameID(), "*", "", "");
}
}

Expand Down
4 changes: 0 additions & 4 deletions content/public/browser/resource_dispatcher_host_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
namespace content {

bool ResourceDispatcherHostDelegate::ShouldBeginRequest(
int child_id,
int route_id,
const std::string& method,
const GURL& url,
ResourceType resource_type,
Expand All @@ -23,8 +21,6 @@ void ResourceDispatcherHostDelegate::RequestBeginning(
ResourceContext* resource_context,
AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) {
}

Expand Down
6 changes: 1 addition & 5 deletions content/public/browser/resource_dispatcher_host_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ struct ResourceResponse;
class CONTENT_EXPORT ResourceDispatcherHostDelegate {
public:
// Called when a request begins. Return false to abort the request.
virtual bool ShouldBeginRequest(int child_id,
int route_id,
const std::string& method,
virtual bool ShouldBeginRequest(const std::string& method,
const GURL& url,
ResourceType resource_type,
ResourceContext* resource_context);
Expand All @@ -52,8 +50,6 @@ class CONTENT_EXPORT ResourceDispatcherHostDelegate {
ResourceContext* resource_context,
AppCacheService* appcache_service,
ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles);

// Allows an embedder to add additional resource handlers for a download.
Expand Down

0 comments on commit b770f0f

Please sign in to comment.