OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHELF_SHELF_WINDOW_WATCHER_H_ | 5 #ifndef ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
6 #define ASH_SHELF_SHELF_WINDOW_WATCHER_H_ | 6 #define ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
7 | 7 |
8 #include "ash/shelf/scoped_observer_with_duplicated_sources.h" | 8 #include "ash/shelf/scoped_observer_with_duplicated_sources.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 virtual ~ShelfWindowWatcher(); | 40 virtual ~ShelfWindowWatcher(); |
41 | 41 |
42 private: | 42 private: |
43 class RootWindowObserver : public aura::WindowObserver { | 43 class RootWindowObserver : public aura::WindowObserver { |
44 public: | 44 public: |
45 explicit RootWindowObserver(ShelfWindowWatcher* window_watcher); | 45 explicit RootWindowObserver(ShelfWindowWatcher* window_watcher); |
46 virtual ~RootWindowObserver(); | 46 virtual ~RootWindowObserver(); |
47 | 47 |
48 private: | 48 private: |
49 // aura::WindowObserver overrides: | 49 // aura::WindowObserver overrides: |
50 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 50 virtual void OnWindowDestroying(aura::Window* window) override; |
51 | 51 |
52 // Owned by Shell. | 52 // Owned by Shell. |
53 ShelfWindowWatcher* window_watcher_; | 53 ShelfWindowWatcher* window_watcher_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(RootWindowObserver); | 55 DISALLOW_COPY_AND_ASSIGN(RootWindowObserver); |
56 }; | 56 }; |
57 | 57 |
58 // Used to track windows that are removed. See description of | 58 // Used to track windows that are removed. See description of |
59 // ShelfWindowWatcher::StartObservingRemovedWindow() for more details. | 59 // ShelfWindowWatcher::StartObservingRemovedWindow() for more details. |
60 class RemovedWindowObserver : public aura::WindowObserver { | 60 class RemovedWindowObserver : public aura::WindowObserver { |
61 public: | 61 public: |
62 explicit RemovedWindowObserver(ShelfWindowWatcher* window_watcher); | 62 explicit RemovedWindowObserver(ShelfWindowWatcher* window_watcher); |
63 virtual ~RemovedWindowObserver(); | 63 virtual ~RemovedWindowObserver(); |
64 | 64 |
65 private: | 65 private: |
66 // aura::WindowObserver overrides: | 66 // aura::WindowObserver overrides: |
67 virtual void OnWindowParentChanged(aura::Window* window, | 67 virtual void OnWindowParentChanged(aura::Window* window, |
68 aura::Window* parent) OVERRIDE; | 68 aura::Window* parent) override; |
69 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 69 virtual void OnWindowDestroyed(aura::Window* window) override; |
70 | 70 |
71 // Owned by Shell. | 71 // Owned by Shell. |
72 ShelfWindowWatcher* window_watcher_; | 72 ShelfWindowWatcher* window_watcher_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); | 74 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); |
75 }; | 75 }; |
76 | 76 |
77 // Creates a ShelfItem for |window| that has ShelfItemDetails. | 77 // Creates a ShelfItem for |window| that has ShelfItemDetails. |
78 void AddShelfItem(aura::Window* window); | 78 void AddShelfItem(aura::Window* window); |
79 | 79 |
(...skipping 17 matching lines...) Expand all Loading... |
97 // remove the shelf item. StartObservingRemovedWindow, if necessary, attaches | 97 // remove the shelf item. StartObservingRemovedWindow, if necessary, attaches |
98 // an observer. When done, FinishObservingRemovedWindow() is invoked. | 98 // an observer. When done, FinishObservingRemovedWindow() is invoked. |
99 void StartObservingRemovedWindow(aura::Window* window); | 99 void StartObservingRemovedWindow(aura::Window* window); |
100 | 100 |
101 // Stop observing |window| by RemovedWindowObserver and remove an item | 101 // Stop observing |window| by RemovedWindowObserver and remove an item |
102 // associated with |window|. | 102 // associated with |window|. |
103 void FinishObservingRemovedWindow(aura::Window* window); | 103 void FinishObservingRemovedWindow(aura::Window* window); |
104 | 104 |
105 // aura::client::ActivationChangeObserver overrides: | 105 // aura::client::ActivationChangeObserver overrides: |
106 virtual void OnWindowActivated(aura::Window* gained_active, | 106 virtual void OnWindowActivated(aura::Window* gained_active, |
107 aura::Window* lost_active) OVERRIDE; | 107 aura::Window* lost_active) override; |
108 | 108 |
109 // aura::WindowObserver overrides: | 109 // aura::WindowObserver overrides: |
110 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; | 110 virtual void OnWindowAdded(aura::Window* window) override; |
111 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | 111 virtual void OnWillRemoveWindow(aura::Window* window) override; |
112 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 112 virtual void OnWindowDestroying(aura::Window* window) override; |
113 virtual void OnWindowPropertyChanged(aura::Window* window, | 113 virtual void OnWindowPropertyChanged(aura::Window* window, |
114 const void* key, | 114 const void* key, |
115 intptr_t old) OVERRIDE; | 115 intptr_t old) override; |
116 | 116 |
117 // gfx::DisplayObserver overrides: | 117 // gfx::DisplayObserver overrides: |
118 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 118 virtual void OnDisplayAdded(const gfx::Display& display) override; |
119 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 119 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; |
120 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 120 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
121 uint32_t metrics) OVERRIDE; | 121 uint32_t metrics) override; |
122 | 122 |
123 // Owned by Shell. | 123 // Owned by Shell. |
124 ShelfModel* model_; | 124 ShelfModel* model_; |
125 ShelfItemDelegateManager* item_delegate_manager_; | 125 ShelfItemDelegateManager* item_delegate_manager_; |
126 | 126 |
127 RootWindowObserver root_window_observer_; | 127 RootWindowObserver root_window_observer_; |
128 | 128 |
129 RemovedWindowObserver removed_window_observer_; | 129 RemovedWindowObserver removed_window_observer_; |
130 | 130 |
131 // Holds all observed windows. | 131 // Holds all observed windows. |
132 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; | 132 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
133 | 133 |
134 // Holds all observed root windows. | 134 // Holds all observed root windows. |
135 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; | 135 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; |
136 | 136 |
137 // Holds removed windows that has an item from default container. | 137 // Holds removed windows that has an item from default container. |
138 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; | 138 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; |
139 | 139 |
140 // Holds all observed activation clients. | 140 // Holds all observed activation clients. |
141 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, | 141 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, |
142 aura::client::ActivationChangeObserver> observed_activation_clients_; | 142 aura::client::ActivationChangeObserver> observed_activation_clients_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); | 144 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace ash | 147 } // namespace ash |
148 | 148 |
149 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ | 149 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
OLD | NEW |