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/browser/extensions/window_controller_list.h" | |
9 #include "chrome/common/extensions/api/windows.h" | |
10 | |
8 class UIThreadExtensionFunction; | 11 class UIThreadExtensionFunction; |
9 | 12 |
13 namespace content { | |
14 class BrowserContext; | |
15 } | |
16 | |
10 namespace extensions { | 17 namespace extensions { |
18 class Extension; | |
11 class WindowController; | 19 class WindowController; |
12 } | 20 } |
13 | 21 |
14 namespace windows_util { | 22 namespace windows_util { |
15 | 23 |
24 const extensions::WindowTypeFilter& GetDefaultWindowTypeFilters(); | |
25 | |
26 const extensions::WindowTypeFilter& GetNoWindowTypeFilters(); | |
not at google - send to devlin
2015/07/31 21:48:03
Could you comment all of these new functions?
llandwerlin-old
2015/08/03 10:11:54
Done.
| |
27 | |
28 bool WindowMatchesTypeFilter(const extensions::WindowController* controller, | |
29 const extensions::WindowTypeFilter& filters); | |
30 | |
16 // Populates |controller| for given |window_id|. If the window is not found, | 31 // Populates |controller| for given |window_id|. If the window is not found, |
17 // returns false and sets UIThreadExtensionFunction error_. | 32 // returns false and sets UIThreadExtensionFunction error_. |
18 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, | 33 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, |
19 int window_id, | 34 int window_id, |
35 const extensions::WindowTypeFilter& type_filter, | |
20 extensions::WindowController** controller); | 36 extensions::WindowController** controller); |
21 | 37 |
22 // Returns true if |function| (and the profile and extension that it was | 38 // Returns true if |function| (and the profile and extension that it was |
23 // invoked from) can operate on the window wrapped by |window_controller|. | 39 // invoked from) can operate on the window wrapped by |window_controller|. |
40 // If |all_window_types| is set this function will return true for any | |
41 // kind of window (including app and devtools), otherwise it will | |
42 // return true only for normal browser windows as well as windows | |
43 // created by the extension. | |
24 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, | 44 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, |
25 const extensions::WindowController* controller); | 45 const extensions::WindowController* controller, |
46 const extensions::WindowTypeFilter& type_filter); | |
47 | |
48 // Same as |CanOperateOnWindow| but uses |extension| and |browser_context| | |
49 // instead of a UIThreadExtensionFunction. | |
50 bool ExtensionCanOperateOnWindow( | |
51 const extensions::Extension* extension, | |
52 content::BrowserContext* browser_context, | |
not at google - send to devlin
2015/07/31 21:48:03
I'd just change CanOperateOnWindow to take a Brows
llandwerlin-old
2015/08/03 10:11:54
Sorry, this isn't used anymore. Removing.
| |
53 const extensions::WindowController* controller, | |
54 const extensions::WindowTypeFilter& type_filter); | |
26 | 55 |
27 } // namespace windows_util | 56 } // namespace windows_util |
28 | 57 |
29 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 58 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
OLD | NEW |