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