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 "mash/wm/frame/move_event_handler.h" | 5 #include "ash/mus/frame/move_event_handler.h" |
6 | 6 |
| 7 #include "ash/mus/bridge/wm_window_mus.h" |
7 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
8 #include "components/mus/public/cpp/window_manager_delegate.h" | 9 #include "components/mus/public/cpp/window_manager_delegate.h" |
9 #include "components/mus/public/interfaces/cursor.mojom.h" | 10 #include "components/mus/public/interfaces/cursor.mojom.h" |
10 #include "mash/wm/bridge/wm_window_mus.h" | |
11 #include "mash/wm/bridge/wm_window_mus.h" | |
12 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
13 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
14 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
15 | 14 |
16 namespace mash { | 15 namespace ash { |
17 namespace wm { | 16 namespace mus { |
18 namespace { | 17 namespace { |
19 | 18 |
20 mus::mojom::Cursor CursorForWindowComponent(int window_component) { | 19 ::mus::mojom::Cursor CursorForWindowComponent(int window_component) { |
21 switch (window_component) { | 20 switch (window_component) { |
22 case HTBOTTOM: | 21 case HTBOTTOM: |
23 return mus::mojom::Cursor::SOUTH_RESIZE; | 22 return ::mus::mojom::Cursor::SOUTH_RESIZE; |
24 case HTBOTTOMLEFT: | 23 case HTBOTTOMLEFT: |
25 return mus::mojom::Cursor::SOUTH_WEST_RESIZE; | 24 return ::mus::mojom::Cursor::SOUTH_WEST_RESIZE; |
26 case HTBOTTOMRIGHT: | 25 case HTBOTTOMRIGHT: |
27 return mus::mojom::Cursor::SOUTH_EAST_RESIZE; | 26 return ::mus::mojom::Cursor::SOUTH_EAST_RESIZE; |
28 case HTLEFT: | 27 case HTLEFT: |
29 return mus::mojom::Cursor::WEST_RESIZE; | 28 return ::mus::mojom::Cursor::WEST_RESIZE; |
30 case HTRIGHT: | 29 case HTRIGHT: |
31 return mus::mojom::Cursor::EAST_RESIZE; | 30 return ::mus::mojom::Cursor::EAST_RESIZE; |
32 case HTTOP: | 31 case HTTOP: |
33 return mus::mojom::Cursor::NORTH_RESIZE; | 32 return ::mus::mojom::Cursor::NORTH_RESIZE; |
34 case HTTOPLEFT: | 33 case HTTOPLEFT: |
35 return mus::mojom::Cursor::NORTH_WEST_RESIZE; | 34 return ::mus::mojom::Cursor::NORTH_WEST_RESIZE; |
36 case HTTOPRIGHT: | 35 case HTTOPRIGHT: |
37 return mus::mojom::Cursor::NORTH_EAST_RESIZE; | 36 return ::mus::mojom::Cursor::NORTH_EAST_RESIZE; |
38 default: | 37 default: |
39 return mus::mojom::Cursor::CURSOR_NULL; | 38 return ::mus::mojom::Cursor::CURSOR_NULL; |
40 } | 39 } |
41 } | 40 } |
42 | 41 |
43 } // namespace | 42 } // namespace |
44 | 43 |
45 MoveEventHandler::MoveEventHandler( | 44 MoveEventHandler::MoveEventHandler( |
46 mus::Window* mus_window, | 45 ::mus::Window* mus_window, |
47 mus::WindowManagerClient* window_manager_client, | 46 ::mus::WindowManagerClient* window_manager_client, |
48 aura::Window* aura_window) | 47 aura::Window* aura_window) |
49 : wm_window_(WmWindowMus::Get(mus_window)), | 48 : wm_window_(WmWindowMus::Get(mus_window)), |
50 window_manager_client_(window_manager_client), | 49 window_manager_client_(window_manager_client), |
51 root_window_(aura_window->GetRootWindow()), | 50 root_window_(aura_window->GetRootWindow()), |
52 toplevel_window_event_handler_(wm_window_->GetGlobals()) { | 51 toplevel_window_event_handler_(wm_window_->GetGlobals()) { |
53 root_window_->AddObserver(this); | 52 root_window_->AddObserver(this); |
54 root_window_->AddPreTargetHandler(this); | 53 root_window_->AddPreTargetHandler(this); |
55 } | 54 } |
56 | 55 |
57 MoveEventHandler::~MoveEventHandler() { | 56 MoveEventHandler::~MoveEventHandler() { |
(...skipping 27 matching lines...) Expand all Loading... |
85 | 84 |
86 void MoveEventHandler::OnCancelMode(ui::CancelModeEvent* event) { | 85 void MoveEventHandler::OnCancelMode(ui::CancelModeEvent* event) { |
87 toplevel_window_event_handler_.RevertDrag(); | 86 toplevel_window_event_handler_.RevertDrag(); |
88 } | 87 } |
89 | 88 |
90 void MoveEventHandler::OnWindowDestroying(aura::Window* window) { | 89 void MoveEventHandler::OnWindowDestroying(aura::Window* window) { |
91 DCHECK_EQ(root_window_, window); | 90 DCHECK_EQ(root_window_, window); |
92 Detach(); | 91 Detach(); |
93 } | 92 } |
94 | 93 |
95 } // namespace wm | 94 } // namespace mus |
96 } // namespace mash | 95 } // namespace ash |
OLD | NEW |