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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/shelf/shelf_window_watcher.cc » ('j') | ash/shelf/shelf_window_watcher.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
sky 2014/01/08 15:01:49 Change comments to: Used to track windows that are
simonhong 2014/01/09 01:00:09 Done.
60 // See the comments of ShelfWindowWatcher::StartObserveRemovedWindow() why
61 // removed window needs this observer.
62 class RemovedWindowObserver : public aura::WindowObserver {
63 public:
64 explicit RemovedWindowObserver(ShelfWindowWatcher* window_watcher);
65 virtual ~RemovedWindowObserver();
66
67 private:
68 // aura::WindowObserver overrides:
69 virtual void OnWindowParentChanged(aura::Window* window,
70 aura::Window* parent) OVERRIDE;
71 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
72
73 // Owned by Shell.
74 ShelfWindowWatcher* window_watcher_;
75
76 DISALLOW_COPY_AND_ASSIGN(RemovedWindowObserver);
77 };
78
59 // Creates a LauncherItem for |window| that has LauncherItemDetails. 79 // Creates a LauncherItem for |window| that has LauncherItemDetails.
60 void AddLauncherItem(aura::Window* window); 80 void AddLauncherItem(aura::Window* window);
61 81
62 // Removes a LauncherItem for |window|. 82 // Removes a LauncherItem for |window|.
63 void RemoveLauncherItem(aura::Window* window); 83 void RemoveLauncherItem(aura::Window* window);
64 84
65 // Adds observer to default container and ActivationClient of |root_window|. 85 // Adds observer to default container and ActivationClient of |root_window|.
66 void OnRootWindowAdded(aura::Window* root_window); 86 void OnRootWindowAdded(aura::Window* root_window);
67 87
68 // Removes observer from ActivationClient of |root_window|. 88 // Removes observer from ActivationClient of |root_window|.
69 void OnRootWindowRemoved(aura::Window* root_window); 89 void OnRootWindowRemoved(aura::Window* root_window);
70 90
71 // Updates the status of LauncherItem for |window|. 91 // Updates the status of LauncherItem for |window|.
72 void UpdateLauncherItemStatus(aura::Window* window, bool is_active); 92 void UpdateLauncherItemStatus(aura::Window* window, bool is_active);
73 93
74 // Returns the index of LauncherItem associated with |window|. 94 // Returns the index of LauncherItem associated with |window|.
75 int GetLauncherItemIndexForWindow(aura::Window* window) const; 95 int GetLauncherItemIndexForWindow(aura::Window* window) const;
76 96
97 // Start observing removed |window| from ShelfWindowWatcher by
98 // RemovedWindowObserver. In some situations like dragging, it re-parents
99 // |window| to other container. But the item of |window| should not be
100 // removed immediately because |window| is not destroyed at that situation.
101 // We should observe to check whether |window| is destroyed or not.
102 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.
103
104 // Stop observing |window| by RemovedWindowObserver and remove an item
105 // associated with |window|.
106 void FinishObserveRemovedWindow(aura::Window* window);
simonhong 2014/01/09 01:00:09 Changed to FinishObservingRemovedWindow().
107
77 // aura::client::ActivationChangeObserver overrides: 108 // aura::client::ActivationChangeObserver overrides:
78 virtual void OnWindowActivated(aura::Window* gained_active, 109 virtual void OnWindowActivated(aura::Window* gained_active,
79 aura::Window* lost_active) OVERRIDE; 110 aura::Window* lost_active) OVERRIDE;
80 111
81 // aura::WindowObserver overrides: 112 // aura::WindowObserver overrides:
82 virtual void OnWindowAdded(aura::Window* window) OVERRIDE; 113 virtual void OnWindowAdded(aura::Window* window) OVERRIDE;
83 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; 114 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE;
84 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 115 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
85 virtual void OnWindowPropertyChanged(aura::Window* window, 116 virtual void OnWindowPropertyChanged(aura::Window* window,
86 const void* key, 117 const void* key,
87 intptr_t old) OVERRIDE; 118 intptr_t old) OVERRIDE;
88 119
89 // gfx::DisplayObserver overrides: 120 // gfx::DisplayObserver overrides:
90 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; 121 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
91 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; 122 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE;
92 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; 123 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
93 124
94 // Owned by Shell. 125 // Owned by Shell.
95 ShelfModel* model_; 126 ShelfModel* model_;
96 ShelfItemDelegateManager* item_delegate_manager_; 127 ShelfItemDelegateManager* item_delegate_manager_;
97 128
98 RootWindowObserver root_window_observer_; 129 RootWindowObserver root_window_observer_;
99 130
131 RemovedWindowObserver removed_window_observer_;
132
100 // Holds all observed windows. 133 // Holds all observed windows.
101 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; 134 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_;
102 135
103 // Holds all observed root windows. 136 // Holds all observed root windows.
104 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_; 137 ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_;
105 138
139 // Holds removed windows that has an item from default container.
140 ScopedObserver<aura::Window, aura::WindowObserver> observed_removed_windows_;
141
106 // Holds all observed activation clients. 142 // Holds all observed activation clients.
107 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient, 143 ScopedObserverWithDuplicatedSources<aura::client::ActivationClient,
108 aura::client::ActivationChangeObserver> observed_activation_clients_; 144 aura::client::ActivationChangeObserver> observed_activation_clients_;
109 145
110 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher); 146 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher);
111 }; 147 };
112 148
113 } // namespace internal 149 } // namespace internal
114 } // namespace ash 150 } // namespace ash
115 151
116 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_ 152 #endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_
OLDNEW
« 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