Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/extensions/window_controller_list.h

Issue 10777004: Support chrome.windows extension API events for browserless Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/observer_list.h"
12 #include "chrome/browser/extensions/window_controller.h" 13 #include "chrome/browser/extensions/window_controller.h"
13 14
14 class Profile; 15 class Profile;
15 class UIThreadExtensionFunction; 16 class UIThreadExtensionFunction;
16 17
17 namespace extensions { 18 namespace extensions {
18 19
20 class WindowControllerListObserver;
21
19 // Class to maintain a list of WindowControllers. 22 // Class to maintain a list of WindowControllers.
20 class WindowControllerList { 23 class WindowControllerList {
21 public: 24 public:
22 typedef std::list<WindowController*> ControllerList; 25 typedef std::list<WindowController*> ControllerList;
23 26
24 WindowControllerList(); 27 WindowControllerList();
25 ~WindowControllerList(); 28 ~WindowControllerList();
26 29
27 void AddExtensionWindow(WindowController* window); 30 void AddExtensionWindow(WindowController* window);
28 void RemoveExtensionWindow(WindowController* window); 31 void RemoveExtensionWindow(WindowController* window);
29 32
33 void AddObserver(WindowControllerListObserver* observer);
34 void RemoveObserver(WindowControllerListObserver* observer);
35
30 // Returns a window matching the context the function was invoked in. 36 // Returns a window matching the context the function was invoked in.
31 WindowController* FindWindowForFunctionById( 37 WindowController* FindWindowForFunctionById(
32 const UIThreadExtensionFunction* function, 38 const UIThreadExtensionFunction* function,
33 int id) const; 39 int id) const;
34 40
35 // Returns the focused or last added window matching the context the function 41 // Returns the focused or last added window matching the context the function
36 // was invoked in. 42 // was invoked in.
37 WindowController* CurrentWindowForFunction( 43 WindowController* CurrentWindowForFunction(
38 const UIThreadExtensionFunction* function) const; 44 const UIThreadExtensionFunction* function) const;
39 45
40 const ControllerList& windows() const { return windows_; } 46 const ControllerList& windows() const { return windows_; }
41 47
42 static WindowControllerList* GetInstance(); 48 static WindowControllerList* GetInstance();
43 49
44 private: 50 private:
45 friend struct DefaultSingletonTraits<WindowControllerList>; 51 friend struct DefaultSingletonTraits<WindowControllerList>;
46 52
47 // Entries are not owned by this class and must be removed when destroyed. 53 // Entries are not owned by this class and must be removed when destroyed.
48 ControllerList windows_; 54 ControllerList windows_;
49 55
56 ObserverList<WindowControllerListObserver> observers_;
57
50 DISALLOW_COPY_AND_ASSIGN(WindowControllerList); 58 DISALLOW_COPY_AND_ASSIGN(WindowControllerList);
51 }; 59 };
52 60
53 } // namespace extensions 61 } // namespace extensions
54 62
55 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_ 63 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_LIST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/window_controller.cc ('k') | chrome/browser/extensions/window_controller_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698