| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 extension_dispatcher_->is_extension_process() && | 777 extension_dispatcher_->is_extension_process() && |
| 778 opener.canRequest(WebURL(new_url))) | 778 opener.canRequest(WebURL(new_url))) |
| 779 return false; | 779 return false; |
| 780 | 780 |
| 781 // In all other cases, we want to compare against the top frame's URL (as | 781 // In all other cases, we want to compare against the top frame's URL (as |
| 782 // opposed to the opener frame's), since that's what determines the type of | 782 // opposed to the opener frame's), since that's what determines the type of |
| 783 // process. This allows iframes outside an app to open a popup in the app. | 783 // process. This allows iframes outside an app to open a popup in the app. |
| 784 old_url = frame->top()->opener()->top()->document().url(); | 784 old_url = frame->top()->opener()->top()->document().url(); |
| 785 } | 785 } |
| 786 | 786 |
| 787 // If this is a reload, check whether it has the wrong process type. We | |
| 788 // should send it to the browser if it's an extension URL (e.g., hosted app) | |
| 789 // in a normal process, or if it's a process for an extension that has been | |
| 790 // uninstalled. | |
| 791 if (old_url == new_url) { | |
| 792 if (is_extension_url != extension_dispatcher_->is_extension_process()) | |
| 793 return true; | |
| 794 } | |
| 795 | |
| 796 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if | 787 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if |
| 797 // we would enter an extension app's extent from a non-app, or if we leave an | 788 // we would enter an extension app's extent from a non-app, or if we leave an |
| 798 // extension with no web extent. We avoid swapping processes to exit a hosted | 789 // extension with no web extent. We avoid swapping processes to exit a hosted |
| 799 // app for now, since we do not yet support postMessage calls from outside the | 790 // app for now, since we do not yet support postMessage calls from outside the |
| 800 // app back into it (e.g., as in Facebook OAuth 2.0). | 791 // app back into it (e.g., as in Facebook OAuth 2.0). |
| 801 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && | 792 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && |
| 802 !extensions->GetByURL(old_url)->web_extent().is_empty(); | 793 !extensions->GetByURL(old_url)->web_extent().is_empty(); |
| 803 return !extensions->InSameExtent(old_url, new_url) && | 794 return !extensions->InSameExtent(old_url, new_url) && |
| 804 !old_url_is_hosted_app; | 795 !old_url_is_hosted_app; |
| 805 } | 796 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 828 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
| 838 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 829 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
| 839 } | 830 } |
| 840 | 831 |
| 841 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 832 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
| 842 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 833 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
| 843 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 834 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
| 844 } | 835 } |
| 845 | 836 |
| 846 } // namespace chrome | 837 } // namespace chrome |
| OLD | NEW |