Index: chrome/browser/extensions/window_controller.cc |
diff --git a/chrome/browser/extensions/window_controller.cc b/chrome/browser/extensions/window_controller.cc |
index 96f9eac9d8bd71810f4f980ccd3ae3c004698ead..88b7587a91e1af1cf8e45327b16885cd13aa35ec 100644 |
--- a/chrome/browser/extensions/window_controller.cc |
+++ b/chrome/browser/extensions/window_controller.cc |
@@ -8,6 +8,7 @@ |
#include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
#include "chrome/browser/extensions/window_controller_list.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/extensions/api/windows.h" |
#include "ui/base/base_window.h" |
#include "ui/gfx/geometry/rect.h" |
@@ -16,6 +17,34 @@ namespace extensions { |
/////////////////////////////////////////////////////////////////////////////// |
// WindowController |
+// static |
+WindowController::TypeFilter WindowController::GetAllWindowFilter() { |
+ // This needs to be updated if there is a change to |
+ // extensions::api::windows:WindowType. |
+ COMPILE_ASSERT(api::windows::WINDOW_TYPE_LAST == 5, |
+ Update_extensions_WindowController_to_match_WindowType); |
+ return ((1 << api::windows::WINDOW_TYPE_NORMAL) | |
+ (1 << api::windows::WINDOW_TYPE_PANEL) | |
+ (1 << api::windows::WINDOW_TYPE_POPUP) | |
+ (1 << api::windows::WINDOW_TYPE_APP) | |
+ (1 << api::windows::WINDOW_TYPE_DEVTOOLS)); |
+} |
+ |
+// static |
+WindowController::TypeFilter WindowController::GetDefaultWindowFilter() { |
+ return ((1 << api::windows::WINDOW_TYPE_NORMAL) | |
+ (1 << api::windows::WINDOW_TYPE_PANEL) | |
+ (1 << api::windows::WINDOW_TYPE_POPUP)); |
+} |
+ |
+WindowController::TypeFilter WindowController::GetFilterFromWindowTypes( |
+ const std::vector<api::windows::WindowType>& types) { |
+ WindowController::TypeFilter filter = 0; |
+ for (unsigned int i = 0; i < types.size(); i++) |
not at google - send to devlin
2015/08/05 18:17:39
size_t not unsigned int, but then again, range-bas
llandwerlin-old
2015/08/05 18:27:18
Done.
|
+ filter |= 1 << types[i]; |
+ return filter; |
+} |
+ |
WindowController::WindowController(ui::BaseWindow* window, Profile* profile) |
: window_(window), profile_(profile) { |
} |
@@ -63,4 +92,9 @@ base::DictionaryValue* WindowController::CreateWindowValue() const { |
return result; |
} |
+bool WindowController::MatchesFilter(TypeFilter filter) const { |
+ TypeFilter type = 1 << api::windows::ParseWindowType(GetWindowTypeText()); |
+ return (type & filter) != 0; |
+} |
+ |
} // namespace extensions |