Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: ash/shelf/shelf_window_watcher.h

Issue 108313006: [ash] Don't remove an item when associated window is dragged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/shelf/shelf_window_watcher.cc » ('j') | ash/shelf/shelf_window_watcher.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | ash/shelf/shelf_window_watcher.cc » ('j') | ash/shelf/shelf_window_watcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698