| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 extension_dispatcher_->is_extension_process() && | 793 extension_dispatcher_->is_extension_process() && |
| 794 opener.canRequest(WebURL(new_url))) | 794 opener.canRequest(WebURL(new_url))) |
| 795 return false; | 795 return false; |
| 796 | 796 |
| 797 // In all other cases, we want to compare against the top frame's URL (as | 797 // In all other cases, we want to compare against the top frame's URL (as |
| 798 // opposed to the opener frame's), since that's what determines the type of | 798 // opposed to the opener frame's), since that's what determines the type of |
| 799 // process. This allows iframes outside an app to open a popup in the app. | 799 // process. This allows iframes outside an app to open a popup in the app. |
| 800 old_url = frame->top()->opener()->top()->document().url(); | 800 old_url = frame->top()->opener()->top()->document().url(); |
| 801 } | 801 } |
| 802 | 802 |
| 803 // If this is a reload, check whether it has the wrong process type. We | |
| 804 // should send it to the browser if it's an extension URL (e.g., hosted app) | |
| 805 // in a normal process, or if it's a process for an extension that has been | |
| 806 // uninstalled. | |
| 807 if (old_url == new_url) { | |
| 808 if (is_extension_url != extension_dispatcher_->is_extension_process()) | |
| 809 return true; | |
| 810 } | |
| 811 | |
| 812 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if | 803 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if |
| 813 // we would enter an extension app's extent from a non-app, or if we leave an | 804 // we would enter an extension app's extent from a non-app, or if we leave an |
| 814 // extension with no web extent. We avoid swapping processes to exit a hosted | 805 // extension with no web extent. We avoid swapping processes to exit a hosted |
| 815 // app for now, since we do not yet support postMessage calls from outside the | 806 // app for now, since we do not yet support postMessage calls from outside the |
| 816 // app back into it (e.g., as in Facebook OAuth 2.0). | 807 // app back into it (e.g., as in Facebook OAuth 2.0). |
| 817 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && | 808 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && |
| 818 !extensions->GetByURL(old_url)->web_extent().is_empty(); | 809 !extensions->GetByURL(old_url)->web_extent().is_empty(); |
| 819 return !extensions->InSameExtent(old_url, new_url) && | 810 return !extensions->InSameExtent(old_url, new_url) && |
| 820 !old_url_is_hosted_app; | 811 !old_url_is_hosted_app; |
| 821 } | 812 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 848 | 839 |
| 849 bool ChromeContentRendererClient::IsAdblockPlusWithWebRequestInstalled() { | 840 bool ChromeContentRendererClient::IsAdblockPlusWithWebRequestInstalled() { |
| 850 return extension_dispatcher_->IsAdblockPlusWithWebRequestInstalled(); | 841 return extension_dispatcher_->IsAdblockPlusWithWebRequestInstalled(); |
| 851 } | 842 } |
| 852 | 843 |
| 853 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 844 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
| 854 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 845 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
| 855 } | 846 } |
| 856 | 847 |
| 857 } // namespace chrome | 848 } // namespace chrome |
| OLD | NEW |