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

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

Issue 10407035: Extension/Platform App window isolation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests 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
Index: chrome/browser/extensions/extension_window_controller.cc
diff --git a/chrome/browser/extensions/extension_window_controller.cc b/chrome/browser/extensions/extension_window_controller.cc
index 90ad89fd00a9e2c6aa6e75403d98a0c3b3543ab1..eb51cde559aeb43a51948239d1b8bc4cd08aa2fc 100644
--- a/chrome/browser/extensions/extension_window_controller.cc
+++ b/chrome/browser/extensions/extension_window_controller.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_window_controller.h"
#include "base/values.h"
+#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
#include "chrome/browser/extensions/extension_window_list.h"
#include "chrome/browser/profiles/profile.h"
@@ -25,13 +26,21 @@ ExtensionWindowController::~ExtensionWindowController() {
ExtensionWindowList::GetInstance()->RemoveExtensionWindow(this);
}
-bool ExtensionWindowController::MatchesProfile(
- Profile* match_profile,
- ProfileMatchType match_type) const {
- return ((profile_ == match_profile) ||
- (match_type == MATCH_INCOGNITO &&
- (match_profile->HasOffTheRecordProfile() &&
- match_profile->GetOffTheRecordProfile() == profile_)));
+bool ExtensionWindowController::IsVisibleToFunction(
+ UIThreadExtensionFunction* function) const {
stevenjb 2012/05/21 19:22:52 It seems like this might be better if this were in
Mihai Parparita -not on Chrome 2012/05/21 21:10:06 Done.
+ const Extension* extension = function->GetExtension();
+ // |extension| is NULL for unit tests only.
+ if (extension != NULL && !IsVisibleToExtension(function->GetExtension()))
stevenjb 2012/05/21 19:22:52 This would become window->IsVisibleToExtension(Get
+ return false;
+
+ if (function->profile() == profile_)
stevenjb 2012/05/21 19:22:52 profile() == window->profile()
+ return true;
+
+ if (!function->include_incognito())
+ return false;
+
+ return function->profile()->HasOffTheRecordProfile() &&
+ function->profile()->GetOffTheRecordProfile() == profile_;
stevenjb 2012/05/21 19:22:52 The above has more to do with function than with w
}
Browser* ExtensionWindowController::GetBrowser() const {
« no previous file with comments | « chrome/browser/extensions/extension_window_controller.h ('k') | chrome/browser/extensions/extension_window_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698