| 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 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 } // namespace aura | 25 } // namespace aura |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 | 28 |
| 29 class ShelfModel; | 29 class ShelfModel; |
| 30 class ShelfItemDelegateManager; | 30 class ShelfItemDelegateManager; |
| 31 | 31 |
| 32 namespace internal { | 32 namespace internal { |
| 33 // ShelfWindowWatcher creates and handles a LauncherItem 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 gfx::DisplayObserver { |
| 38 public: | 38 public: |
| 39 ShelfWindowWatcher(ShelfModel* model, | 39 ShelfWindowWatcher(ShelfModel* model, |
| 40 ShelfItemDelegateManager* item_delegate_manager); | 40 ShelfItemDelegateManager* item_delegate_manager); |
| 41 virtual ~ShelfWindowWatcher(); | 41 virtual ~ShelfWindowWatcher(); |
| 42 | 42 |
| 43 private: | 43 private: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 68 virtual void OnWindowParentChanged(aura::Window* window, | 68 virtual void OnWindowParentChanged(aura::Window* window, |
| 69 aura::Window* parent) OVERRIDE; | 69 aura::Window* parent) OVERRIDE; |
| 70 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 70 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 71 | 71 |
| 72 // Owned by Shell. | 72 // Owned by Shell. |
| 73 ShelfWindowWatcher* window_watcher_; | 73 ShelfWindowWatcher* window_watcher_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); | 75 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Creates a LauncherItem for |window| that has ShelfItemDetails. | 78 // Creates a ShelfItem for |window| that has ShelfItemDetails. |
| 79 void AddLauncherItem(aura::Window* window); | 79 void AddShelfItem(aura::Window* window); |
| 80 | 80 |
| 81 // Removes a LauncherItem for |window|. | 81 // Removes a ShelfItem for |window|. |
| 82 void RemoveLauncherItem(aura::Window* window); | 82 void RemoveShelfItem(aura::Window* window); |
| 83 | 83 |
| 84 // Adds observer to default container and ActivationClient of |root_window|. | 84 // Adds observer to default container and ActivationClient of |root_window|. |
| 85 void OnRootWindowAdded(aura::Window* root_window); | 85 void OnRootWindowAdded(aura::Window* root_window); |
| 86 | 86 |
| 87 // Removes observer from ActivationClient of |root_window|. | 87 // Removes observer from ActivationClient of |root_window|. |
| 88 void OnRootWindowRemoved(aura::Window* root_window); | 88 void OnRootWindowRemoved(aura::Window* root_window); |
| 89 | 89 |
| 90 // Updates the status of ShelfItem for |window|. | 90 // Updates the status of ShelfItem for |window|. |
| 91 void UpdateShelfItemStatus(aura::Window* window, bool is_active); | 91 void UpdateShelfItemStatus(aura::Window* window, bool is_active); |
| 92 | 92 |
| 93 // Returns the index of LauncherItem associated with |window|. | 93 // Returns the index of ShelfItem associated with |window|. |
| 94 int GetLauncherItemIndexForWindow(aura::Window* window) const; | 94 int GetShelfItemIndexForWindow(aura::Window* window) const; |
| 95 | 95 |
| 96 // Used when a window is removed. During the dragging a window may be removed | 96 // Used when a window is removed. During the dragging a window may be removed |
| 97 // and when the drag completes added back. When this happens we don't want to | 97 // and when the drag completes added back. When this happens we don't want to |
| 98 // remove the shelf item. StartObservingRemovedWindow, if necessary, attaches | 98 // remove the shelf item. StartObservingRemovedWindow, if necessary, attaches |
| 99 // an observer. When done, FinishObservingRemovedWindow() is invoked. | 99 // an observer. When done, FinishObservingRemovedWindow() is invoked. |
| 100 void StartObservingRemovedWindow(aura::Window* window); | 100 void StartObservingRemovedWindow(aura::Window* window); |
| 101 | 101 |
| 102 // Stop observing |window| by RemovedWindowObserver and remove an item | 102 // Stop observing |window| by RemovedWindowObserver and remove an item |
| 103 // associated with |window|. | 103 // associated with |window|. |
| 104 void FinishObservingRemovedWindow(aura::Window* window); | 104 void FinishObservingRemovedWindow(aura::Window* window); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 internal | 147 } // namespace internal |
| 148 } // namespace ash | 148 } // namespace ash |
| 149 | 149 |
| 150 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ | 150 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ |
| OLD | NEW |