Chromium Code Reviews| Index: ash/shelf/shelf_window_watcher.cc |
| diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc |
| index b4e65e25a7b2f50761de5c0c524936e86163917c..c8c9a876aca593a00ccc60fb2c983c5a97552d0b 100644 |
| --- a/ash/shelf/shelf_window_watcher.cc |
| +++ b/ash/shelf/shelf_window_watcher.cc |
| @@ -11,6 +11,7 @@ |
| #include "ash/shelf/shelf_window_watcher_item_delegate.h" |
| #include "ash/shell.h" |
| #include "ash/shell_window_ids.h" |
| +#include "ash/wm/window_state.h" |
| #include "ash/wm/window_util.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "ui/aura/client/activation_client.h" |
| @@ -40,6 +41,11 @@ bool HasLauncherItemForWindow(aura::Window* window) { |
| return false; |
| } |
| +// Returns true if |window| is in the process of being dragged. |
| +bool IsDragging(aura::Window* window) { |
| + return ash::wm::GetWindowState(window)->is_dragged(); |
| +} |
| + |
| } // namespace |
| namespace ash { |
| @@ -156,11 +162,12 @@ void ShelfWindowWatcher::OnWindowAdded(aura::Window* window) { |
| } |
| void ShelfWindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
| - // Remove a child window of default container and its item if it has. |
| + // Remove a child window of default container. |
| if (observed_windows_.IsObserving(window)) |
| observed_windows_.Remove(window); |
| - if (HasLauncherItemForWindow(window)) |
| + // When |window| is dragged, its item should not be removed. |
| + if (HasLauncherItemForWindow(window) && !IsDragging(window)) |
|
sky
2013/12/14 00:17:20
If the window is deleted while dragging how does t
simonhong
2013/12/16 02:24:16
When a |window| is dragging its observer and item
|
| RemoveLauncherItem(window); |
| } |