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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 WebFrame* frame, | 754 WebFrame* frame, |
755 const GURL& new_url, | 755 const GURL& new_url, |
756 bool is_initial_navigation) { | 756 bool is_initial_navigation) { |
757 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 757 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
758 GURL old_url(frame->top()->document().url()); | 758 GURL old_url(frame->top()->document().url()); |
759 | 759 |
760 // Determine if the new URL is an extension (excluding bookmark apps). | 760 // Determine if the new URL is an extension (excluding bookmark apps). |
761 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( | 761 const Extension* new_url_extension = extensions::GetNonBookmarkAppExtension( |
762 *extensions, ExtensionURLInfo(new_url)); | 762 *extensions, ExtensionURLInfo(new_url)); |
763 | 763 |
| 764 // If this is a reload, check whether it has the wrong process type. We |
| 765 // should send it to the browser if it's an extension URL (e.g., hosted app) |
| 766 // in a normal process, or if it's a process for an extension that has been |
| 767 // uninstalled. |
| 768 if (old_url == new_url) { |
| 769 bool is_extension_url = !!new_url_extension; |
| 770 if (is_extension_url != extension_dispatcher_->is_extension_process()) |
| 771 return true; |
| 772 } |
| 773 |
764 // If old_url is still empty and this is an initial navigation, then this is | 774 // If old_url is still empty and this is an initial navigation, then this is |
765 // a window.open operation. We should look at the opener URL. | 775 // a window.open operation. We should look at the opener URL. |
766 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { | 776 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { |
767 // If we're about to open a normal web page from a same-origin opener stuck | 777 // If we're about to open a normal web page from a same-origin opener stuck |
768 // in an extension process, we want to keep it in process to allow the | 778 // in an extension process, we want to keep it in process to allow the |
769 // opener to script it. | 779 // opener to script it. |
770 WebDocument opener_document = frame->opener()->document(); | 780 WebDocument opener_document = frame->opener()->document(); |
771 GURL opener_url = opener_document.url(); | 781 GURL opener_url = opener_document.url(); |
772 WebSecurityOrigin opener_origin = opener_document.securityOrigin(); | 782 WebSecurityOrigin opener_origin = opener_document.securityOrigin(); |
773 bool opener_is_extension_url = !!extensions->GetExtensionOrAppByURL( | 783 bool opener_is_extension_url = !!extensions->GetExtensionOrAppByURL( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 834 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
825 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 835 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
826 } | 836 } |
827 | 837 |
828 bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) { | 838 bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) { |
829 return allowed_socket_origins_.find(url.host()) != | 839 return allowed_socket_origins_.find(url.host()) != |
830 allowed_socket_origins_.end(); | 840 allowed_socket_origins_.end(); |
831 } | 841 } |
832 | 842 |
833 } // namespace chrome | 843 } // namespace chrome |
OLD | NEW |