| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "ash/shelf/scoped_observer_with_duplicated_sources.h" | 10 #include "ash/shelf/scoped_observer_with_duplicated_sources.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/gfx/display_observer.h" | 15 #include "ui/display/display_observer.h" |
| 16 #include "ui/wm/public/activation_change_observer.h" | 16 #include "ui/wm/public/activation_change_observer.h" |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 | 19 |
| 20 class Window; | 20 class Window; |
| 21 | 21 |
| 22 namespace client { | 22 namespace client { |
| 23 class ActivationClient; | 23 class ActivationClient; |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace aura | 26 } // namespace aura |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 class ShelfModel; | 30 class ShelfModel; |
| 31 class ShelfItemDelegateManager; | 31 class ShelfItemDelegateManager; |
| 32 | 32 |
| 33 // ShelfWindowWatcher creates and handles a ShelfItem for windows that have | 33 // ShelfWindowWatcher creates and handles a ShelfItem for windows that have |
| 34 // a ShelfItemDetails property in the default container. | 34 // a ShelfItemDetails property in the default container. |
| 35 class ShelfWindowWatcher : public aura::client::ActivationChangeObserver, | 35 class ShelfWindowWatcher : public aura::client::ActivationChangeObserver, |
| 36 public aura::WindowObserver, | 36 public aura::WindowObserver, |
| 37 public gfx::DisplayObserver { | 37 public display::DisplayObserver { |
| 38 public: | 38 public: |
| 39 ShelfWindowWatcher(ShelfModel* model, | 39 ShelfWindowWatcher(ShelfModel* model, |
| 40 ShelfItemDelegateManager* item_delegate_manager); | 40 ShelfItemDelegateManager* item_delegate_manager); |
| 41 ~ShelfWindowWatcher() override; | 41 ~ShelfWindowWatcher() override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 class RootWindowObserver : public aura::WindowObserver { | 44 class RootWindowObserver : public aura::WindowObserver { |
| 45 public: | 45 public: |
| 46 explicit RootWindowObserver(ShelfWindowWatcher* window_watcher); | 46 explicit RootWindowObserver(ShelfWindowWatcher* window_watcher); |
| 47 ~RootWindowObserver() override; | 47 ~RootWindowObserver() override; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 aura::Window* lost_active) override; | 110 aura::Window* lost_active) override; |
| 111 | 111 |
| 112 // aura::WindowObserver overrides: | 112 // aura::WindowObserver overrides: |
| 113 void OnWindowAdded(aura::Window* window) override; | 113 void OnWindowAdded(aura::Window* window) override; |
| 114 void OnWillRemoveWindow(aura::Window* window) override; | 114 void OnWillRemoveWindow(aura::Window* window) override; |
| 115 void OnWindowDestroying(aura::Window* window) override; | 115 void OnWindowDestroying(aura::Window* window) override; |
| 116 void OnWindowPropertyChanged(aura::Window* window, | 116 void OnWindowPropertyChanged(aura::Window* window, |
| 117 const void* key, | 117 const void* key, |
| 118 intptr_t old) override; | 118 intptr_t old) override; |
| 119 | 119 |
| 120 // gfx::DisplayObserver overrides: | 120 // display::DisplayObserver overrides: |
| 121 void OnDisplayAdded(const gfx::Display& display) override; | 121 void OnDisplayAdded(const display::Display& display) override; |
| 122 void OnDisplayRemoved(const gfx::Display& old_display) override; | 122 void OnDisplayRemoved(const display::Display& old_display) override; |
| 123 void OnDisplayMetricsChanged(const gfx::Display& display, | 123 void OnDisplayMetricsChanged(const display::Display& display, |
| 124 uint32_t metrics) override; | 124 uint32_t metrics) override; |
| 125 | 125 |
| 126 // Owned by Shell. | 126 // Owned by Shell. |
| 127 ShelfModel* model_; | 127 ShelfModel* model_; |
| 128 ShelfItemDelegateManager* item_delegate_manager_; | 128 ShelfItemDelegateManager* item_delegate_manager_; |
| 129 | 129 |
| 130 RootWindowObserver root_window_observer_; | 130 RootWindowObserver root_window_observer_; |
| 131 | 131 |
| 132 RemovedWindowObserver removed_window_observer_; | 132 RemovedWindowObserver removed_window_observer_; |
| 133 | 133 |
| 134 // Holds all observed windows. | 134 // Holds all observed windows. |
| 135 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; | 135 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
| 136 | 136 |
| 137 // Holds all observed root windows. | 137 // Holds all observed root windows. |
| 138 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; | 138 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; |
| 139 | 139 |
| 140 // Holds removed windows that has an item from default container. | 140 // Holds removed windows that has an item from default container. |
| 141 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; | 141 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; |
| 142 | 142 |
| 143 // Holds all observed activation clients. | 143 // Holds all observed activation clients. |
| 144 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, | 144 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, |
| 145 aura::client::ActivationChangeObserver> observed_activation_clients_; | 145 aura::client::ActivationChangeObserver> observed_activation_clients_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); | 147 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace ash | 150 } // namespace ash |
| 151 | 151 |
| 152 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ | 152 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
| OLD | NEW |