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

Unified Diff: ash/mus/window_manager.cc

Issue 2099513003: mus: Use the new drag API to implement tab dragging in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dragging-part-1
Patch Set: Minor pruning Created 4 years, 6 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: ash/mus/window_manager.cc
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index 0bfdfdd454366b9386fd10cb4d1e4d5d8b667110..60cf74433bea26fddd0072791194e6e1af5d057b 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -12,6 +12,7 @@
#include "ash/mus/bridge/wm_lookup_mus.h"
#include "ash/mus/bridge/wm_shell_mus.h"
#include "ash/mus/bridge/wm_window_mus.h"
+#include "ash/mus/frame/move_event_handler.h"
#include "ash/mus/non_client_frame_controller.h"
#include "ash/mus/property_util.h"
#include "ash/mus/root_window_controller.h"
@@ -27,6 +28,7 @@
#include "components/mus/public/cpp/window_tree_client.h"
#include "components/mus/public/interfaces/mus_constants.mojom.h"
#include "components/mus/public/interfaces/window_manager.mojom.h"
+#include "ui/base/hit_test.h"
#include "ui/events/mojo/event.mojom.h"
#include "ui/views/mus/screen_mus.h"
@@ -229,6 +231,26 @@ void WindowManager::OnWmNewDisplay(::mus::Window* window,
CreateRootWindowController(window, display);
}
+void WindowManager::OnWmPerformMoveLoop(
+ ::mus::Window* window,
+ ::mus::mojom::MoveLoopSource source,
+ const gfx::Point& cursor_location,
+ const base::Callback<void(bool)>& on_done) {
+ WmWindowMus* child_window = WmWindowMus::Get(window);
sky 2016/06/30 00:18:31 DCHECK there isn't a drag in progress?
+ MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
sky 2016/06/30 00:18:31 Fail if there is no handler. This would happen if
+ aura::client::WindowMoveSource aura_source =
+ source == ::mus::mojom::MoveLoopSource::MOUSE
+ ? aura::client::WINDOW_MOVE_SOURCE_MOUSE
+ : aura::client::WINDOW_MOVE_SOURCE_TOUCH;
+ handler->AttemptToStartDrag(cursor_location, HTCAPTION, aura_source, on_done);
+}
+
+void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
+ WmWindowMus* child_window = WmWindowMus::Get(window);
+ MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
sky 2016/06/30 00:18:31 Same comment here about checking handler.
+ handler->RevertDrag();
sky 2016/06/30 00:18:31 What happens if RevertDrag is called and there isn
Elliot Glaysher 2016/06/30 19:48:25 It doesn't. WmToplevelWindowEventHandler::Complete
+}
+
void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
switch (id) {
case kWindowSwitchAccelerator:
@@ -240,17 +262,5 @@ void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
}
}
-void WindowManager::OnWmPerformMoveLoop(
- ::mus::Window* window,
- ::mus::mojom::MoveLoopSource source,
- const gfx::Point& cursor_location,
- const base::Callback<void(bool)>& on_done) {
- NOTIMPLEMENTED();
-}
-
-void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
- NOTIMPLEMENTED();
-}
-
} // namespace mus
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698