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

Unified Diff: mash/wm/frame/move_event_handler.cc

Issue 1814533002: Use ui::Event instead of mojom::EventPtr in mash/wm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_eventptr
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/window_manager_client_unittest.cc ('k') | mash/wm/frame/move_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/frame/move_event_handler.cc
diff --git a/mash/wm/frame/move_event_handler.cc b/mash/wm/frame/move_event_handler.cc
index 448e51ad784580de774b1811e24252513e7dc72f..256e0aa88d32b6a18a79fa2acdbf0621d787dcec 100644
--- a/mash/wm/frame/move_event_handler.cc
+++ b/mash/wm/frame/move_event_handler.cc
@@ -56,20 +56,27 @@ MoveEventHandler::~MoveEventHandler() {
void MoveEventHandler::ProcessLocatedEvent(ui::LocatedEvent* event) {
const bool had_move_loop = move_loop_.get() != nullptr;
- ui::Event* ui_event = static_cast<ui::Event*>(event);
+ DCHECK(event->IsMouseEvent() || event->IsTouchEvent());
+
+ // TODO(moshayedi): no need for this once MoveEventHandler directly receives
+ // pointer events.
+ scoped_ptr<ui::PointerEvent> pointer_event;
+ if (event->IsMouseEvent())
+ pointer_event.reset(new ui::PointerEvent(*event->AsMouseEvent()));
+ else
+ pointer_event.reset(new ui::PointerEvent(*event->AsTouchEvent()));
+
if (move_loop_) {
- if (move_loop_->Move(*mus::mojom::Event::From(*ui_event)) == MoveLoop::DONE)
+ if (move_loop_->Move(*pointer_event.get()) == MoveLoop::DONE)
move_loop_.reset();
- } else if (event->type() == ui::ET_MOUSE_PRESSED ||
- event->type() == ui::ET_TOUCH_PRESSED) {
- const int ht_location = GetNonClientComponentForEvent(event);
+ } else if (pointer_event->type() == ui::ET_POINTER_DOWN) {
+ const int ht_location = GetNonClientComponentForEvent(pointer_event.get());
if (ht_location != HTNOWHERE) {
- // TODO(sky): convert MoveLoop to take ui::Event.
- move_loop_ = MoveLoop::Create(mus_window_, ht_location,
- *mus::mojom::Event::From(*ui_event));
+ move_loop_ =
+ MoveLoop::Create(mus_window_, ht_location, *pointer_event.get());
}
- } else if (event->type() == ui::ET_MOUSE_MOVED) {
- const int ht_location = GetNonClientComponentForEvent(event);
+ } else if (pointer_event->type() == ui::ET_POINTER_MOVED) {
+ const int ht_location = GetNonClientComponentForEvent(pointer_event.get());
mus_window_->SetPredefinedCursor(CursorForWindowComponent(ht_location));
}
if (had_move_loop || move_loop_)
« no previous file with comments | « components/mus/ws/window_manager_client_unittest.cc ('k') | mash/wm/frame/move_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698