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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 504 } |
505 | 505 |
506 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 506 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
507 const GURL& url, | 507 const GURL& url, |
508 int child_id, | 508 int child_id, |
509 int route_id, | 509 int route_id, |
510 bool is_main_frame, | 510 bool is_main_frame, |
511 ui::PageTransition page_transition, | 511 ui::PageTransition page_transition, |
512 bool has_user_gesture) { | 512 bool has_user_gesture) { |
513 #if defined(ENABLE_EXTENSIONS) | 513 #if defined(ENABLE_EXTENSIONS) |
514 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id)) | 514 // External protocols are disabled for guests. An exception is made for the |
| 515 // "mailto" protocol, so that pages that utilize it work properly in a |
| 516 // WebView. |
| 517 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id) && |
| 518 !url.SchemeIs(url::kMailToScheme)) { |
515 return false; | 519 return false; |
| 520 } |
516 #endif // defined(ENABLE_EXTENSIONS) | 521 #endif // defined(ENABLE_EXTENSIONS) |
517 | 522 |
518 #if defined(OS_ANDROID) | 523 #if defined(OS_ANDROID) |
519 // Main frame external protocols are handled by | 524 // Main frame external protocols are handled by |
520 // InterceptNavigationResourceThrottle. | 525 // InterceptNavigationResourceThrottle. |
521 if (is_main_frame) | 526 if (is_main_frame) |
522 return false; | 527 return false; |
523 #endif // defined(ANDROID) | 528 #endif // defined(ANDROID) |
524 | 529 |
525 BrowserThread::PostTask( | 530 BrowserThread::PostTask( |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 url_request->GetTotalReceivedBytes())); | 772 url_request->GetTotalReceivedBytes())); |
768 } | 773 } |
769 } | 774 } |
770 | 775 |
771 // static | 776 // static |
772 void ChromeResourceDispatcherHostDelegate:: | 777 void ChromeResourceDispatcherHostDelegate:: |
773 SetExternalProtocolHandlerDelegateForTesting( | 778 SetExternalProtocolHandlerDelegateForTesting( |
774 ExternalProtocolHandler::Delegate* delegate) { | 779 ExternalProtocolHandler::Delegate* delegate) { |
775 g_external_protocol_handler_delegate = delegate; | 780 g_external_protocol_handler_delegate = delegate; |
776 } | 781 } |
OLD | NEW |