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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 WebFrame* frame, | 749 WebFrame* frame, |
750 const GURL& new_url, | 750 const GURL& new_url, |
751 bool is_initial_navigation) { | 751 bool is_initial_navigation) { |
752 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 752 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
753 GURL old_url(frame->top()->document().url()); | 753 GURL old_url(frame->top()->document().url()); |
754 | 754 |
755 // Determine if the new URL is an extension (excluding bookmark apps). | 755 // Determine if the new URL is an extension (excluding bookmark apps). |
756 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( | 756 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( |
757 *extensions, ExtensionURLInfo(new_url)); | 757 *extensions, ExtensionURLInfo(new_url)); |
758 | 758 |
759 // If this is a reload, check whether it has the wrong process type. We | |
760 // should send it to the browser if it's an extension URL (e.g., hosted app) | |
761 // in a normal process, or if it's a process for an extension that has been | |
762 // uninstalled. | |
763 if (old_url == new_url) { | |
darin (slow to review)
2012/01/27 19:34:11
This condition isn't necessarily limited to a relo
nasko
2012/01/27 20:14:56
Hitting enter in the location bar is handled by th
darin (slow to review)
2012/01/27 23:58:35
^^^ what about this last point? is this really th
nasko
2012/01/28 01:43:12
It could be moved to the function that calls this,
| |
764 bool is_extension_url = !!new_url_extension; | |
765 if (is_extension_url != extension_dispatcher_->is_extension_process()) | |
766 return true; | |
darin (slow to review)
2012/01/27 23:58:35
what about the reverse case? what if the app is u
nasko
2012/01/28 01:43:12
Yes, if the process "type" mismatches with the cur
| |
767 } | |
768 | |
759 // If old_url is still empty and this is an initial navigation, then this is | 769 // If old_url is still empty and this is an initial navigation, then this is |
760 // a window.open operation. We should look at the opener URL. | 770 // a window.open operation. We should look at the opener URL. |
761 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { | 771 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { |
762 // If we're about to open a normal web page from a same-origin opener stuck | 772 // If we're about to open a normal web page from a same-origin opener stuck |
763 // in an extension process, we want to keep it in process to allow the | 773 // in an extension process, we want to keep it in process to allow the |
764 // opener to script it. | 774 // opener to script it. |
765 WebDocument opener_document = frame->opener()->document(); | 775 WebDocument opener_document = frame->opener()->document(); |
766 GURL opener_url = opener_document.url(); | 776 GURL opener_url = opener_document.url(); |
767 WebSecurityOrigin opener_origin = opener_document.securityOrigin(); | 777 WebSecurityOrigin opener_origin = opener_document.securityOrigin(); |
768 bool opener_is_extension_url = !!extensions->GetExtensionOrAppByURL( | 778 bool opener_is_extension_url = !!extensions->GetExtensionOrAppByURL( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 829 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
820 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 830 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
821 } | 831 } |
822 | 832 |
823 bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) { | 833 bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) { |
824 return allowed_socket_origins_.find(url.host()) != | 834 return allowed_socket_origins_.find(url.host()) != |
825 allowed_socket_origins_.end(); | 835 allowed_socket_origins_.end(); |
826 } | 836 } |
827 | 837 |
828 } // namespace chrome | 838 } // namespace chrome |
OLD | NEW |