Chromium Code Reviews| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 } | 519 } |
| 520 | 520 |
| 521 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 521 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
| 522 const GURL& url, | 522 const GURL& url, |
| 523 int child_id, | 523 int child_id, |
| 524 int route_id, | 524 int route_id, |
| 525 bool is_main_frame, | 525 bool is_main_frame, |
| 526 ui::PageTransition page_transition, | 526 ui::PageTransition page_transition, |
| 527 bool has_user_gesture) { | 527 bool has_user_gesture) { |
| 528 #if defined(ENABLE_EXTENSIONS) | 528 #if defined(ENABLE_EXTENSIONS) |
| 529 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id)) | 529 // External protocols are disabled for guests. An exception is made for the |
| 530 // "mailto" protocol, so that pages that utilize it work properly in a | |
| 531 // WebView. | |
| 532 if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id) && | |
| 533 !url.SchemeIs("mailto")) { | |
|
lazyboy
2015/07/07 19:32:11
use url::kMailToScheme
paulmeyer
2015/07/08 17:20:15
Done.
| |
| 530 return false; | 534 return false; |
| 535 } | |
| 531 #endif // defined(ENABLE_EXTENSIONS) | 536 #endif // defined(ENABLE_EXTENSIONS) |
| 532 | 537 |
| 533 #if defined(OS_ANDROID) | 538 #if defined(OS_ANDROID) |
| 534 // Main frame external protocols are handled by | 539 // Main frame external protocols are handled by |
| 535 // InterceptNavigationResourceThrottle. | 540 // InterceptNavigationResourceThrottle. |
| 536 if (is_main_frame) | 541 if (is_main_frame) |
| 537 return false; | 542 return false; |
| 538 #endif // defined(ANDROID) | 543 #endif // defined(ANDROID) |
| 539 | 544 |
| 540 BrowserThread::PostTask( | 545 BrowserThread::PostTask( |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 url_request->GetTotalReceivedBytes())); | 785 url_request->GetTotalReceivedBytes())); |
| 781 } | 786 } |
| 782 } | 787 } |
| 783 | 788 |
| 784 // static | 789 // static |
| 785 void ChromeResourceDispatcherHostDelegate:: | 790 void ChromeResourceDispatcherHostDelegate:: |
| 786 SetExternalProtocolHandlerDelegateForTesting( | 791 SetExternalProtocolHandlerDelegateForTesting( |
| 787 ExternalProtocolHandler::Delegate* delegate) { | 792 ExternalProtocolHandler::Delegate* delegate) { |
| 788 g_external_protocol_handler_delegate = delegate; | 793 g_external_protocol_handler_delegate = delegate; |
| 789 } | 794 } |
| OLD | NEW |