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

Unified Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 431973006: Fix flakiness of DesktopDragDropClientAuraX11Tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index e6bd4c2e4bd82aaa0d8cb54203600025998318dc..cdaecb7791c1c38f42ed116d01450fa720b6c450 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -22,6 +22,7 @@
#include "ui/events/platform/platform_event_source.h"
#include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
+#include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
#include "ui/wm/public/drag_drop_client.h"
#include "ui/wm/public/drag_drop_delegate.h"
@@ -361,8 +362,7 @@ DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11(
views::DesktopNativeCursorManager* cursor_manager,
Display* xdisplay,
::Window xwindow)
- : move_loop_(this),
- root_window_(root_window),
+ : root_window_(root_window),
xdisplay_(xdisplay),
xwindow_(xwindow),
atom_cache_(xdisplay_, kAtomsToCache),
@@ -407,6 +407,10 @@ DesktopDragDropClientAuraX11* DesktopDragDropClientAuraX11::GetForWindow(
return it->second;
}
+void DesktopDragDropClientAuraX11::Init() {
+ move_loop_ = CreateMoveLoop(this);
+}
+
void DesktopDragDropClientAuraX11::OnXdndEnter(
const XClientMessageEvent& event) {
DVLOG(1) << "XdndEnter";
@@ -483,7 +487,7 @@ void DesktopDragDropClientAuraX11::OnXdndStatus(
if (source_state_ == SOURCE_STATE_PENDING_DROP) {
// We were waiting on the status message so we could send the XdndDrop.
if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) {
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
return;
}
source_state_ = SOURCE_STATE_DROPPED;
@@ -493,13 +497,13 @@ void DesktopDragDropClientAuraX11::OnXdndStatus(
switch (negotiated_operation_) {
case ui::DragDropTypes::DRAG_COPY:
- move_loop_.UpdateCursor(copy_grab_cursor_);
+ move_loop_->UpdateCursor(copy_grab_cursor_);
break;
case ui::DragDropTypes::DRAG_MOVE:
- move_loop_.UpdateCursor(move_grab_cursor_);
+ move_loop_->UpdateCursor(move_grab_cursor_);
break;
default:
- move_loop_.UpdateCursor(grab_cursor_);
+ move_loop_->UpdateCursor(grab_cursor_);
break;
}
@@ -534,7 +538,7 @@ void DesktopDragDropClientAuraX11::OnXdndFinished(
// Clear |source_current_window_| to avoid sending XdndLeave upon ending the
// move loop.
source_current_window_ = None;
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
}
void DesktopDragDropClientAuraX11::OnXdndDrop(
@@ -627,12 +631,12 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
// Windows has a specific method, DoDragDrop(), which performs the entire
// drag. We have to emulate this, so we spin off a nested runloop which will
// track all cursor movement and reroute events to a specific handler.
- move_loop_.SetDragImage(source_provider_->GetDragImage(),
- source_provider_->GetDragImageOffset());
- move_loop_.RunMoveLoop(source_window, grab_cursor_);
+ move_loop_->SetDragImage(source_provider_->GetDragImage(),
+ source_provider_->GetDragImageOffset());
+ move_loop_->RunMoveLoop(source_window, grab_cursor_);
if (alive) {
- move_loop_.SetDragImage(gfx::ImageSkia(), gfx::Vector2dF());
+ move_loop_->SetDragImage(gfx::ImageSkia(), gfx::Vector2dF());
source_provider_ = NULL;
g_current_drag_drop_client = NULL;
@@ -656,7 +660,7 @@ void DesktopDragDropClientAuraX11::Drop(aura::Window* target,
}
void DesktopDragDropClientAuraX11::DragCancel() {
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
}
bool DesktopDragDropClientAuraX11::IsDragDropInProgress() {
@@ -679,7 +683,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
if (source_state_ != SOURCE_STATE_OTHER) {
// The user has previously released the mouse and is clicking in
// frustration.
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
return;
}
@@ -696,7 +700,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
return;
}
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
return;
}
@@ -715,7 +719,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
}
}
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
}
void DesktopDragDropClientAuraX11::OnMoveLoopEnded() {
@@ -728,6 +732,11 @@ void DesktopDragDropClientAuraX11::OnMoveLoopEnded() {
end_move_loop_timer_.Stop();
}
+scoped_ptr<X11MoveLoop> DesktopDragDropClientAuraX11::CreateMoveLoop(
+ X11MoveLoopDelegate* delegate) {
+ return scoped_ptr<X11MoveLoop>(new X11WholeScreenMoveLoop(this));
+}
+
XID DesktopDragDropClientAuraX11::FindWindowFor(
const gfx::Point& screen_point) {
views::X11TopmostWindowFinder finder;
@@ -832,7 +841,7 @@ void DesktopDragDropClientAuraX11::StartEndMoveLoopTimer() {
}
void DesktopDragDropClientAuraX11::EndMoveLoop() {
- move_loop_.EndMoveLoop();
+ move_loop_->EndMoveLoop();
}
void DesktopDragDropClientAuraX11::DragTranslate(

Powered by Google App Engine
This is Rietveld 408576698