| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/remote_input_filter.h" | 5 #include "remoting/host/remote_input_filter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "remoting/proto/event.pb.h" | 8 #include "remoting/proto/event.pb.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 injected_mouse_positions_.push_back( | 88 injected_mouse_positions_.push_back( |
| 89 webrtc::DesktopVector(event.x(), event.y())); | 89 webrtc::DesktopVector(event.x(), event.y())); |
| 90 if (injected_mouse_positions_.size() > kNumRemoteMousePositions) { | 90 if (injected_mouse_positions_.size() > kNumRemoteMousePositions) { |
| 91 VLOG(1) << "Injected mouse positions queue full."; | 91 VLOG(1) << "Injected mouse positions queue full."; |
| 92 injected_mouse_positions_.pop_front(); | 92 injected_mouse_positions_.pop_front(); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 event_tracker_->InjectMouseEvent(event); | 95 event_tracker_->InjectMouseEvent(event); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void RemoteInputFilter::InjectTouchEvent(const protocol::TouchEvent& event) { |
| 99 if (ShouldIgnoreInput()) |
| 100 return; |
| 101 event_tracker_->InjectTouchEvent(event); |
| 102 } |
| 103 |
| 98 bool RemoteInputFilter::ShouldIgnoreInput() const { | 104 bool RemoteInputFilter::ShouldIgnoreInput() const { |
| 99 // Ignore remote events if the local mouse moved recently. | 105 // Ignore remote events if the local mouse moved recently. |
| 100 int64 millis = | 106 int64 millis = |
| 101 (base::TimeTicks::Now() - latest_local_input_time_).InMilliseconds(); | 107 (base::TimeTicks::Now() - latest_local_input_time_).InMilliseconds(); |
| 102 if (millis < kRemoteBlockTimeoutMillis) | 108 if (millis < kRemoteBlockTimeoutMillis) |
| 103 return true; | 109 return true; |
| 104 return false; | 110 return false; |
| 105 } | 111 } |
| 106 | 112 |
| 107 } // namespace remoting | 113 } // namespace remoting |
| OLD | NEW |