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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/mus/window_manager.h" 5 #include "ash/mus/window_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
12 #include "ash/mus/bridge/wm_lookup_mus.h" 12 #include "ash/mus/bridge/wm_lookup_mus.h"
13 #include "ash/mus/bridge/wm_shell_mus.h" 13 #include "ash/mus/bridge/wm_shell_mus.h"
14 #include "ash/mus/bridge/wm_window_mus.h" 14 #include "ash/mus/bridge/wm_window_mus.h"
15 #include "ash/mus/frame/move_event_handler.h"
15 #include "ash/mus/non_client_frame_controller.h" 16 #include "ash/mus/non_client_frame_controller.h"
16 #include "ash/mus/property_util.h" 17 #include "ash/mus/property_util.h"
17 #include "ash/mus/root_window_controller.h" 18 #include "ash/mus/root_window_controller.h"
18 #include "ash/mus/root_windows_observer.h" 19 #include "ash/mus/root_windows_observer.h"
19 #include "ash/mus/shadow_controller.h" 20 #include "ash/mus/shadow_controller.h"
20 #include "ash/mus/window_manager_application.h" 21 #include "ash/mus/window_manager_application.h"
21 #include "ash/public/interfaces/container.mojom.h" 22 #include "ash/public/interfaces/container.mojom.h"
22 #include "components/mus/common/event_matcher_util.h" 23 #include "components/mus/common/event_matcher_util.h"
23 #include "components/mus/common/types.h" 24 #include "components/mus/common/types.h"
24 #include "components/mus/public/cpp/property_type_converters.h" 25 #include "components/mus/public/cpp/property_type_converters.h"
25 #include "components/mus/public/cpp/window.h" 26 #include "components/mus/public/cpp/window.h"
26 #include "components/mus/public/cpp/window_property.h" 27 #include "components/mus/public/cpp/window_property.h"
27 #include "components/mus/public/cpp/window_tree_client.h" 28 #include "components/mus/public/cpp/window_tree_client.h"
28 #include "components/mus/public/interfaces/mus_constants.mojom.h" 29 #include "components/mus/public/interfaces/mus_constants.mojom.h"
29 #include "components/mus/public/interfaces/window_manager.mojom.h" 30 #include "components/mus/public/interfaces/window_manager.mojom.h"
31 #include "ui/base/hit_test.h"
30 #include "ui/events/mojo/event.mojom.h" 32 #include "ui/events/mojo/event.mojom.h"
31 #include "ui/views/mus/screen_mus.h" 33 #include "ui/views/mus/screen_mus.h"
32 34
33 namespace ash { 35 namespace ash {
34 namespace mus { 36 namespace mus {
35 37
36 const uint32_t kWindowSwitchAccelerator = 1; 38 const uint32_t kWindowSwitchAccelerator = 1;
37 39
38 void AssertTrue(bool success) { 40 void AssertTrue(bool success) {
39 DCHECK(success); 41 DCHECK(success);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 bool janky) { 224 bool janky) {
223 for (auto window : client_windows) 225 for (auto window : client_windows)
224 SetWindowIsJanky(window, janky); 226 SetWindowIsJanky(window, janky);
225 } 227 }
226 228
227 void WindowManager::OnWmNewDisplay(::mus::Window* window, 229 void WindowManager::OnWmNewDisplay(::mus::Window* window,
228 const display::Display& display) { 230 const display::Display& display) {
229 CreateRootWindowController(window, display); 231 CreateRootWindowController(window, display);
230 } 232 }
231 233
234 void WindowManager::OnWmPerformMoveLoop(
235 ::mus::Window* window,
236 ::mus::mojom::MoveLoopSource source,
237 const gfx::Point& cursor_location,
238 const base::Callback<void(bool)>& on_done) {
239 WmWindowMus* child_window = WmWindowMus::Get(window);
sky 2016/06/30 00:18:31 DCHECK there isn't a drag in progress?
240 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
sky 2016/06/30 00:18:31 Fail if there is no handler. This would happen if
241 aura::client::WindowMoveSource aura_source =
242 source == ::mus::mojom::MoveLoopSource::MOUSE
243 ? aura::client::WINDOW_MOVE_SOURCE_MOUSE
244 : aura::client::WINDOW_MOVE_SOURCE_TOUCH;
245 handler->AttemptToStartDrag(cursor_location, HTCAPTION, aura_source, on_done);
246 }
247
248 void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
249 WmWindowMus* child_window = WmWindowMus::Get(window);
250 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
sky 2016/06/30 00:18:31 Same comment here about checking handler.
251 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
252 }
253
232 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { 254 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
233 switch (id) { 255 switch (id) {
234 case kWindowSwitchAccelerator: 256 case kWindowSwitchAccelerator:
235 window_manager_client()->ActivateNextWindow(); 257 window_manager_client()->ActivateNextWindow();
236 break; 258 break;
237 default: 259 default:
238 window_manager_app_->OnAccelerator(id, event); 260 window_manager_app_->OnAccelerator(id, event);
239 break; 261 break;
240 } 262 }
241 } 263 }
242 264
243 void WindowManager::OnWmPerformMoveLoop(
244 ::mus::Window* window,
245 ::mus::mojom::MoveLoopSource source,
246 const gfx::Point& cursor_location,
247 const base::Callback<void(bool)>& on_done) {
248 NOTIMPLEMENTED();
249 }
250
251 void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
252 NOTIMPLEMENTED();
253 }
254
255 } // namespace mus 265 } // namespace mus
256 } // namespace ash 266 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698