OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/window_controller.h" | 5 #include "chrome/browser/extensions/window_controller.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 8 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
9 #include "chrome/browser/extensions/window_controller_list.h" | 9 #include "chrome/browser/extensions/window_controller_list.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/extensions/api/windows.h" | 11 #include "chrome/common/extensions/api/windows.h" |
12 #include "ui/base/base_window.h" | 12 #include "ui/base/base_window.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
18 // WindowController | 18 // WindowController |
19 | 19 |
20 // static | 20 // static |
21 WindowController::TypeFilter WindowController::GetAllWindowFilter() { | 21 WindowController::TypeFilter WindowController::GetAllWindowFilter() { |
22 // This needs to be updated if there is a change to | 22 // This needs to be updated if there is a change to |
23 // extensions::api::windows:WindowType. | 23 // extensions::api::windows:WindowType. |
24 COMPILE_ASSERT(api::windows::WINDOW_TYPE_LAST == 5, | 24 static_assert(api::windows::WINDOW_TYPE_LAST == 5, |
25 Update_extensions_WindowController_to_match_WindowType); | 25 "Update extensions WindowController to match WindowType"); |
26 return ((1 << api::windows::WINDOW_TYPE_NORMAL) | | 26 return ((1 << api::windows::WINDOW_TYPE_NORMAL) | |
27 (1 << api::windows::WINDOW_TYPE_PANEL) | | 27 (1 << api::windows::WINDOW_TYPE_PANEL) | |
28 (1 << api::windows::WINDOW_TYPE_POPUP) | | 28 (1 << api::windows::WINDOW_TYPE_POPUP) | |
29 (1 << api::windows::WINDOW_TYPE_APP) | | 29 (1 << api::windows::WINDOW_TYPE_APP) | |
30 (1 << api::windows::WINDOW_TYPE_DEVTOOLS)); | 30 (1 << api::windows::WINDOW_TYPE_DEVTOOLS)); |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 WindowController::TypeFilter WindowController::GetFilterFromWindowTypes( | 34 WindowController::TypeFilter WindowController::GetFilterFromWindowTypes( |
35 const std::vector<api::windows::WindowType>& types) { | 35 const std::vector<api::windows::WindowType>& types) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 return result; | 100 return result; |
101 } | 101 } |
102 | 102 |
103 bool WindowController::MatchesFilter(TypeFilter filter) const { | 103 bool WindowController::MatchesFilter(TypeFilter filter) const { |
104 TypeFilter type = 1 << api::windows::ParseWindowType(GetWindowTypeText()); | 104 TypeFilter type = 1 << api::windows::ParseWindowType(GetWindowTypeText()); |
105 return (type & filter) != 0; | 105 return (type & filter) != 0; |
106 } | 106 } |
107 | 107 |
108 } // namespace extensions | 108 } // namespace extensions |
OLD | NEW |