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 ASH_SHELL_WINDOW_WATCHER_H_ | 5 #ifndef ASH_SHELL_WINDOW_WATCHER_H_ |
6 #define ASH_SHELL_WINDOW_WATCHER_H_ | 6 #define ASH_SHELL_WINDOW_WATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/launcher/launcher_types.h" | 10 #include "ash/launcher/launcher_types.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
14 | 15 |
15 namespace aura { | 16 namespace aura { |
16 class Window; | 17 class Window; |
17 } | 18 } |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 namespace shell { | 21 namespace shell { |
21 | 22 |
| 23 // TODO(sky): fix this class, its a bit broke with workspace2. |
| 24 |
22 // WindowWatcher is responsible for listening for newly created windows and | 25 // WindowWatcher is responsible for listening for newly created windows and |
23 // creating items on the Launcher for them. | 26 // creating items on the Launcher for them. |
24 class WindowWatcher : public aura::WindowObserver { | 27 class WindowWatcher : public aura::WindowObserver { |
25 public: | 28 public: |
26 WindowWatcher(); | 29 WindowWatcher(); |
27 virtual ~WindowWatcher(); | 30 virtual ~WindowWatcher(); |
28 | 31 |
29 aura::Window* GetWindowByID(ash::LauncherID id); | 32 aura::Window* GetWindowByID(ash::LauncherID id); |
30 ash::LauncherID GetIDByWindow(aura::Window* window) const; | 33 ash::LauncherID GetIDByWindow(aura::Window* window) const; |
31 | 34 |
32 // aura::WindowObserver overrides: | 35 // aura::WindowObserver overrides: |
33 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; | 36 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; |
34 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | 37 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; |
35 | 38 |
36 private: | 39 private: |
| 40 class WorkspaceWindowWatcher; |
| 41 |
37 typedef std::map<ash::LauncherID, aura::Window*> IDToWindow; | 42 typedef std::map<ash::LauncherID, aura::Window*> IDToWindow; |
38 | 43 |
39 // Window watching for newly created windows to be added to. | 44 // Window watching for newly created windows to be added to. |
40 aura::Window* window_; | 45 aura::Window* window_; |
41 | 46 |
42 aura::Window* panel_container_; | 47 aura::Window* panel_container_; |
43 | 48 |
44 // Maps from window to the id we gave it. | 49 // Maps from window to the id we gave it. |
45 IDToWindow id_to_window_; | 50 IDToWindow id_to_window_; |
46 | 51 |
| 52 scoped_ptr<WorkspaceWindowWatcher> workspace_window_watcher_; |
| 53 |
47 DISALLOW_COPY_AND_ASSIGN(WindowWatcher); | 54 DISALLOW_COPY_AND_ASSIGN(WindowWatcher); |
48 }; | 55 }; |
49 | 56 |
50 } // namespace shell | 57 } // namespace shell |
51 } // namespace ash | 58 } // namespace ash |
52 | 59 |
53 #endif // ASH_SHELL_WINDOW_WATCHER_H_ | 60 #endif // ASH_SHELL_WINDOW_WATCHER_H_ |
OLD | NEW |