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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2657003004: aura-mus: Hook up PerformWindowMove(). (Closed)
Patch Set: Fold PerformWindowMove and CancelWindowMove. Created 3 years, 11 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 | « ui/aura/mus/window_tree_host_mus_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/desktop_window_tree_host_mus.cc
diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc
index 02cf6376934d0bff1123c9b9149b382b160d6280..86fb1142bfff6d5f9043e4cf330f1251e2a7f2f6 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -5,6 +5,8 @@
#include "ui/views/mus/desktop_window_tree_host_mus.h"
#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
@@ -168,6 +170,14 @@ class NativeCursorManagerMus : public wm::NativeCursorManager {
DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerMus);
};
+
+void OnMoveLoopEnd(bool* out_success,
+ base::Closure quit_closure,
+ bool in_success) {
+ *out_success = in_success;
+ quit_closure.Run();
+}
+
} // namespace
DesktopWindowTreeHostMus::DesktopWindowTreeHostMus(
@@ -583,12 +593,32 @@ Widget::MoveLoopResult DesktopWindowTreeHostMus::RunMoveLoop(
const gfx::Vector2d& drag_offset,
Widget::MoveLoopSource source,
Widget::MoveLoopEscapeBehavior escape_behavior) {
- NOTIMPLEMENTED();
- return Widget::MOVE_LOOP_CANCELED;
+ static_cast<internal::NativeWidgetPrivate*>(
+ desktop_native_widget_aura_)->ReleaseCapture();
+
+ base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
+ base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
+ base::RunLoop run_loop;
+
+ ui::mojom::MoveLoopSource mus_source =
+ source == Widget::MOVE_LOOP_SOURCE_MOUSE
+ ? ui::mojom::MoveLoopSource::MOUSE
+ : ui::mojom::MoveLoopSource::TOUCH;
+
+ bool success = false;
+ gfx::Point cursor_location =
+ display::Screen::GetScreen()->GetCursorScreenPoint();
+ WindowTreeHostMus::PerformWindowMove(
+ mus_source, cursor_location,
+ base::Bind(OnMoveLoopEnd, &success, run_loop.QuitClosure()));
+
+ run_loop.Run();
+
+ return success ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED;
}
void DesktopWindowTreeHostMus::EndMoveLoop() {
- NOTIMPLEMENTED();
+ WindowTreeHostMus::CancelWindowMove();
}
void DesktopWindowTreeHostMus::SetVisibilityChangedAnimationsEnabled(
« no previous file with comments | « ui/aura/mus/window_tree_host_mus_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698