| 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..7c9a961ebb06516e94811c4bb687bc579717b504 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 (auto& window_type : types)
|
| + filter |= 1 << window_type;
|
| + 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
|
|
|