| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); | 332 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); |
| 333 } else { | 333 } else { |
| 334 request->SetPriority(net::IDLE); | 334 request->SetPriority(net::IDLE); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 338 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
| 339 resource_context); | 339 resource_context); |
| 340 | 340 |
| 341 #if defined(OS_ANDROID) | 341 #if defined(OS_ANDROID) |
| 342 // TODO(davidben): This is insufficient to integrate with prerender properly. | 342 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) |
| 343 // https://crbug.com/370595 | 343 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
| 344 if (!is_prerendering) { | |
| 345 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | |
| 346 throttles->push_back( | |
| 347 InterceptNavigationDelegate::CreateThrottleFor(request)); | |
| 348 } else { | |
| 349 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | |
| 350 } | |
| 351 } | |
| 352 #else | |
| 353 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | |
| 354 // Redirect some navigations to apps that have registered matching URL | |
| 355 // handlers ('url_handlers' in the manifest). | |
| 356 content::ResourceThrottle* url_to_app_throttle = | |
| 357 AppUrlRedirector::MaybeCreateThrottleFor(request, io_data); | |
| 358 if (url_to_app_throttle) | |
| 359 throttles->push_back(url_to_app_throttle); | |
| 360 } | |
| 361 #endif | 344 #endif |
| 362 | 345 |
| 363 #if defined(OS_CHROMEOS) | 346 #if defined(OS_CHROMEOS) |
| 364 // Check if we need to add merge session throttle. This throttle will postpone | 347 // Check if we need to add merge session throttle. This throttle will postpone |
| 365 // loading of main frames and XHR request. | 348 // loading of main frames and XHR request. |
| 366 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || | 349 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || |
| 367 resource_type == content::RESOURCE_TYPE_XHR) { | 350 resource_type == content::RESOURCE_TYPE_XHR) { |
| 368 // Add interstitial page while merge session process (cookie | 351 // Add interstitial page while merge session process (cookie |
| 369 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in | 352 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in |
| 370 // progress while we are attempting to load a google property. | 353 // progress while we are attempting to load a google property. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 url_request->GetTotalReceivedBytes())); | 720 url_request->GetTotalReceivedBytes())); |
| 738 } | 721 } |
| 739 } | 722 } |
| 740 | 723 |
| 741 // static | 724 // static |
| 742 void ChromeResourceDispatcherHostDelegate:: | 725 void ChromeResourceDispatcherHostDelegate:: |
| 743 SetExternalProtocolHandlerDelegateForTesting( | 726 SetExternalProtocolHandlerDelegateForTesting( |
| 744 ExternalProtocolHandler::Delegate* delegate) { | 727 ExternalProtocolHandler::Delegate* delegate) { |
| 745 g_external_protocol_handler_delegate = delegate; | 728 g_external_protocol_handler_delegate = delegate; |
| 746 } | 729 } |
| OLD | NEW |