OLD | NEW |
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 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 AppendChromeMetricsHeaders(request, resource_context, resource_type); | 145 AppendChromeMetricsHeaders(request, resource_context, resource_type); |
146 | 146 |
147 AppendStandardResourceThrottles(request, | 147 AppendStandardResourceThrottles(request, |
148 resource_context, | 148 resource_context, |
149 child_id, | 149 child_id, |
150 route_id, | 150 route_id, |
151 resource_type, | 151 resource_type, |
152 throttles); | 152 throttles); |
153 | 153 |
154 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 154 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
155 if (io_data->resource_prefetch_predictor_observer()) | 155 if (io_data->resource_prefetch_predictor_observer()) { |
156 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( | 156 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( |
157 request, resource_type, child_id, route_id); | 157 request, resource_type, child_id, route_id); |
| 158 } |
158 } | 159 } |
159 | 160 |
160 void ChromeResourceDispatcherHostDelegate::DownloadStarting( | 161 void ChromeResourceDispatcherHostDelegate::DownloadStarting( |
161 net::URLRequest* request, | 162 net::URLRequest* request, |
162 content::ResourceContext* resource_context, | 163 content::ResourceContext* resource_context, |
163 int child_id, | 164 int child_id, |
164 int route_id, | 165 int route_id, |
165 int request_id, | 166 int request_id, |
166 bool is_content_initiated, | 167 bool is_content_initiated, |
167 ScopedVector<content::ResourceThrottle>* throttles) { | 168 ScopedVector<content::ResourceThrottle>* throttles) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // suggest auto-login, if available. | 354 // suggest auto-login, if available. |
354 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), | 355 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), |
355 info->GetRouteID()); | 356 info->GetRouteID()); |
356 | 357 |
357 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 358 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
358 if (io_data->resource_prefetch_predictor_observer()) | 359 if (io_data->resource_prefetch_predictor_observer()) |
359 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(request); | 360 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(request); |
360 } | 361 } |
361 | 362 |
362 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 363 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
| 364 const GURL& redirect_url, |
363 net::URLRequest* request, | 365 net::URLRequest* request, |
364 content::ResourceContext* resource_context, | 366 content::ResourceContext* resource_context, |
365 content::ResourceResponse* response) { | 367 content::ResourceResponse* response) { |
366 LoadTimingObserver::PopulateTimingInfo(request, response); | 368 LoadTimingObserver::PopulateTimingInfo(request, response); |
367 | 369 |
368 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 370 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
369 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 371 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
370 | 372 |
371 // See if the response contains the Google-Accounts-SignIn header. If so, | 373 // See if the response contains the Google-Accounts-SignIn header. If so, |
372 // then the user has just finished signing in, and the server is allowing the | 374 // then the user has just finished signing in, and the server is allowing the |
373 // browser to suggest connecting the user's profile to the account. | 375 // browser to suggest connecting the user's profile to the account. |
374 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(), | 376 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(), |
375 info->GetRouteID()); | 377 info->GetRouteID()); |
376 #endif | 378 #endif |
377 | 379 |
378 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 380 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
379 if (io_data->resource_prefetch_predictor_observer()) | 381 if (io_data->resource_prefetch_predictor_observer()) { |
380 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( | 382 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( |
381 request); | 383 redirect_url, request); |
| 384 } |
382 } | 385 } |
383 | 386 |
384 void ChromeResourceDispatcherHostDelegate::OnFieldTrialGroupFinalized( | 387 void ChromeResourceDispatcherHostDelegate::OnFieldTrialGroupFinalized( |
385 const std::string& trial_name, | 388 const std::string& trial_name, |
386 const std::string& group_name) { | 389 const std::string& group_name) { |
387 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
388 chrome_variations::VariationID new_id = | 391 chrome_variations::VariationID new_id = |
389 experiments_helper::GetGoogleVariationID(trial_name, group_name); | 392 experiments_helper::GetGoogleVariationID(trial_name, group_name); |
390 if (new_id == chrome_variations::kEmptyID) | 393 if (new_id == chrome_variations::kEmptyID) |
391 return; | 394 return; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (base::Base64Encode(serialized, &hashed)) { | 436 if (base::Base64Encode(serialized, &hashed)) { |
434 // If successful, swap the header value with the new one. | 437 // If successful, swap the header value with the new one. |
435 // Note that the list of IDs and the header could be temporarily out of sync | 438 // Note that the list of IDs and the header could be temporarily out of sync |
436 // if IDs are added as we are recreating the header, but we're OK with those | 439 // if IDs are added as we are recreating the header, but we're OK with those |
437 // descrepancies. | 440 // descrepancies. |
438 variation_ids_header_ = hashed; | 441 variation_ids_header_ = hashed; |
439 } else { | 442 } else { |
440 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 443 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
441 } | 444 } |
442 } | 445 } |
OLD | NEW |