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

Unified Diff: ash/shelf/shelf_window_watcher.cc

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: Created 7 years 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_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | ash/shelf/shelf_window_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698