Chromium Code Reviews| Index: ash/shelf/shelf_window_watcher.h |
| diff --git a/ash/shelf/shelf_window_watcher.h b/ash/shelf/shelf_window_watcher.h |
| index 43ac4f0150ee7a328cd008108a13da08310883b8..0fb9d6975a10f17ad7ed2f8e220c69a4e785eb01 100644 |
| --- a/ash/shelf/shelf_window_watcher.h |
| +++ b/ash/shelf/shelf_window_watcher.h |
| @@ -56,6 +56,26 @@ class ShelfWindowWatcher : public aura::client::ActivationChangeObserver, |
| DISALLOW_COPY_AND_ASSIGN(RootWindowObserver); |
| }; |
| + // Observer of removed Window that has an item. |
|
sky
2014/01/08 15:01:49
Change comments to:
Used to track windows that are
simonhong
2014/01/09 01:00:09
Done.
|
| + // See the comments of ShelfWindowWatcher::StartObserveRemovedWindow() why |
| + // removed window needs this observer. |
| + class RemovedWindowObserver : public aura::WindowObserver { |
| + public: |
| + explicit RemovedWindowObserver(ShelfWindowWatcher* window_watcher); |
| + virtual ~RemovedWindowObserver(); |
| + |
| + private: |
| + // aura::WindowObserver overrides: |
| + virtual void OnWindowParentChanged(aura::Window* window, |
| + aura::Window* parent) OVERRIDE; |
| + virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| + |
| + // Owned by Shell. |
| + ShelfWindowWatcher* window_watcher_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver); |
| + }; |
| + |
| // Creates a LauncherItem for |window| that has LauncherItemDetails. |
| void AddLauncherItem(aura::Window* window); |
| @@ -74,6 +94,17 @@ class ShelfWindowWatcher : public aura::client::ActivationChangeObserver, |
| // Returns the index of LauncherItem associated with |window|. |
| int GetLauncherItemIndexForWindow(aura::Window* window) const; |
| + // Start observing removed |window| from ShelfWindowWatcher by |
| + // RemovedWindowObserver. In some situations like dragging, it re-parents |
| + // |window| to other container. But the item of |window| should not be |
| + // removed immediately because |window| is not destroyed at that situation. |
| + // We should observe to check whether |window| is destroyed or not. |
| + void StartObserveRemovedWindow(aura::Window* window); |
|
sky
2014/01/08 15:01:49
StartObservingRemovedWindow
Used when a window is
simonhong
2014/01/09 01:00:09
Done.
|
| + |
| + // Stop observing |window| by RemovedWindowObserver and remove an item |
| + // associated with |window|. |
| + void FinishObserveRemovedWindow(aura::Window* window); |
|
simonhong
2014/01/09 01:00:09
Changed to FinishObservingRemovedWindow().
|
| + |
| // aura::client::ActivationChangeObserver overrides: |
| virtual void OnWindowActivated(aura::Window* gained_active, |
| aura::Window* lost_active) OVERRIDE; |
| @@ -97,12 +128,17 @@ class ShelfWindowWatcher : public aura::client::ActivationChangeObserver, |
| RootWindowObserver root_window_observer_; |
| + RemovedWindowObserver removed_window_observer_; |
| + |
| // Holds all observed windows. |
| ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
| // Holds all observed root windows. |
| ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; |
| + // Holds removed windows that has an item from default container. |
| + ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_; |
| + |
| // Holds all observed activation clients. |
| ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, |
| aura::client::ActivationChangeObserver> observed_activation_clients_; |