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

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

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More filters completely into WindowController Created 5 years, 4 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/window_controller.h ('k') | chrome/browser/extensions/window_controller_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/extensions/window_controller.h ('k') | chrome/browser/extensions/window_controller_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698