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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 16 matching lines...) Expand all Loading... |
27 // TODO(sky): fix this class, its a bit broke with workspace2. | 27 // TODO(sky): fix this class, its a bit broke with workspace2. |
28 | 28 |
29 // WindowWatcher is responsible for listening for newly created windows and | 29 // WindowWatcher is responsible for listening for newly created windows and |
30 // creating items on the Shelf for them. | 30 // creating items on the Shelf for them. |
31 class WindowWatcher : public aura::WindowObserver, | 31 class WindowWatcher : public aura::WindowObserver, |
32 public display::DisplayObserver { | 32 public display::DisplayObserver { |
33 public: | 33 public: |
34 WindowWatcher(); | 34 WindowWatcher(); |
35 ~WindowWatcher() override; | 35 ~WindowWatcher() override; |
36 | 36 |
37 aura::Window* GetWindowByID(ash::ShelfID id); | 37 aura::Window* GetWindowByID(const ShelfID& id); |
38 | 38 |
39 // aura::WindowObserver overrides: | 39 // aura::WindowObserver overrides: |
40 void OnWindowAdded(aura::Window* new_window) override; | 40 void OnWindowAdded(aura::Window* new_window) override; |
41 void OnWillRemoveWindow(aura::Window* window) override; | 41 void OnWillRemoveWindow(aura::Window* window) override; |
42 | 42 |
43 // display::DisplayObserver overrides: | 43 // display::DisplayObserver overrides: |
44 void OnDisplayAdded(const display::Display& new_display) override; | 44 void OnDisplayAdded(const display::Display& new_display) override; |
45 void OnDisplayRemoved(const display::Display& old_display) override; | 45 void OnDisplayRemoved(const display::Display& old_display) override; |
46 void OnDisplayMetricsChanged(const display::Display& display, | 46 void OnDisplayMetricsChanged(const display::Display& display, |
47 uint32_t metrics) override; | 47 uint32_t metrics) override; |
48 | 48 |
49 private: | 49 private: |
50 class WorkspaceWindowWatcher; | 50 class WorkspaceWindowWatcher; |
51 | 51 |
52 typedef std::map<ash::ShelfID, aura::Window*> IDToWindow; | 52 typedef std::map<ShelfID, aura::Window*> IDToWindow; |
53 | 53 |
54 // Maps from window to the id we gave it. | 54 // Maps from window to the id we gave it. |
55 IDToWindow id_to_window_; | 55 IDToWindow id_to_window_; |
56 | 56 |
57 std::unique_ptr<WorkspaceWindowWatcher> workspace_window_watcher_; | 57 std::unique_ptr<WorkspaceWindowWatcher> workspace_window_watcher_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(WindowWatcher); | 59 DISALLOW_COPY_AND_ASSIGN(WindowWatcher); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace shell | 62 } // namespace shell |
63 } // namespace ash | 63 } // namespace ash |
64 | 64 |
65 #endif // ASH_SHELL_WINDOW_WATCHER_H_ | 65 #endif // ASH_SHELL_WINDOW_WATCHER_H_ |
OLD | NEW |