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

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: Rebase to tot 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
« no previous file with comments | « ash/mus/frame/move_event_handler.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/ui/common/event_matcher_util.h" 22 #include "services/ui/common/event_matcher_util.h"
22 #include "services/ui/common/types.h" 23 #include "services/ui/common/types.h"
23 #include "services/ui/public/cpp/property_type_converters.h" 24 #include "services/ui/public/cpp/property_type_converters.h"
24 #include "services/ui/public/cpp/window.h" 25 #include "services/ui/public/cpp/window.h"
25 #include "services/ui/public/cpp/window_property.h" 26 #include "services/ui/public/cpp/window_property.h"
26 #include "services/ui/public/cpp/window_tree_client.h" 27 #include "services/ui/public/cpp/window_tree_client.h"
27 #include "services/ui/public/interfaces/mus_constants.mojom.h" 28 #include "services/ui/public/interfaces/mus_constants.mojom.h"
28 #include "services/ui/public/interfaces/window_manager.mojom.h" 29 #include "services/ui/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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void WindowManager::OnWmNewDisplay(::ui::Window* window, 230 void WindowManager::OnWmNewDisplay(::ui::Window* window,
229 const display::Display& display) { 231 const display::Display& display) {
230 CreateRootWindowController(window, display); 232 CreateRootWindowController(window, display);
231 } 233 }
232 234
233 void WindowManager::OnWmPerformMoveLoop( 235 void WindowManager::OnWmPerformMoveLoop(
234 ::ui::Window* window, 236 ::ui::Window* window,
235 ::ui::mojom::MoveLoopSource source, 237 ::ui::mojom::MoveLoopSource source,
236 const gfx::Point& cursor_location, 238 const gfx::Point& cursor_location,
237 const base::Callback<void(bool)>& on_done) { 239 const base::Callback<void(bool)>& on_done) {
238 NOTIMPLEMENTED(); 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 == ::ui::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);
239 } 253 }
240 254
241 void WindowManager::OnWmCancelMoveLoop(::ui::Window* window) { 255 void WindowManager::OnWmCancelMoveLoop(::ui::Window* window) {
242 NOTIMPLEMENTED(); 256 WmWindowMus* child_window = WmWindowMus::Get(window);
257 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
258 if (handler)
259 handler->RevertDrag();
243 } 260 }
244 261
245 ui::mojom::EventResult WindowManager::OnAccelerator(uint32_t id, 262 ui::mojom::EventResult WindowManager::OnAccelerator(uint32_t id,
246 const ui::Event& event) { 263 const ui::Event& event) {
247 switch (id) { 264 switch (id) {
248 case kWindowSwitchAccelerator: 265 case kWindowSwitchAccelerator:
249 window_manager_client()->ActivateNextWindow(); 266 window_manager_client()->ActivateNextWindow();
250 break; 267 break;
251 default: 268 default:
252 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, 269 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
253 OnAccelerator(id, event)); 270 OnAccelerator(id, event));
254 break; 271 break;
255 } 272 }
273
256 return ui::mojom::EventResult::HANDLED; 274 return ui::mojom::EventResult::HANDLED;
257 } 275 }
258 276
259 } // namespace mus 277 } // namespace mus
260 } // namespace ash 278 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/frame/move_event_handler.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698