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

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: Add some comments to window finder interface. 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/shadow_controller.h" 19 #include "ash/mus/shadow_controller.h"
19 #include "ash/mus/window_manager_observer.h" 20 #include "ash/mus/window_manager_observer.h"
20 #include "ash/public/interfaces/container.mojom.h" 21 #include "ash/public/interfaces/container.mojom.h"
21 #include "components/mus/common/event_matcher_util.h" 22 #include "components/mus/common/event_matcher_util.h"
22 #include "components/mus/common/types.h" 23 #include "components/mus/common/types.h"
23 #include "components/mus/public/cpp/property_type_converters.h" 24 #include "components/mus/public/cpp/property_type_converters.h"
24 #include "components/mus/public/cpp/window.h" 25 #include "components/mus/public/cpp/window.h"
25 #include "components/mus/public/cpp/window_property.h" 26 #include "components/mus/public/cpp/window_property.h"
26 #include "components/mus/public/cpp/window_tree_client.h" 27 #include "components/mus/public/cpp/window_tree_client.h"
27 #include "components/mus/public/interfaces/mus_constants.mojom.h" 28 #include "components/mus/public/interfaces/mus_constants.mojom.h"
28 #include "components/mus/public/interfaces/window_manager.mojom.h" 29 #include "components/mus/public/interfaces/window_manager.mojom.h"
30 #include "ui/base/hit_test.h"
29 #include "ui/events/mojo/event.mojom.h" 31 #include "ui/events/mojo/event.mojom.h"
30 #include "ui/views/mus/screen_mus.h" 32 #include "ui/views/mus/screen_mus.h"
31 33
32 namespace ash { 34 namespace ash {
33 namespace mus { 35 namespace mus {
34 36
35 const uint32_t kWindowSwitchAccelerator = 1; 37 const uint32_t kWindowSwitchAccelerator = 1;
36 38
37 void AssertTrue(bool success) { 39 void AssertTrue(bool success) {
38 DCHECK(success); 40 DCHECK(success);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 bool janky) { 225 bool janky) {
224 for (auto* window : client_windows) 226 for (auto* window : client_windows)
225 SetWindowIsJanky(window, janky); 227 SetWindowIsJanky(window, janky);
226 } 228 }
227 229
228 void WindowManager::OnWmNewDisplay(::mus::Window* window, 230 void WindowManager::OnWmNewDisplay(::mus::Window* window,
229 const display::Display& display) { 231 const display::Display& display) {
230 CreateRootWindowController(window, display); 232 CreateRootWindowController(window, display);
231 } 233 }
232 234
235 void WindowManager::OnWmPerformMoveLoop(
236 ::mus::Window* window,
237 ::mus::mojom::MoveLoopSource source,
238 const gfx::Point& cursor_location,
239 const base::Callback<void(bool)>& on_done) {
240 WmWindowMus* child_window = WmWindowMus::Get(window);
241 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
242 if (!handler) {
243 on_done.Run(false);
244 return;
245 }
246
247 DCHECK(!handler->IsDragInProgress());
248 aura::client::WindowMoveSource aura_source =
249 source == ::mus::mojom::MoveLoopSource::MOUSE
250 ? aura::client::WINDOW_MOVE_SOURCE_MOUSE
251 : aura::client::WINDOW_MOVE_SOURCE_TOUCH;
252 handler->AttemptToStartDrag(cursor_location, HTCAPTION, aura_source, on_done);
253 }
254
255 void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
256 WmWindowMus* child_window = WmWindowMus::Get(window);
257 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
258 if (handler)
259 handler->RevertDrag();
260 }
261
233 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { 262 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
234 switch (id) { 263 switch (id) {
235 case kWindowSwitchAccelerator: 264 case kWindowSwitchAccelerator:
236 window_manager_client()->ActivateNextWindow(); 265 window_manager_client()->ActivateNextWindow();
237 break; 266 break;
238 default: 267 default:
239 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, 268 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
240 OnAccelerator(id, event)); 269 OnAccelerator(id, event));
241 break; 270 break;
242 } 271 }
243 } 272 }
244 273
245 void WindowManager::OnWmPerformMoveLoop(
246 ::mus::Window* window,
247 ::mus::mojom::MoveLoopSource source,
248 const gfx::Point& cursor_location,
249 const base::Callback<void(bool)>& on_done) {
250 NOTIMPLEMENTED();
251 }
252
253 void WindowManager::OnWmCancelMoveLoop(::mus::Window* window) {
254 NOTIMPLEMENTED();
255 }
256
257 } // namespace mus 274 } // namespace mus
258 } // namespace ash 275 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698