Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3238)

Unified Diff: chrome/browser/extensions/extension_function.cc

Issue 10407035: Extension/Platform App window isolation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add "ForFunction" Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_function.h ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_function.cc
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc
index f42910a795542a72229d4421d13608e5f5c0a4da..614f342c76c1727feaa6b7f79f4816d6ff394a4d 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) {
« no previous file with comments | « chrome/browser/extensions/extension_function.h ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698