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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 22 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
23 #include "chrome/browser/prerender/prerender_tracker.h" | 23 #include "chrome/browser/prerender/prerender_tracker.h" |
24 #include "chrome/browser/prerender/prerender_util.h" | 24 #include "chrome/browser/prerender/prerender_util.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_io_data.h" | 26 #include "chrome/browser/profiles/profile_io_data.h" |
27 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" | 27 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" |
28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
29 #include "chrome/browser/signin/signin_header_helper.h" | 29 #include "chrome/browser/signin/signin_header_helper.h" |
30 #include "chrome/browser/tab_contents/tab_util.h" | 30 #include "chrome/browser/tab_contents/tab_util.h" |
31 #include "chrome/browser/ui/login/login_prompt.h" | 31 #include "chrome/browser/ui/login/login_prompt.h" |
| 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
34 #include "components/content_settings/core/browser/host_content_settings_map.h" | 35 #include "components/content_settings/core/browser/host_content_settings_map.h" |
35 #include "components/google/core/browser/google_util.h" | 36 #include "components/google/core/browser/google_util.h" |
36 #include "components/variations/net/variations_http_header_provider.h" | 37 #include "components/variations/net/variations_http_header_provider.h" |
37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
39 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/resource_context.h" | 42 #include "content/public/browser/resource_context.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 request, io_data); | 356 request, io_data); |
356 if (ephemeral_app_throttle) | 357 if (ephemeral_app_throttle) |
357 throttles->push_back(ephemeral_app_throttle); | 358 throttles->push_back(ephemeral_app_throttle); |
358 } | 359 } |
359 } | 360 } |
360 #endif | 361 #endif |
361 | 362 |
362 #if defined(OS_CHROMEOS) | 363 #if defined(OS_CHROMEOS) |
363 // Check if we need to add offline throttle. This should be done only | 364 // Check if we need to add offline throttle. This should be done only |
364 // for main frames. | 365 // for main frames. |
365 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | 366 // We will fall back to the old ChromeOS offline error page if the |
| 367 // --disable-new-offline-error-page command-line switch is defined. |
| 368 bool new_error_page_enabled = switches::NewOfflineErrorPageEnabled(); |
| 369 if (!new_error_page_enabled && |
| 370 resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { |
366 // We check offline first, then check safe browsing so that we still can | 371 // We check offline first, then check safe browsing so that we still can |
367 // block unsafe site after we remove offline page. | 372 // block unsafe site after we remove offline page. |
368 throttles->push_back(new OfflineResourceThrottle(request, | 373 throttles->push_back(new OfflineResourceThrottle(request, |
369 appcache_service)); | 374 appcache_service)); |
370 } | 375 } |
371 | 376 |
372 // Check if we need to add merge session throttle. This throttle will postpone | 377 // Check if we need to add merge session throttle. This throttle will postpone |
373 // loading of main frames and XHR request. | 378 // loading of main frames and XHR request. |
374 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || | 379 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || |
375 resource_type == content::RESOURCE_TYPE_XHR) { | 380 resource_type == content::RESOURCE_TYPE_XHR) { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 url_request->GetTotalReceivedBytes())); | 754 url_request->GetTotalReceivedBytes())); |
750 } | 755 } |
751 } | 756 } |
752 | 757 |
753 // static | 758 // static |
754 void ChromeResourceDispatcherHostDelegate:: | 759 void ChromeResourceDispatcherHostDelegate:: |
755 SetExternalProtocolHandlerDelegateForTesting( | 760 SetExternalProtocolHandlerDelegateForTesting( |
756 ExternalProtocolHandler::Delegate* delegate) { | 761 ExternalProtocolHandler::Delegate* delegate) { |
757 g_external_protocol_handler_delegate = delegate; | 762 g_external_protocol_handler_delegate = delegate; |
758 } | 763 } |
OLD | NEW |