OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
7 | 7 |
8 #include "chrome/common/extensions/api/windows.h" | |
9 | |
8 class UIThreadExtensionFunction; | 10 class UIThreadExtensionFunction; |
9 | 11 |
12 namespace content { | |
13 class BrowserContext; | |
14 } | |
15 | |
10 namespace extensions { | 16 namespace extensions { |
17 class Extension; | |
11 class WindowController; | 18 class WindowController; |
12 } | 19 } |
13 | 20 |
14 namespace windows_util { | 21 namespace windows_util { |
15 | 22 |
23 namespace windows = extensions::api::windows; | |
24 | |
25 const std::vector<windows::WindowType>& GetDefaultWindowTypeFilters(); | |
26 | |
27 const std::vector<windows::WindowType>& GetNoWindowTypeFilters(); | |
stevenjb
2015/07/30 19:00:37
We should typedef std::vector<windows::WindowType>
llandwerlin-old
2015/07/31 13:58:32
Done in WindowControllerList.
I kept vector<> bec
stevenjb
2015/07/31 17:27:16
I think a copy might be slightly cheaper than the
llandwerlin-old
2015/08/03 10:11:54
Switching to converting the array to a bit field.
| |
28 | |
29 bool WindowMatchesTypeFilter(const extensions::WindowController* controller, | |
30 const std::vector<windows::WindowType>& filters); | |
31 | |
16 // Populates |controller| for given |window_id|. If the window is not found, | 32 // Populates |controller| for given |window_id|. If the window is not found, |
17 // returns false and sets UIThreadExtensionFunction error_. | 33 // returns false and sets UIThreadExtensionFunction error_. |
18 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, | 34 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, |
19 int window_id, | 35 int window_id, |
36 const std::vector<windows::WindowType>& type_filter, | |
20 extensions::WindowController** controller); | 37 extensions::WindowController** controller); |
21 | 38 |
22 // Returns true if |function| (and the profile and extension that it was | 39 // Returns true if |function| (and the profile and extension that it was |
23 // invoked from) can operate on the window wrapped by |window_controller|. | 40 // invoked from) can operate on the window wrapped by |window_controller|. |
41 // If |all_window_types| is set this function will return true for any | |
42 // kind of window (including app and devtools), otherwise it will | |
43 // return true only for normal browser windows as well as windows | |
44 // created by the extension. | |
24 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, | 45 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, |
25 const extensions::WindowController* controller); | 46 const extensions::WindowController* controller, |
47 const std::vector<windows::WindowType>& type_filter); | |
48 | |
49 // Same as |CanOperateOnWindow| but uses |extension| and |browser_context| | |
50 // instead of a UIThreadExtensionFunction. | |
51 bool ExtensionCanOperateOnWindow( | |
52 const extensions::Extension* extension, | |
53 content::BrowserContext* browser_context, | |
54 const extensions::WindowController* controller, | |
55 const std::vector<windows::WindowType>& type_filter); | |
26 | 56 |
27 } // namespace windows_util | 57 } // namespace windows_util |
28 | 58 |
29 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 59 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
OLD | NEW |