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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 url, | 231 url, |
232 GURL(), | 232 GURL(), |
233 &plugin)) { | 233 &plugin)) { |
234 return true; | 234 return true; |
235 } | 235 } |
236 } | 236 } |
237 return false; | 237 return false; |
238 } | 238 } |
239 #endif // !defined(ENABLE_EXTENSIONS) | 239 #endif // !defined(ENABLE_EXTENSIONS) |
240 | 240 |
241 #if !defined(OS_ANDROID) | 241 void LaunchURL( |
242 void LaunchURL(const GURL& url, int render_process_id, int render_view_id) { | 242 const GURL& url, |
243 int render_process_id, | |
244 int render_view_id, | |
245 ui::PageTransition page_transition) { | |
243 // If there is no longer a WebContents, the request may have raced with tab | 246 // If there is no longer a WebContents, the request may have raced with tab |
244 // closing. Don't fire the external request. (It may have been a prerender.) | 247 // closing. Don't fire the external request. (It may have been a prerender.) |
245 content::WebContents* web_contents = | 248 content::WebContents* web_contents = |
246 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 249 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
247 if (!web_contents) | 250 if (!web_contents) |
248 return; | 251 return; |
249 | 252 |
250 // Do not launch external requests attached to unswapped prerenders. | 253 // Do not launch external requests attached to unswapped prerenders. |
251 prerender::PrerenderContents* prerender_contents = | 254 prerender::PrerenderContents* prerender_contents = |
252 prerender::PrerenderContents::FromWebContents(web_contents); | 255 prerender::PrerenderContents::FromWebContents(web_contents); |
253 if (prerender_contents) { | 256 if (prerender_contents) { |
254 prerender_contents->Destroy(prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); | 257 prerender_contents->Destroy(prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); |
255 prerender::ReportPrerenderExternalURL(); | 258 prerender::ReportPrerenderExternalURL(); |
256 return; | 259 return; |
257 } | 260 } |
258 | 261 |
259 ExternalProtocolHandler::LaunchUrlWithDelegate( | 262 ExternalProtocolHandler::LaunchUrlWithDelegate( |
260 url, | 263 url, |
261 render_process_id, | 264 render_process_id, |
262 render_view_id, | 265 render_view_id, |
266 page_transition, | |
263 g_external_protocol_handler_delegate); | 267 g_external_protocol_handler_delegate); |
264 } | 268 } |
265 #endif // !defined(OS_ANDROID) | |
266 | 269 |
267 #if !defined(DISABLE_NACL) | 270 #if !defined(DISABLE_NACL) |
268 void AppendComponentUpdaterThrottles( | 271 void AppendComponentUpdaterThrottles( |
269 net::URLRequest* request, | 272 net::URLRequest* request, |
270 content::ResourceContext* resource_context, | 273 content::ResourceContext* resource_context, |
271 ResourceType resource_type, | 274 ResourceType resource_type, |
272 ScopedVector<content::ResourceThrottle>* throttles) { | 275 ScopedVector<content::ResourceThrottle>* throttles) { |
273 const char* crx_id = NULL; | 276 const char* crx_id = NULL; |
274 component_updater::ComponentUpdateService* cus = | 277 component_updater::ComponentUpdateService* cus = |
275 g_browser_process->component_updater(); | 278 g_browser_process->component_updater(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 | 511 |
509 ResourceDispatcherHostLoginDelegate* | 512 ResourceDispatcherHostLoginDelegate* |
510 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 513 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
511 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 514 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
512 return CreateLoginPrompt(auth_info, request); | 515 return CreateLoginPrompt(auth_info, request); |
513 } | 516 } |
514 | 517 |
515 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 518 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
516 const GURL& url, | 519 const GURL& url, |
517 int child_id, | 520 int child_id, |
518 int route_id) { | 521 int route_id, |
519 #if defined(OS_ANDROID) | 522 ui::PageTransition page_transition) { |
Jaekyun Seok (inactive)
2015/04/23 03:59:41
How about running HandleExternalProtocol only when
| |
520 // Android use a resource throttle to handle external as well as internal | |
521 // protocols. | |
522 return false; | |
523 #else | |
524 | |
525 #if defined(ENABLE_EXTENSIONS) | 523 #if defined(ENABLE_EXTENSIONS) |
526 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id)) | 524 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id)) |
527 return false; | 525 return false; |
528 | 526 |
529 #endif // defined(ENABLE_EXTENSIONS) | 527 #endif // defined(ENABLE_EXTENSIONS) |
530 | 528 |
531 BrowserThread::PostTask(BrowserThread::UI, | 529 BrowserThread::PostTask( |
532 FROM_HERE, | 530 BrowserThread::UI, |
533 base::Bind(&LaunchURL, url, child_id, route_id)); | 531 FROM_HERE, |
532 base::Bind(&LaunchURL, url, child_id, route_id, page_transition)); | |
534 return true; | 533 return true; |
535 #endif | |
536 } | 534 } |
537 | 535 |
538 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( | 536 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( |
539 net::URLRequest* request, | 537 net::URLRequest* request, |
540 content::ResourceContext* resource_context, | 538 content::ResourceContext* resource_context, |
541 ResourceType resource_type, | 539 ResourceType resource_type, |
542 ScopedVector<content::ResourceThrottle>* throttles) { | 540 ScopedVector<content::ResourceThrottle>* throttles) { |
543 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 541 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
544 #if defined(SAFE_BROWSING_SERVICE) | 542 #if defined(SAFE_BROWSING_SERVICE) |
545 // Insert safe browsing at the front of the list, so it gets to decide on | 543 // Insert safe browsing at the front of the list, so it gets to decide on |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 url_request->GetTotalReceivedBytes())); | 759 url_request->GetTotalReceivedBytes())); |
762 } | 760 } |
763 } | 761 } |
764 | 762 |
765 // static | 763 // static |
766 void ChromeResourceDispatcherHostDelegate:: | 764 void ChromeResourceDispatcherHostDelegate:: |
767 SetExternalProtocolHandlerDelegateForTesting( | 765 SetExternalProtocolHandlerDelegateForTesting( |
768 ExternalProtocolHandler::Delegate* delegate) { | 766 ExternalProtocolHandler::Delegate* delegate) { |
769 g_external_protocol_handler_delegate = delegate; | 767 g_external_protocol_handler_delegate = delegate; |
770 } | 768 } |
OLD | NEW |