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

Unified Diff: ash/drag_drop/drag_drop_controller.cc

Issue 2206033002: mash: Migrate ash::DragImageView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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 | « ash/drag_drop/drag_drop_controller.h ('k') | ash/drag_drop/drag_drop_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/drag_drop/drag_drop_controller.cc
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 4ace7378a24e0e8e606f2d77116ee5b15fbdcd69..ab9e48cdb7681f7dd658fc7edb81a70c2054595d 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -6,8 +6,10 @@
#include <utility>
+#include "ash/aura/wm_window_aura.h"
+#include "ash/common/drag_drop/drag_image_view.h"
+#include "ash/common/wm_shell.h"
#include "ash/drag_drop/drag_drop_tracker.h"
-#include "ash/drag_drop/drag_image_view.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -134,9 +136,11 @@ DragDropController::DragDropController()
current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE),
weak_factory_(this) {
Shell::GetInstance()->PrependPreTargetHandler(this);
+ WmShell::Get()->AddDisplayObserver(this);
}
DragDropController::~DragDropController() {
+ WmShell::Get()->RemoveDisplayObserver(this);
Shell::GetInstance()->RemovePreTargetHandler(this);
Cleanup();
if (cancel_animation_)
@@ -199,7 +203,8 @@ int DragDropController::StartDragAndDrop(
drag_image_final_bounds_for_cancel_animation_ =
gfx::Rect(start_location - provider->GetDragImageOffset(),
provider->GetDragImage().size());
- drag_image_.reset(new DragImageView(source_window->GetRootWindow(), source));
+ drag_image_.reset(new DragImageView(
+ WmWindowAura::Get(source_window->GetRootWindow()), source));
drag_image_->SetImage(provider->GetDragImage());
drag_image_offset_ = provider->GetDragImageOffset();
gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize());
@@ -537,6 +542,13 @@ void DragDropController::AnimationCanceled(const gfx::Animation* animation) {
AnimationEnded(animation);
}
+void DragDropController::OnDisplayConfigurationChanging() {
+ // Abort in-progress drags if a monitor is added or removed because the drag
+ // image widget's container may be destroyed.
+ if (IsDragDropInProgress())
+ DragCancel();
+}
+
void DragDropController::StartCanceledAnimation(int animation_duration_ms) {
DCHECK(drag_image_.get());
drag_image_->SetTouchDragOperationHintOff();
« no previous file with comments | « ash/drag_drop/drag_drop_controller.h ('k') | ash/drag_drop/drag_drop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698