| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 91 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 92 #include "components/navigation_interception/intercept_navigation_delegate.h" | 92 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 95 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| 96 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_d
ebug_resource_throttle.h" | 96 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_d
ebug_resource_throttle.h" |
| 97 #endif | 97 #endif |
| 98 | 98 |
| 99 #if defined(OS_CHROMEOS) | 99 #if defined(OS_CHROMEOS) |
| 100 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" | 100 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" |
| 101 // TODO(oshima): Enable this for other platforms. | |
| 102 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | |
| 103 #endif | 101 #endif |
| 104 | 102 |
| 105 using content::BrowserThread; | 103 using content::BrowserThread; |
| 106 using content::RenderViewHost; | 104 using content::RenderViewHost; |
| 107 using content::ResourceDispatcherHostLoginDelegate; | 105 using content::ResourceDispatcherHostLoginDelegate; |
| 108 using content::ResourceRequestInfo; | 106 using content::ResourceRequestInfo; |
| 109 using content::ResourceType; | 107 using content::ResourceType; |
| 110 | 108 |
| 111 #if defined(ENABLE_EXTENSIONS) | 109 #if defined(ENABLE_EXTENSIONS) |
| 112 using extensions::Extension; | 110 using extensions::Extension; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 content::ResourceThrottle* ephemeral_app_throttle = | 394 content::ResourceThrottle* ephemeral_app_throttle = |
| 397 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( | 395 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( |
| 398 request, io_data); | 396 request, io_data); |
| 399 if (ephemeral_app_throttle) | 397 if (ephemeral_app_throttle) |
| 400 throttles->push_back(ephemeral_app_throttle); | 398 throttles->push_back(ephemeral_app_throttle); |
| 401 } | 399 } |
| 402 } | 400 } |
| 403 #endif | 401 #endif |
| 404 | 402 |
| 405 #if defined(OS_CHROMEOS) | 403 #if defined(OS_CHROMEOS) |
| 406 // Check if we need to add offline throttle. This should be done only | |
| 407 // for main frames. | |
| 408 // We will fall back to the old ChromeOS offline error page if the | |
| 409 // --disable-new-offline-error-page command-line switch is defined. | |
| 410 bool new_error_page_enabled = switches::NewOfflineErrorPageEnabled(); | |
| 411 if (!new_error_page_enabled && | |
| 412 resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | |
| 413 // We check offline first, then check safe browsing so that we still can | |
| 414 // block unsafe site after we remove offline page. | |
| 415 throttles->push_back(new OfflineResourceThrottle(request, | |
| 416 appcache_service)); | |
| 417 } | |
| 418 | |
| 419 // Check if we need to add merge session throttle. This throttle will postpone | 404 // Check if we need to add merge session throttle. This throttle will postpone |
| 420 // loading of main frames and XHR request. | 405 // loading of main frames and XHR request. |
| 421 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || | 406 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || |
| 422 resource_type == content::RESOURCE_TYPE_XHR) { | 407 resource_type == content::RESOURCE_TYPE_XHR) { |
| 423 // Add interstitial page while merge session process (cookie | 408 // Add interstitial page while merge session process (cookie |
| 424 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in | 409 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in |
| 425 // progress while we are attempting to load a google property. | 410 // progress while we are attempting to load a google property. |
| 426 if (!MergeSessionThrottle::AreAllSessionMergedAlready() && | 411 if (!MergeSessionThrottle::AreAllSessionMergedAlready() && |
| 427 request->url().SchemeIsHTTPOrHTTPS()) { | 412 request->url().SchemeIsHTTPOrHTTPS()) { |
| 428 throttles->push_back(new MergeSessionThrottle(request, resource_type)); | 413 throttles->push_back(new MergeSessionThrottle(request, resource_type)); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 url_request->GetTotalReceivedBytes())); | 765 url_request->GetTotalReceivedBytes())); |
| 781 } | 766 } |
| 782 } | 767 } |
| 783 | 768 |
| 784 // static | 769 // static |
| 785 void ChromeResourceDispatcherHostDelegate:: | 770 void ChromeResourceDispatcherHostDelegate:: |
| 786 SetExternalProtocolHandlerDelegateForTesting( | 771 SetExternalProtocolHandlerDelegateForTesting( |
| 787 ExternalProtocolHandler::Delegate* delegate) { | 772 ExternalProtocolHandler::Delegate* delegate) { |
| 788 g_external_protocol_handler_delegate = delegate; | 773 g_external_protocol_handler_delegate = delegate; |
| 789 } | 774 } |
| OLD | NEW |