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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 private: | 49 private: |
50 // aura::WindowObserver overrides: | 50 // aura::WindowObserver overrides: |
51 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 51 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
52 | 52 |
53 // Owned by Shell. | 53 // Owned by Shell. |
54 ShelfWindowWatcher* window_watcher_; | 54 ShelfWindowWatcher* window_watcher_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(RootWindowObserver); | 56 DISALLOW_COPY_AND_ASSIGN(RootWindowObserver); |
57 }; | 57 }; |
58 | 58 |
| 59 // Observer of removed Window that has an item from default container. |
| 60 class RemovedWindowObserver : public aura::WindowObserver { |
| 61 public: |
| 62 explicit RemovedWindowObserver(ShelfWindowWatcher* window_watcher); |
| 63 virtual ~RemovedWindowObserver(); |
| 64 |
| 65 private: |
| 66 // aura::WindowObserver overrides: |
| 67 virtual void OnWindowParentChanged(aura::Window* window, |
| 68 aura::Window* parent) OVERRIDE; |
| 69 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 70 |
| 71 // Owned by Shell. |
| 72 ShelfWindowWatcher* window_watcher_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); |
| 75 }; |
| 76 |
59 // Creates a LauncherItem for |window| that has LauncherItemDetails. | 77 // Creates a LauncherItem for |window| that has LauncherItemDetails. |
60 void AddLauncherItem(aura::Window* window); | 78 void AddLauncherItem(aura::Window* window); |
61 | 79 |
62 // Removes a LauncherItem for |window|. | 80 // Removes a LauncherItem for |window|. |
63 void RemoveLauncherItem(aura::Window* window); | 81 void RemoveLauncherItem(aura::Window* window); |
64 | 82 |
65 // Adds observer to default container and ActivationClient of |root_window|. | 83 // Adds observer to default container and ActivationClient of |root_window|. |
66 void OnRootWindowAdded(aura::Window* root_window); | 84 void OnRootWindowAdded(aura::Window* root_window); |
67 | 85 |
68 // Removes observer from ActivationClient of |root_window|. | 86 // Removes observer from ActivationClient of |root_window|. |
69 void OnRootWindowRemoved(aura::Window* root_window); | 87 void OnRootWindowRemoved(aura::Window* root_window); |
70 | 88 |
71 // Updates the status of LauncherItem for |window|. | 89 // Updates the status of LauncherItem for |window|. |
72 void UpdateLauncherItemStatus(aura::Window* window, bool is_active); | 90 void UpdateLauncherItemStatus(aura::Window* window, bool is_active); |
73 | 91 |
74 // Returns the index of LauncherItem associated with |window|. | 92 // Returns the index of LauncherItem associated with |window|. |
75 int GetLauncherItemIndexForWindow(aura::Window* window) const; | 93 int GetLauncherItemIndexForWindow(aura::Window* window) const; |
76 | 94 |
| 95 // Remove an item associated with |window| and its observer. |
| 96 void FinalizeItemOfRemovedWindow(aura::Window* window); |
| 97 |
77 // aura::client::ActivationChangeObserver overrides: | 98 // aura::client::ActivationChangeObserver overrides: |
78 virtual void OnWindowActivated(aura::Window* gained_active, | 99 virtual void OnWindowActivated(aura::Window* gained_active, |
79 aura::Window* lost_active) OVERRIDE; | 100 aura::Window* lost_active) OVERRIDE; |
80 | 101 |
81 // aura::WindowObserver overrides: | 102 // aura::WindowObserver overrides: |
82 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; | 103 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; |
83 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | 104 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; |
84 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 105 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
85 virtual void OnWindowPropertyChanged(aura::Window* window, | 106 virtual void OnWindowPropertyChanged(aura::Window* window, |
86 const void* key, | 107 const void* key, |
87 intptr_t old) OVERRIDE; | 108 intptr_t old) OVERRIDE; |
88 | 109 |
89 // gfx::DisplayObserver overrides: | 110 // gfx::DisplayObserver overrides: |
90 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; | 111 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; |
91 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 112 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
92 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 113 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; |
93 | 114 |
94 // Owned by Shell. | 115 // Owned by Shell. |
95 ShelfModel* model_; | 116 ShelfModel* model_; |
96 ShelfItemDelegateManager* item_delegate_manager_; | 117 ShelfItemDelegateManager* item_delegate_manager_; |
97 | 118 |
98 RootWindowObserver root_window_observer_; | 119 RootWindowObserver root_window_observer_; |
99 | 120 |
| 121 RemovedWindowObserver removed_window_observer_; |
| 122 |
100 // Holds all observed windows. | 123 // Holds all observed windows. |
101 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; | 124 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
102 | 125 |
103 // Holds all observed root windows. | 126 // Holds all observed root windows. |
104 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; | 127 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; |
105 | 128 |
| 129 // Holds removed windows that has an item from default container. |
| 130 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; |
| 131 |
106 // Holds all observed activation clients. | 132 // Holds all observed activation clients. |
107 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, | 133 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, |
108 aura::client::ActivationChangeObserver> observed_activation_clients_; | 134 aura::client::ActivationChangeObserver> observed_activation_clients_; |
109 | 135 |
110 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); | 136 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); |
111 }; | 137 }; |
112 | 138 |
113 } // namespace internal | 139 } // namespace internal |
114 } // namespace ash | 140 } // namespace ash |
115 | 141 |
116 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ | 142 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
OLD | NEW |