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 { |