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 | |
14 class ExtensionWindowController; | |
15 class Profile; | |
16 | |
17 // Class to maintain a list of ExtensionWindowControllers. | |
18 class ExtensionWindowList { | |
19 public: | |
20 typedef std::list<ExtensionWindowController*> WindowList; | |
21 | |
22 ExtensionWindowList(); | |
23 | |
24 void AddExtensionWindow(ExtensionWindowController* window); | |
25 void RemoveExtensionWindow(ExtensionWindowController* window); | |
26 | |
27 // Returns a window matching the profile and id, or NULL. | |
28 ExtensionWindowController* FindWindowById(Profile* profile, | |
29 bool include_incognito, | |
sky
2012/02/24 04:38:24
nit: use enum here and every where else.
| |
30 int id) const; | |
31 | |
32 // Returns the focused or last added window matching the profile, or NULL. | |
jennb
2012/02/24 05:18:43
nit: extra space after 'added'
stevenjb
2012/02/24 19:25:06
Done.
| |
33 ExtensionWindowController* CurrentWindow(Profile* profile, | |
34 bool include_incognito) const; | |
35 | |
36 // Returns the focused window matching the profile, or NULL. | |
37 ExtensionWindowController* FocusedWindow(Profile* profile, | |
38 bool include_incognito) const; | |
39 | |
40 const WindowList& windows() const { return windows_; } | |
41 | |
42 static ExtensionWindowList* GetInstance(); | |
43 | |
44 private: | |
45 friend struct DefaultSingletonTraits<ExtensionWindowList>; | |
46 | |
47 // Entries are not owned by this class and must be removed when destroyed. | |
48 WindowList windows_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(ExtensionWindowList); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_LIST_H_ | |
OLD | NEW |