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