OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/singleton.h" |
| 12 #include "chrome/browser/extensions/window_controller.h" |
| 13 |
| 14 class Profile; |
| 15 class UIThreadExtensionFunction; |
| 16 |
| 17 namespace extensions { |
| 18 |
| 19 // Class to maintain a list of WindowControllers. |
| 20 class WindowControllerList { |
| 21 public: |
| 22 typedef std::list<WindowController*> ControllerList; |
| 23 |
| 24 WindowControllerList(); |
| 25 ~WindowControllerList(); |
| 26 |
| 27 void AddExtensionWindow(WindowController* window); |
| 28 void RemoveExtensionWindow(WindowController* window); |
| 29 |
| 30 // Returns a window matching the context the function was invoked in. |
| 31 WindowController* FindWindowForFunctionById( |
| 32 const UIThreadExtensionFunction* function, |
| 33 int id) const; |
| 34 |
| 35 // Returns the focused or last added window matching the context the function |
| 36 // was invoked in. |
| 37 WindowController* CurrentWindowForFunction( |
| 38 const UIThreadExtensionFunction* function) const; |
| 39 |
| 40 const ControllerList& windows() const { return windows_; } |
| 41 |
| 42 static WindowControllerList* GetInstance(); |
| 43 |
| 44 private: |
| 45 friend struct DefaultSingletonTraits<WindowControllerList>; |
| 46 |
| 47 // Entries are not owned by this class and must be removed when destroyed. |
| 48 ControllerList windows_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); |
| 51 }; |
| 52 |
| 53 } // namespace extensions |
| 54 |
| 55 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ |
OLD | NEW |