Chromium Code Reviews| 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 "mash/wm/frame/move_event_handler.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/window.h" | 7 #include "components/mus/public/cpp/window.h" |
| 8 #include "components/mus/public/interfaces/cursor.mojom.h" | 8 #include "components/mus/public/interfaces/cursor.mojom.h" |
| 9 #include "mash/wm/frame/move_loop.h" | 9 #include "mash/wm/frame/move_loop.h" |
| 10 #include "mojo/converters/input_events/input_events_type_converters.h" | 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 } | 51 } |
| 52 | 52 |
| 53 MoveEventHandler::~MoveEventHandler() { | 53 MoveEventHandler::~MoveEventHandler() { |
| 54 Detach(); | 54 Detach(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void MoveEventHandler::ProcessLocatedEvent(ui::LocatedEvent* event) { | 57 void MoveEventHandler::ProcessLocatedEvent(ui::LocatedEvent* event) { |
| 58 const bool had_move_loop = move_loop_.get() != nullptr; | 58 const bool had_move_loop = move_loop_.get() != nullptr; |
| 59 DCHECK(event->IsMouseEvent() || event->IsTouchEvent()); | 59 DCHECK(event->IsMouseEvent() || event->IsTouchEvent()); |
| 60 | 60 |
| 61 // Non-client buttons like the close box capture the mouse during clicks. | |
| 62 // Explicitly ignore those events here instead of below because there is no | |
| 63 // PointerEvent equivalent into which the event can be converted. | |
| 64 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) | |
|
msw
2016/03/29 15:47:40
The PointerEvent ctors will NOTREACHED on other mo
James Cook
2016/03/29 17:38:07
Yeah, good point. I talked to Sadrul and we decid
| |
| 65 return; | |
| 66 | |
| 61 // TODO(moshayedi): no need for this once MoveEventHandler directly receives | 67 // TODO(moshayedi): no need for this once MoveEventHandler directly receives |
| 62 // pointer events. | 68 // pointer events. |
| 63 scoped_ptr<ui::PointerEvent> pointer_event; | 69 scoped_ptr<ui::PointerEvent> pointer_event; |
| 64 if (event->IsMouseEvent()) | 70 if (event->IsMouseEvent()) |
| 65 pointer_event.reset(new ui::PointerEvent(*event->AsMouseEvent())); | 71 pointer_event.reset(new ui::PointerEvent(*event->AsMouseEvent())); |
| 66 else | 72 else |
| 67 pointer_event.reset(new ui::PointerEvent(*event->AsTouchEvent())); | 73 pointer_event.reset(new ui::PointerEvent(*event->AsTouchEvent())); |
| 68 | 74 |
| 69 if (move_loop_) { | 75 if (move_loop_) { |
| 70 if (move_loop_->Move(*pointer_event.get()) == MoveLoop::DONE) | 76 if (move_loop_->Move(*pointer_event.get()) == MoveLoop::DONE) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 event->SetHandled(); | 120 event->SetHandled(); |
| 115 } | 121 } |
| 116 | 122 |
| 117 void MoveEventHandler::OnWindowDestroying(aura::Window* window) { | 123 void MoveEventHandler::OnWindowDestroying(aura::Window* window) { |
| 118 DCHECK_EQ(root_window_, window); | 124 DCHECK_EQ(root_window_, window); |
| 119 Detach(); | 125 Detach(); |
| 120 } | 126 } |
| 121 | 127 |
| 122 } // namespace wm | 128 } // namespace wm |
| 123 } // namespace mash | 129 } // namespace mash |
| OLD | NEW |