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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #endif | 78 #endif |
79 | 79 |
80 #if defined(USE_SYSTEM_PROTOBUF) | 80 #if defined(USE_SYSTEM_PROTOBUF) |
81 #include <google/protobuf/repeated_field.h> | 81 #include <google/protobuf/repeated_field.h> |
82 #else | 82 #else |
83 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 83 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
84 #endif | 84 #endif |
85 | 85 |
86 #if defined(OS_ANDROID) | 86 #if defined(OS_ANDROID) |
87 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 87 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 88 #include "chrome/browser/android/url_utilities.h" |
88 #include "chrome/browser/ui/android/infobars/auto_login_prompter.h" | 89 #include "chrome/browser/ui/android/infobars/auto_login_prompter.h" |
89 #include "components/navigation_interception/intercept_navigation_delegate.h" | 90 #include "components/navigation_interception/intercept_navigation_delegate.h" |
90 #endif | 91 #endif |
91 | 92 |
92 #if defined(OS_CHROMEOS) | 93 #if defined(OS_CHROMEOS) |
93 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" | 94 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" |
94 // TODO(oshima): Enable this for other platforms. | 95 // TODO(oshima): Enable this for other platforms. |
95 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 96 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
96 #endif | 97 #endif |
97 | 98 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 request->SetPriority(net::IDLE); | 317 request->SetPriority(net::IDLE); |
317 } | 318 } |
318 } | 319 } |
319 | 320 |
320 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 321 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
321 resource_context); | 322 resource_context); |
322 | 323 |
323 #if defined(OS_ANDROID) | 324 #if defined(OS_ANDROID) |
324 // TODO(davidben): This is insufficient to integrate with prerender properly. | 325 // TODO(davidben): This is insufficient to integrate with prerender properly. |
325 // https://crbug.com/370595 | 326 // https://crbug.com/370595 |
326 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && !is_prerendering) { | 327 // |
| 328 // https://crbug.com/410524: If the requested url can't be handled by chrome |
| 329 // showing a dedicated app or an intent picker even for sub frame is better |
| 330 // than showing an error page. In this case, chrome won't be listed in an |
| 331 // intent picker as an option. |
| 332 if (!is_prerendering && (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || |
| 333 (resource_type == content::RESOURCE_TYPE_SUB_FRAME && |
| 334 !IsAcceptedScheme(request->url().spec()) && |
| 335 !IsDownloadableScheme(request->url().spec())))) { |
327 throttles->push_back( | 336 throttles->push_back( |
328 InterceptNavigationDelegate::CreateThrottleFor(request)); | 337 InterceptNavigationDelegate::CreateThrottleFor(request)); |
329 } | 338 } |
330 #else | 339 #else |
331 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | 340 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { |
332 // Redirect some navigations to apps that have registered matching URL | 341 // Redirect some navigations to apps that have registered matching URL |
333 // handlers ('url_handlers' in the manifest). | 342 // handlers ('url_handlers' in the manifest). |
334 content::ResourceThrottle* url_to_app_throttle = | 343 content::ResourceThrottle* url_to_app_throttle = |
335 AppUrlRedirector::MaybeCreateThrottleFor(request, io_data); | 344 AppUrlRedirector::MaybeCreateThrottleFor(request, io_data); |
336 if (url_to_app_throttle) | 345 if (url_to_app_throttle) |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 url_request->GetTotalReceivedBytes())); | 758 url_request->GetTotalReceivedBytes())); |
750 } | 759 } |
751 } | 760 } |
752 | 761 |
753 // static | 762 // static |
754 void ChromeResourceDispatcherHostDelegate:: | 763 void ChromeResourceDispatcherHostDelegate:: |
755 SetExternalProtocolHandlerDelegateForTesting( | 764 SetExternalProtocolHandlerDelegateForTesting( |
756 ExternalProtocolHandler::Delegate* delegate) { | 765 ExternalProtocolHandler::Delegate* delegate) { |
757 g_external_protocol_handler_delegate = delegate; | 766 g_external_protocol_handler_delegate = delegate; |
758 } | 767 } |
OLD | NEW |