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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__
8 #include "chrome/browser/extensions/window_controller_list.h"
10 class UIThreadExtensionFunction
;
16 namespace extensions
{
18 class WindowController
;
21 namespace windows_util
{
23 // Populates |controller| for given |window_id|. If the window is not found,
24 // returns false and sets UIThreadExtensionFunction error_.
25 bool GetWindowFromWindowID(UIThreadExtensionFunction
* function
,
27 extensions::WindowController::TypeFilter filter
,
28 extensions::WindowController
** controller
);
30 // 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 // 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 // return true only for normal browser windows as well as windows
35 // created by the extension.
36 bool CanOperateOnWindow(const UIThreadExtensionFunction
* function
,
37 const extensions::WindowController
* controller
,
38 extensions::WindowController::TypeFilter filter
);
40 } // namespace windows_util
42 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__