| 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" | 8 #include "chrome/browser/extensions/window_controller_list.h" |
| 9 | 9 |
| 10 class UIThreadExtensionFunction; | 10 class UIThreadExtensionFunction; |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class BrowserContext; | 13 class BrowserContext; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 class Extension; | 17 class Extension; |
| 18 class WindowController; | 18 class WindowController; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace windows_util { | 21 namespace windows_util { |
| 22 | 22 |
| 23 // Populates |controller| for given |window_id|. If the window is not found, | 23 // Populates |controller| for given |window_id|. If the window is not found, |
| 24 // returns false and sets UIThreadExtensionFunction error_. | 24 // returns false and sets |error|. |
| 25 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, | 25 bool GetWindowFromWindowID(UIThreadExtensionFunction* function, |
| 26 int window_id, | 26 int window_id, |
| 27 extensions::WindowController::TypeFilter filter, | 27 extensions::WindowController::TypeFilter filter, |
| 28 extensions::WindowController** controller); | 28 extensions::WindowController** controller, |
| 29 std::string* error); |
| 29 | 30 |
| 30 // Returns true if |function| (and the profile and extension that it was | 31 // Returns true if |function| (and the profile and extension that it was |
| 31 // invoked from) can operate on the window wrapped by |window_controller|. | 32 // invoked from) can operate on the window wrapped by |window_controller|. |
| 32 // If |all_window_types| is set this function will return true for any | 33 // If |all_window_types| is set this function will return true for any |
| 33 // kind of window (including app and devtools), otherwise it will | 34 // kind of window (including app and devtools), otherwise it will |
| 34 // return true only for normal browser windows as well as windows | 35 // return true only for normal browser windows as well as windows |
| 35 // created by the extension. | 36 // created by the extension. |
| 36 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, | 37 bool CanOperateOnWindow(const UIThreadExtensionFunction* function, |
| 37 const extensions::WindowController* controller, | 38 const extensions::WindowController* controller, |
| 38 extensions::WindowController::TypeFilter filter); | 39 extensions::WindowController::TypeFilter filter); |
| 39 | 40 |
| 40 } // namespace windows_util | 41 } // namespace windows_util |
| 41 | 42 |
| 42 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ | 43 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__ |
| OLD | NEW |