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

Unified Diff: remoting/protocol/mouse_input_filter.cc

Issue 10255007: Clamp events before they are sent to EventExecutors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo. Created 8 years, 8 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 | « remoting/protocol/mouse_input_filter.h ('k') | remoting/protocol/mouse_input_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/mouse_input_filter.cc
diff --git a/remoting/client/mouse_input_filter.cc b/remoting/protocol/mouse_input_filter.cc
similarity index 72%
rename from remoting/client/mouse_input_filter.cc
rename to remoting/protocol/mouse_input_filter.cc
index 00d981d0c97df916cd56107615991c707255d432..d4677765f7628311928acad933440dc76c632f7b 100644
--- a/remoting/client/mouse_input_filter.cc
+++ b/remoting/protocol/mouse_input_filter.cc
@@ -1,15 +1,16 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/client/mouse_input_filter.h"
+#include "remoting/protocol/mouse_input_filter.h"
#include "remoting/proto/event.pb.h"
namespace remoting {
+namespace protocol {
-MouseInputFilter::MouseInputFilter(protocol::InputStub* input_stub)
- : input_stub_(input_stub) {
+MouseInputFilter::MouseInputFilter(InputStub* input_stub)
+ : InputFilter(input_stub) {
input_max_.setEmpty();
output_max_.setEmpty();
}
@@ -17,11 +18,7 @@ MouseInputFilter::MouseInputFilter(protocol::InputStub* input_stub)
MouseInputFilter::~MouseInputFilter() {
}
-void MouseInputFilter::InjectKeyEvent(const protocol::KeyEvent& event) {
- input_stub_->InjectKeyEvent(event);
-}
-
-void MouseInputFilter::InjectMouseEvent(const protocol::MouseEvent& event) {
+void MouseInputFilter::InjectMouseEvent(const MouseEvent& event) {
if (input_max_.isEmpty() || output_max_.isEmpty())
return;
@@ -29,7 +26,7 @@ void MouseInputFilter::InjectMouseEvent(const protocol::MouseEvent& event) {
// input and output sizes, so that it's possible to reach the edge of the
// output when up-scaling. We also take care to round up or down correctly,
// which is important when down-scaling.
- protocol::MouseEvent out_event(event);
+ MouseEvent out_event(event);
if (out_event.has_x()) {
int x = out_event.x() * output_max_.width();
x = (x + input_max_.width() / 2) / input_max_.width();
@@ -41,7 +38,7 @@ void MouseInputFilter::InjectMouseEvent(const protocol::MouseEvent& event) {
out_event.set_y(std::max(0, std::min(output_max_.height(), y)));
}
- input_stub_->InjectMouseEvent(out_event);
+ InputFilter::InjectMouseEvent(out_event);
}
void MouseInputFilter::set_input_size(const SkISize& size) {
@@ -52,4 +49,5 @@ void MouseInputFilter::set_output_size(const SkISize& size) {
output_max_ = SkISize::Make(size.width() - 1, size.height() - 1);
}
+} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/mouse_input_filter.h ('k') | remoting/protocol/mouse_input_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698