| 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 // Converts an array of window types given by the chrome.windows APIs |
| 25 // to a WindowTypeFilter. |
| 26 extensions::WindowTypeFilter WindowTypeFilterFromWindowTypes( |
| 27 const std::vector<extensions::api::windows::WindowType>& types); |
| 28 |
| 16 // Populates |controller| for given |window_id|. If the window is not found, | 29 // Populates |controller| for given |window_id|. If the window is not found, |
| 17 // returns false and sets UIThreadExtensionFunction error_. | 30 // returns false and sets UIThreadExtensionFunction error_. |
| 18 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, | 31 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, |
| 19 int window_id, | 32 int window_id, |
| 33 extensions::WindowTypeFilter filter, |
| 20 extensions::WindowController** controller); | 34 extensions::WindowController** controller); |
| 21 | 35 |
| 22 // Returns true if |function| (and the profile and extension that it was | 36 // Returns true if |function| (and the profile and extension that it was |
| 23 // invoked from) can operate on the window wrapped by |window_controller|. | 37 // invoked from) can operate on the window wrapped by |window_controller|. |
| 38 // If |all_window_types| is set this function will return true for any |
| 39 // kind of window (including app and devtools), otherwise it will |
| 40 // return true only for normal browser windows as well as windows |
| 41 // created by the extension. |
| 24 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, | 42 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, |
| 25 const extensions::WindowController* controller); | 43 const extensions::WindowController* controller, |
| 44 extensions::WindowTypeFilter filter); |
| 26 | 45 |
| 27 } // namespace windows_util | 46 } // namespace windows_util |
| 28 | 47 |
| 29 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 48 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
| OLD | NEW |