| 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( |
| 41 int id, |
| 42 WindowController::TypeFilter filter) const; |
| 43 |
| 39 // Returns a window matching the context the function was invoked in. | 44 // Returns a window matching the context the function was invoked in. |
| 40 WindowController* FindWindowForFunctionById( | 45 WindowController* FindWindowForFunctionById( |
| 41 const UIThreadExtensionFunction* function, | 46 const UIThreadExtensionFunction* function, |
| 42 int id) const; | 47 int id) const; |
| 43 | 48 |
| 49 // Returns a window matching the context the function was invoked in |
| 50 // using |filter|. |
| 51 WindowController* FindWindowForFunctionByIdWithFilter( |
| 52 const UIThreadExtensionFunction* function, |
| 53 int id, |
| 54 WindowController::TypeFilter filter) const; |
| 55 |
| 44 // Returns the focused or last added window matching the context the function | 56 // Returns the focused or last added window matching the context the function |
| 45 // was invoked in. | 57 // was invoked in. |
| 46 WindowController* CurrentWindowForFunction( | 58 WindowController* CurrentWindowForFunction( |
| 47 const UIThreadExtensionFunction* function) const; | 59 const UIThreadExtensionFunction* function) const; |
| 48 | 60 |
| 61 // Returns the focused or last added window matching the context the function |
| 62 // was invoked in using |filter|. |
| 63 WindowController* CurrentWindowForFunctionWithFilter( |
| 64 const UIThreadExtensionFunction* function, |
| 65 WindowController::TypeFilter filter) const; |
| 66 |
| 49 const ControllerList& windows() const { return windows_; } | 67 const ControllerList& windows() const { return windows_; } |
| 50 | 68 |
| 51 static WindowControllerList* GetInstance(); | 69 static WindowControllerList* GetInstance(); |
| 52 | 70 |
| 53 private: | 71 private: |
| 54 friend struct DefaultSingletonTraits<WindowControllerList>; | 72 friend struct DefaultSingletonTraits<WindowControllerList>; |
| 55 | 73 |
| 56 // Entries are not owned by this class and must be removed when destroyed. | 74 // Entries are not owned by this class and must be removed when destroyed. |
| 57 ControllerList windows_; | 75 ControllerList windows_; |
| 58 | 76 |
| 59 base::ObserverList<WindowControllerListObserver> observers_; | 77 base::ObserverList<WindowControllerListObserver> observers_; |
| 60 | 78 |
| 61 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); | 79 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); |
| 62 }; | 80 }; |
| 63 | 81 |
| 64 } // namespace extensions | 82 } // namespace extensions |
| 65 | 83 |
| 66 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
| OLD | NEW |