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_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ |
6 #define ASH_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ | 6 #define ASH_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ |
7 | 7 |
8 #include <set> | |
9 | |
8 #include "ash/common/wm_activation_observer.h" | 10 #include "ash/common/wm_activation_observer.h" |
9 #include "ash/common/wm_window_observer.h" | 11 #include "ash/common/wm_window_observer.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
12 #include "ui/display/display_observer.h" | 14 #include "ui/display/display_observer.h" |
13 | 15 |
14 namespace ash { | 16 namespace ash { |
15 | 17 |
16 class ShelfModel; | 18 class ShelfModel; |
17 class WmWindow; | 19 class WmWindow; |
18 | 20 |
19 // ShelfWindowWatcher creates and handles a ShelfItem for windows in the default | 21 // ShelfWindowWatcher creates and handles a ShelfItem for windows in the default |
20 // container that have a valid ShelfItemType property (e.g. the task manager | 22 // container that have a valid ShelfItemType property (e.g. the task manager |
21 // dialog or the OS settings window). It adds the ShelfItem when the window is | 23 // dialog or the OS settings window). It adds the ShelfItem when the window is |
22 // added to the default container and maintains it until the window is closed, | 24 // added to the default container and maintains it until the window is closed, |
23 // even if the window is transiently reparented (e.g. during a drag). | 25 // even if the window is transiently reparented (e.g. during a drag). |
James Cook
2016/11/02 17:53:44
nit: update comment to say it handles panels also
msw
2016/11/10 21:07:46
Done.
| |
24 class ShelfWindowWatcher : public WmActivationObserver, | 26 class ShelfWindowWatcher : public WmActivationObserver, |
25 public display::DisplayObserver { | 27 public display::DisplayObserver { |
26 public: | 28 public: |
27 explicit ShelfWindowWatcher(ShelfModel* model); | 29 explicit ShelfWindowWatcher(ShelfModel* model); |
28 ~ShelfWindowWatcher() override; | 30 ~ShelfWindowWatcher() override; |
29 | 31 |
30 private: | 32 private: |
31 // Observes for windows being added to a root window's default container. | 33 // Observes for windows being added to a root window's default container. |
32 class ContainerWindowObserver : public WmWindowObserver { | 34 class ContainerWindowObserver : public WmWindowObserver { |
33 public: | 35 public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 uint32_t metrics) override; | 101 uint32_t metrics) override; |
100 | 102 |
101 ShelfModel* model_; | 103 ShelfModel* model_; |
102 | 104 |
103 ContainerWindowObserver container_window_observer_; | 105 ContainerWindowObserver container_window_observer_; |
104 UserWindowObserver user_window_observer_; | 106 UserWindowObserver user_window_observer_; |
105 | 107 |
106 ScopedObserver<WmWindow, ContainerWindowObserver> observed_container_windows_; | 108 ScopedObserver<WmWindow, ContainerWindowObserver> observed_container_windows_; |
107 ScopedObserver<WmWindow, UserWindowObserver> observed_user_windows_; | 109 ScopedObserver<WmWindow, UserWindowObserver> observed_user_windows_; |
108 | 110 |
111 // The set of windows with shelf items managed by this ShelfWindowWatcher. | |
112 std::set<WmWindow*> managed_user_windows_; | |
James Cook
2016/11/02 17:53:43
I'm OK with this name, but what about user_windows
msw
2016/11/10 21:07:46
Done.
| |
113 | |
109 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); | 114 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace ash | 117 } // namespace ash |
113 | 118 |
114 #endif // ASH_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ | 119 #endif // ASH_COMMON_SHELF_SHELF_WINDOW_WATCHER_H_ |
OLD | NEW |