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

Side by Side Diff: components/mus/gesture_manager.cc

Issue 1313353010: Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed gn check Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « components/mus/event_dispatcher.cc ('k') | components/mus/gesture_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/mus/gesture_manager.h" 5 #include "components/mus/gesture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "components/mus/gesture_manager_delegate.h" 9 #include "components/mus/gesture_manager_delegate.h"
10 #include "components/mus/public/cpp/keys.h" 10 #include "components/mus/public/cpp/keys.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // TODO(sky): I'm doing this until things are converted. Seems as though we 48 // TODO(sky): I'm doing this until things are converted. Seems as though we
49 // shouldn't do this long term. 49 // shouldn't do this long term.
50 if (result.empty()) 50 if (result.empty())
51 result.push_back(deepest); 51 result.push_back(deepest);
52 return result; 52 return result;
53 } 53 }
54 54
55 mojo::EventPtr CloneEventForView(const mojo::Event& event, 55 mojo::EventPtr CloneEventForView(const mojo::Event& event,
56 const ServerView* view) { 56 const ServerView* view) {
57 mojo::EventPtr result(event.Clone()); 57 mojo::EventPtr result(event.Clone());
58 const gfx::PointF location(event.pointer_data->x, event.pointer_data->y); 58 const gfx::PointF location(event.pointer_data->location->x,
59 event.pointer_data->location->y);
59 const gfx::PointF target_location( 60 const gfx::PointF target_location(
60 ConvertPointFBetweenViews(view->GetRoot(), view, location)); 61 ConvertPointFBetweenViews(view->GetRoot(), view, location));
61 result->pointer_data->x = target_location.x(); 62 result->pointer_data->location->x = target_location.x();
62 result->pointer_data->y = target_location.y(); 63 result->pointer_data->location->y = target_location.y();
63 return result.Pass(); 64 return result.Pass();
64 } 65 }
65 66
66 } // namespace 67 } // namespace
67 68
68 // GestureStateChange ---------------------------------------------------------- 69 // GestureStateChange ----------------------------------------------------------
69 70
70 GestureStateChange::GestureStateChange() 71 GestureStateChange::GestureStateChange()
71 : chosen_gesture(GestureManager::kInvalidGestureId) {} 72 : chosen_gesture(GestureManager::kInvalidGestureId) {}
72 73
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // Explicitly delete the pointers first as this may result in calling back to 532 // Explicitly delete the pointers first as this may result in calling back to
532 // us to cleanup and delete gestures. 533 // us to cleanup and delete gestures.
533 active_pointers_.clear(); 534 active_pointers_.clear();
534 } 535 }
535 536
536 bool GestureManager::ProcessEvent(const mojo::Event& event) { 537 bool GestureManager::ProcessEvent(const mojo::Event& event) {
537 if (!event.pointer_data) 538 if (!event.pointer_data)
538 return false; 539 return false;
539 540
540 ScheduledDeleteProcessor delete_processor(this); 541 ScheduledDeleteProcessor delete_processor(this);
541 const gfx::Point location(static_cast<int>(event.pointer_data->x), 542 const gfx::Point location(static_cast<int>(event.pointer_data->location->x),
542 static_cast<int>(event.pointer_data->y)); 543 static_cast<int>(event.pointer_data->location->y));
543 switch (event.action) { 544 switch (event.action) {
544 case mojo::EVENT_TYPE_POINTER_DOWN: { 545 case mojo::EVENT_TYPE_POINTER_DOWN: {
545 if (GetPointerById(event.pointer_data->pointer_id)) { 546 if (GetPointerById(event.pointer_data->pointer_id)) {
546 DVLOG(1) << "received more than one down for a pointer without a " 547 DVLOG(1) << "received more than one down for a pointer without a "
547 << "corresponding up, id=" << event.pointer_data->pointer_id; 548 << "corresponding up, id=" << event.pointer_data->pointer_id;
548 NOTREACHED(); 549 NOTREACHED();
549 return true; 550 return true;
550 } 551 }
551 552
552 const ServerView* deepest = FindDeepestVisibleView(root_view_, location); 553 const ServerView* deepest = FindDeepestVisibleView(root_view_, location);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 void GestureManager::ScheduleDelete(Pointer* pointer) { 687 void GestureManager::ScheduleDelete(Pointer* pointer) {
687 auto iter = 688 auto iter =
688 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); 689 std::find(active_pointers_.begin(), active_pointers_.end(), pointer);
689 if (iter != active_pointers_.end()) { 690 if (iter != active_pointers_.end()) {
690 active_pointers_.weak_erase(iter); 691 active_pointers_.weak_erase(iter);
691 pointers_to_delete_.push_back(pointer); 692 pointers_to_delete_.push_back(pointer);
692 } 693 }
693 } 694 }
694 695
695 } // namespace mus 696 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/event_dispatcher.cc ('k') | components/mus/gesture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698