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

Side by Side Diff: ash/mus/window_manager.cc

Issue 2060513002: Tab dragging as implemented as a mus API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: General patch cleanup. 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 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(uint32_t change_id,
235 uint32_t window_id,
236 const gfx::Point& cursor_location) {
237 WmWindowMus* child_window =
238 WmWindowMus::Get(window_tree_client_->GetWindowByServerId(window_id));
239 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
240 handler->AttemptToStartDrag(
241 cursor_location, HTCAPTION,
242 base::Bind(&WindowManager::OnWmMoveLoopCompleted, base::Unretained(this),
243 change_id, window_id));
244 }
245
246 void WindowManager::OnWmCancelMoveLoop(uint32_t window_id) {
247 WmWindowMus* child_window =
248 WmWindowMus::Get(window_tree_client_->GetWindowByServerId(window_id));
249 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
250 handler->RevertDrag();
251 }
252
253 void WindowManager::OnWmMoveLoopCompleted(uint32_t change_id,
254 uint32_t window_id,
255 bool succeeded) {
256 window_manager_client_->OnWmMoveLoopCompleted(change_id, window_id,
257 succeeded);
258 }
259
232 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { 260 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
233 switch (id) { 261 switch (id) {
234 case kWindowSwitchAccelerator: 262 case kWindowSwitchAccelerator:
235 window_manager_client()->ActivateNextWindow(); 263 window_manager_client()->ActivateNextWindow();
236 break; 264 break;
237 default: 265 default:
238 window_manager_app_->OnAccelerator(id, event); 266 window_manager_app_->OnAccelerator(id, event);
239 break; 267 break;
240 } 268 }
241 } 269 }
242 270
243 } // namespace mus 271 } // namespace mus
244 } // namespace ash 272 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698