OLD | NEW |
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 Loading... |
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(cursor_location, HTCAPTION, |
| 241 base::Bind(&WindowManager::OnWmMoveLoopCompleted, |
| 242 base::Unretained(this), change_id)); |
| 243 } |
| 244 |
| 245 void WindowManager::OnWmCancelMoveLoop(uint32_t window_id) { |
| 246 WmWindowMus* child_window = |
| 247 WmWindowMus::Get(window_tree_client_->GetWindowByServerId(window_id)); |
| 248 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window); |
| 249 handler->RevertDrag(); |
| 250 } |
| 251 |
| 252 void WindowManager::OnWmMoveLoopCompleted(uint32_t change_id, bool succeeded) { |
| 253 window_manager_client_->OnWmMoveLoopCompleted(change_id, succeeded); |
| 254 } |
| 255 |
232 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { | 256 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { |
233 switch (id) { | 257 switch (id) { |
234 case kWindowSwitchAccelerator: | 258 case kWindowSwitchAccelerator: |
235 window_manager_client()->ActivateNextWindow(); | 259 window_manager_client()->ActivateNextWindow(); |
236 break; | 260 break; |
237 default: | 261 default: |
238 window_manager_app_->OnAccelerator(id, event); | 262 window_manager_app_->OnAccelerator(id, event); |
239 break; | 263 break; |
240 } | 264 } |
241 } | 265 } |
242 | 266 |
243 void WindowManager::OnWmPerformMoveLoop(uint32_t change_id, | |
244 uint32_t window_id, | |
245 const gfx::Point& cursor_location) { | |
246 NOTIMPLEMENTED(); | |
247 } | |
248 | |
249 void WindowManager::OnWmCancelMoveLoop(uint32_t window_id) { | |
250 NOTIMPLEMENTED(); | |
251 } | |
252 | |
253 } // namespace mus | 267 } // namespace mus |
254 } // namespace ash | 268 } // namespace ash |
OLD | NEW |