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

Unified Diff: remoting/protocol/input_event_tracker.cc

Issue 799233004: Add touch events to the protocol, the stub layer, and to the client plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more comments to event proto Created 5 years, 11 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
Index: remoting/protocol/input_event_tracker.cc
diff --git a/remoting/protocol/input_event_tracker.cc b/remoting/protocol/input_event_tracker.cc
index 446a4b623898424f8e94afa7ead2a3e2d66175e7..d882d60330950f6c6201522330a119ae319c6e56 100644
--- a/remoting/protocol/input_event_tracker.cc
+++ b/remoting/protocol/input_event_tracker.cc
@@ -5,6 +5,7 @@
#include "remoting/protocol/input_event_tracker.h"
#include "base/logging.h"
+#include "base/stl_util.h"
#include "remoting/proto/event.pb.h"
namespace remoting {
@@ -51,6 +52,18 @@ void InputEventTracker::ReleaseAll() {
}
}
mouse_button_state_ = 0;
+
+ if (!touch_point_ids_.empty()) {
+ TouchEvent cancel_all_touch_event;
+ cancel_all_touch_event.set_event_type(TouchEvent::TOUCH_POINT_CANCEL);
+ for (uint32 touch_point_id : touch_point_ids_) {
+ TouchEventPoint* point = cancel_all_touch_event.add_touch_points();
+ point->set_id(touch_point_id);
+ }
+ input_stub_->InjectTouchEvent(cancel_all_touch_event);
+ touch_point_ids_.clear();
+ }
+ DCHECK(touch_point_ids_.empty());
}
void InputEventTracker::InjectKeyEvent(const KeyEvent& event) {
@@ -92,5 +105,28 @@ void InputEventTracker::InjectMouseEvent(const MouseEvent& event) {
input_stub_->InjectMouseEvent(event);
}
+void InputEventTracker::InjectTouchEvent(const TouchEvent& event) {
+ switch (event.event_type()) {
Wez 2015/02/05 02:09:07 nit: Consider noting (similarly to InjectKeyEvent'
Rintaro Kuroiwa 2015/02/06 23:35:01 Done.
+ case TouchEvent::TOUCH_POINT_START:
+ for (const TouchEventPoint& touch_point : event.touch_points()) {
+ DCHECK(touch_point_ids_.find(touch_point.id()) ==
+ touch_point_ids_.end());
+ touch_point_ids_.insert(touch_point.id());
+ }
+ break;
+ case TouchEvent::TOUCH_POINT_END:
+ case TouchEvent::TOUCH_POINT_CANCEL:
+ for (const TouchEventPoint& touch_point : event.touch_points()) {
+ DCHECK(touch_point_ids_.find(touch_point.id()) !=
+ touch_point_ids_.end());
+ touch_point_ids_.erase(touch_point.id());
+ }
+ break;
+ default:
+ break;
+ }
+ input_stub_->InjectTouchEvent(event);
+}
+
} // namespace protocol
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698