diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 19:59:15 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 19:59:15 +0000 |
commit | 31bdbfefd2847efaf171c5e464510c779b5be573 (patch) | |
tree | cc29f345b8fc6b9523a9d314c3345eecad05c47f /chrome/browser/extensions/extension_function.cc | |
parent | ebd08aa747212d67bdab00a6bf4dcd7bc4a3287f (diff) | |
download | chromium_src-31bdbfefd2847efaf171c5e464510c779b5be573.zip chromium_src-31bdbfefd2847efaf171c5e464510c779b5be573.tar.gz chromium_src-31bdbfefd2847efaf171c5e464510c779b5be573.tar.bz2 |
Extension/Platform App window isolation
Hide platform app windows from extensions, and hide all windows that don't
belong to the current app from apps.
Review URL: https://chromiumcodereview.appspot.com/10407035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function.cc')
-rw-r--r-- | chrome/browser/extensions/extension_function.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index f42910a..614f342c 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -219,12 +219,24 @@ UIThreadExtensionFunction::GetExtensionWindowController() { if (window_controller) return window_controller; - Profile* profile = Profile::FromBrowserContext( - render_view_host_->GetProcess()->GetBrowserContext()); - ExtensionWindowList::ProfileMatchType match_type = include_incognito_ - ? ExtensionWindowController::MATCH_INCOGNITO - : ExtensionWindowController::MATCH_NORMAL_ONLY; - return ExtensionWindowList::GetInstance()->CurrentWindow(profile, match_type); + return ExtensionWindowList::GetInstance()->CurrentWindowForFunction(this); +} + +bool UIThreadExtensionFunction::CanOperateOnWindow( + const ExtensionWindowController* window_controller) const { + const extensions::Extension* extension = GetExtension(); + // |extension| is NULL for unit tests only. + if (extension != NULL && !window_controller->IsVisibleToExtension(extension)) + return false; + + if (profile() == window_controller->profile()) + return true; + + if (!include_incognito()) + return false; + + return profile()->HasOffTheRecordProfile() && + profile()->GetOffTheRecordProfile() == window_controller->profile(); } void UIThreadExtensionFunction::SendResponse(bool success) { |