summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authorjamiewalch <jamiewalch@chromium.org>2016-03-04 15:46:15 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-04 23:47:50 +0000
commit14ece3d4e77348d546b4d6837704f78ab0068e31 (patch)
treeb4e57d78a84752561586feedb90ffeb63cc15ed7 /remoting/protocol
parenta7975217b5abac7adb3286ad1e0ab9da33f101cc (diff)
downloadchromium_src-14ece3d4e77348d546b4d6837704f78ab0068e31.zip
chromium_src-14ece3d4e77348d546b4d6837704f78ab0068e31.tar.gz
chromium_src-14ece3d4e77348d546b4d6837704f78ab0068e31.tar.bz2
Notify normalizing input filters on blur.
Previously, ReleaseAllKeys was not notifying the normalizing input filter because that filter exists above InputEventTracker in the input pipeline. In fact, the input "pipeline" was more like a tree, with both the touch input scaler and the pepper input handler feeding into the input tracker. This CL establishes a linear pipeline, as described in the header comment. BUG=590404 Review URL: https://codereview.chromium.org/1760633003 Cr-Commit-Position: refs/heads/master@{#379398}
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/input_event_tracker.cc13
-rw-r--r--remoting/protocol/input_event_tracker.h11
2 files changed, 19 insertions, 5 deletions
diff --git a/remoting/protocol/input_event_tracker.cc b/remoting/protocol/input_event_tracker.cc
index 60c4bfd..c232c01 100644
--- a/remoting/protocol/input_event_tracker.cc
+++ b/remoting/protocol/input_event_tracker.cc
@@ -10,9 +10,10 @@
namespace remoting {
namespace protocol {
+InputEventTracker::InputEventTracker() {}
+
InputEventTracker::InputEventTracker(InputStub* input_stub)
- : input_stub_(input_stub),
- mouse_button_state_(0) {
+ : input_stub_(input_stub) {
}
InputEventTracker::~InputEventTracker() {}
@@ -26,6 +27,8 @@ int InputEventTracker::PressedKeyCount() const {
}
void InputEventTracker::ReleaseAll() {
+ DCHECK(input_stub_);
+
// Release all pressed keys.
for (auto keycode : pressed_keys_) {
KeyEvent event;
@@ -91,6 +94,8 @@ void InputEventTracker::ReleaseAllIfModifiersStuck(bool alt_expected,
}
void InputEventTracker::InjectKeyEvent(const KeyEvent& event) {
+ DCHECK(input_stub_);
+
// We don't need to track the keyboard lock states of key down events.
// Pressed keys will be released with |lock_states| set to 0.
// The lock states of auto generated key up events don't matter as long as
@@ -108,10 +113,13 @@ void InputEventTracker::InjectKeyEvent(const KeyEvent& event) {
}
void InputEventTracker::InjectTextEvent(const TextEvent& event) {
+ DCHECK(input_stub_);
input_stub_->InjectTextEvent(event);
}
void InputEventTracker::InjectMouseEvent(const MouseEvent& event) {
+ DCHECK(input_stub_);
+
if (event.has_x() && event.has_y()) {
mouse_pos_ = webrtc::DesktopVector(event.x(), event.y());
}
@@ -130,6 +138,7 @@ void InputEventTracker::InjectMouseEvent(const MouseEvent& event) {
}
void InputEventTracker::InjectTouchEvent(const TouchEvent& event) {
+ DCHECK(input_stub_);
// We only need the IDs to cancel all touch points in ReleaseAll(). Other
// fields do not have to be tracked here as long as the host keeps track of
// them.
diff --git a/remoting/protocol/input_event_tracker.h b/remoting/protocol/input_event_tracker.h
index ff19b1d..1511fa5 100644
--- a/remoting/protocol/input_event_tracker.h
+++ b/remoting/protocol/input_event_tracker.h
@@ -23,9 +23,14 @@ namespace protocol {
// |input_stub| for all currently-pressed keys and buttons when necessary.
class InputEventTracker : public InputStub {
public:
- explicit InputEventTracker(protocol::InputStub* input_stub);
+ InputEventTracker();
+ explicit InputEventTracker(InputStub* input_stub);
~InputEventTracker() override;
+ void set_input_stub(InputStub* input_stub) {
+ input_stub_ = input_stub;
+ }
+
// Returns true if the key with the specified USB code is currently pressed.
bool IsKeyPressed(ui::DomCode usb_keycode) const;
@@ -49,12 +54,12 @@ class InputEventTracker : public InputStub {
void InjectTouchEvent(const TouchEvent& event) override;
private:
- protocol::InputStub* input_stub_;
+ InputStub* input_stub_ = nullptr;
std::set<ui::DomCode> pressed_keys_;
webrtc::DesktopVector mouse_pos_;
- uint32_t mouse_button_state_;
+ uint32_t mouse_button_state_ = 0;
std::set<uint32_t> touch_point_ids_;