OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WINDOW_CONTROLLER_LIST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 void AddExtensionWindow(WindowController* window); | 30 void AddExtensionWindow(WindowController* window); |
31 void RemoveExtensionWindow(WindowController* window); | 31 void RemoveExtensionWindow(WindowController* window); |
32 | 32 |
33 void AddObserver(WindowControllerListObserver* observer); | 33 void AddObserver(WindowControllerListObserver* observer); |
34 void RemoveObserver(WindowControllerListObserver* observer); | 34 void RemoveObserver(WindowControllerListObserver* observer); |
35 | 35 |
36 // Returns a window matching |id|. | 36 // Returns a window matching |id|. |
37 WindowController* FindWindowById(int id) const; | 37 WindowController* FindWindowById(int id) const; |
38 | 38 |
| 39 // Returns a window matching |id| using |filter|. |
| 40 WindowController* FindWindowByIdWithFilter(int id, |
| 41 WindowTypeFilter filter) const; |
| 42 |
39 // Returns a window matching the context the function was invoked in. | 43 // Returns a window matching the context the function was invoked in. |
40 WindowController* FindWindowForFunctionById( | 44 WindowController* FindWindowForFunctionById( |
41 const UIThreadExtensionFunction* function, | 45 const UIThreadExtensionFunction* function, |
42 int id) const; | 46 int id) const; |
43 | 47 |
| 48 // Returns a window matching the context the function was invoked in |
| 49 // using |filter|. |
| 50 WindowController* FindWindowForFunctionByIdWithFilter( |
| 51 const UIThreadExtensionFunction* function, |
| 52 int id, |
| 53 WindowTypeFilter filter) const; |
| 54 |
44 // Returns the focused or last added window matching the context the function | 55 // Returns the focused or last added window matching the context the function |
45 // was invoked in. | 56 // was invoked in. |
46 WindowController* CurrentWindowForFunction( | 57 WindowController* CurrentWindowForFunction( |
47 const UIThreadExtensionFunction* function) const; | 58 const UIThreadExtensionFunction* function) const; |
48 | 59 |
| 60 // Returns the focused or last added window matching the context the function |
| 61 // was invoked in using |filter|. |
| 62 WindowController* CurrentWindowForFunctionWithFilter( |
| 63 const UIThreadExtensionFunction* function, |
| 64 WindowTypeFilter filter) const; |
| 65 |
49 const ControllerList& windows() const { return windows_; } | 66 const ControllerList& windows() const { return windows_; } |
50 | 67 |
51 static WindowControllerList* GetInstance(); | 68 static WindowControllerList* GetInstance(); |
52 | 69 |
53 private: | 70 private: |
54 friend struct DefaultSingletonTraits<WindowControllerList>; | 71 friend struct DefaultSingletonTraits<WindowControllerList>; |
55 | 72 |
56 // Entries are not owned by this class and must be removed when destroyed. | 73 // Entries are not owned by this class and must be removed when destroyed. |
57 ControllerList windows_; | 74 ControllerList windows_; |
58 | 75 |
59 base::ObserverList<WindowControllerListObserver> observers_; | 76 base::ObserverList<WindowControllerListObserver> observers_; |
60 | 77 |
61 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); | 78 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); |
62 }; | 79 }; |
63 | 80 |
64 } // namespace extensions | 81 } // namespace extensions |
65 | 82 |
66 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ | 83 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
OLD | NEW |