Index: ui/views/widget/native_widget_aura.cc |
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc |
index 1f97ac129247641f53660590ad8e05af727b1ebc..a5b3f993bcb6f8538b320a772e2b18f3bc4e808c 100644 |
--- a/ui/views/widget/native_widget_aura.cc |
+++ b/ui/views/widget/native_widget_aura.cc |
@@ -648,27 +648,32 @@ Widget::MoveLoopResult NativeWidgetAura::RunMoveLoop( |
Widget::MoveLoopEscapeBehavior escape_behavior) { |
// |escape_behavior| is only needed on windows when running the native message |
// loop. |
- if (window_ && window_->parent() && |
- aura::client::GetWindowMoveClient(window_->parent())) { |
- SetCapture(); |
- aura::client::WindowMoveSource window_move_source = |
- source == Widget::MOVE_LOOP_SOURCE_MOUSE ? |
- aura::client::WINDOW_MOVE_SOURCE_MOUSE : |
- aura::client::WINDOW_MOVE_SOURCE_TOUCH; |
- if (aura::client::GetWindowMoveClient(window_->parent())->RunMoveLoop( |
- window_, drag_offset, window_move_source) == |
- aura::client::MOVE_SUCCESSFUL) { |
- return Widget::MOVE_LOOP_SUCCESSFUL; |
- } |
+ if (!window_ || !window_->GetRootWindow()) |
+ return Widget::MOVE_LOOP_CANCELED; |
+ aura::client::WindowMoveClient* move_client = |
+ aura::client::GetWindowMoveClient(window_->GetRootWindow()); |
+ if (!move_client) |
+ return Widget::MOVE_LOOP_CANCELED; |
+ |
+ SetCapture(); |
+ aura::client::WindowMoveSource window_move_source = |
+ source == Widget::MOVE_LOOP_SOURCE_MOUSE ? |
+ aura::client::WINDOW_MOVE_SOURCE_MOUSE : |
+ aura::client::WINDOW_MOVE_SOURCE_TOUCH; |
+ if (move_client->RunMoveLoop(window_, drag_offset, window_move_source) == |
+ aura::client::MOVE_SUCCESSFUL) { |
+ return Widget::MOVE_LOOP_SUCCESSFUL; |
} |
return Widget::MOVE_LOOP_CANCELED; |
} |
void NativeWidgetAura::EndMoveLoop() { |
- if (window_ && window_->parent() && |
- aura::client::GetWindowMoveClient(window_->parent())) { |
- aura::client::GetWindowMoveClient(window_->parent())->EndMoveLoop(); |
- } |
+ if (!window_ || !window_->GetRootWindow()) |
+ return; |
+ aura::client::WindowMoveClient* move_client = |
+ aura::client::GetWindowMoveClient(window_->GetRootWindow()); |
+ if (move_client) |
+ move_client->EndMoveLoop(); |
} |
void NativeWidgetAura::SetVisibilityChangedAnimationsEnabled(bool value) { |