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_EXTENSION_WINDOW_LIST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_LIST_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <list> |
| 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/singleton.h" |
| 13 #include "chrome/browser/extensions/extension_window_controller.h" |
| 14 |
| 15 class Profile; |
| 16 |
| 17 // Class to maintain a list of ExtensionWindowControllers. |
| 18 class ExtensionWindowList { |
| 19 public: |
| 20 typedef std::list<ExtensionWindowController*> WindowList; |
| 21 typedef ExtensionWindowController::ProfileMatchType ProfileMatchType; |
| 22 |
| 23 ExtensionWindowList(); |
| 24 ~ExtensionWindowList(); |
| 25 |
| 26 void AddExtensionWindow(ExtensionWindowController* window); |
| 27 void RemoveExtensionWindow(ExtensionWindowController* window); |
| 28 |
| 29 // Returns a window matching the profile and id, or NULL. |
| 30 ExtensionWindowController* FindWindowById(Profile* profile, |
| 31 ProfileMatchType match_type, |
| 32 int id) const; |
| 33 |
| 34 // Returns the focused or last added window matching the profile, or NULL. |
| 35 ExtensionWindowController* CurrentWindow(Profile* profile, |
| 36 ProfileMatchType match_type) const; |
| 37 |
| 38 const WindowList& windows() const { return windows_; } |
| 39 |
| 40 static ExtensionWindowList* GetInstance(); |
| 41 |
| 42 private: |
| 43 friend struct DefaultSingletonTraits<ExtensionWindowList>; |
| 44 |
| 45 // Entries are not owned by this class and must be removed when destroyed. |
| 46 WindowList windows_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(ExtensionWindowList); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_LIST_H_ |
OLD | NEW |