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

Unified Diff: remoting/client/ui/direct_input_strategy.cc

Issue 2903623002: Moving input related classes to the input folder. (Closed)
Patch Set: Hide gesture code from nacl. Created 3 years, 7 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/client/ui/direct_input_strategy.cc
diff --git a/remoting/client/ui/direct_input_strategy.cc b/remoting/client/ui/direct_input_strategy.cc
deleted file mode 100644
index d84e7754068a29cbc5d8f933e83ac9cf12a7076a..0000000000000000000000000000000000000000
--- a/remoting/client/ui/direct_input_strategy.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2017 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/ui/direct_input_strategy.h"
-#include "remoting/client/ui/desktop_viewport.h"
-
-namespace remoting {
-
-namespace {
-
-const float kTapFeedbackRadius = 25.f;
-const float kDragFeedbackRadius = 55.f;
-
-} // namespace
-
-DirectInputStrategy::DirectInputStrategy() {}
-
-DirectInputStrategy::~DirectInputStrategy() {}
-
-void DirectInputStrategy::HandleZoom(const ViewMatrix::Point& pivot,
- float scale,
- DesktopViewport* viewport) {
- viewport->ScaleDesktop(pivot.x, pivot.y, scale);
-}
-
-bool DirectInputStrategy::HandlePan(const ViewMatrix::Vector2D& translation,
- Gesture simultaneous_gesture,
- DesktopViewport* viewport) {
- if (simultaneous_gesture == DRAG) {
- // If the user is dragging something, we should synchronize the movement
- // with the object that the user is trying to move on the desktop, rather
- // than moving the desktop around.
- ViewMatrix::Vector2D viewport_movement =
- viewport->GetTransformation().Invert().MapVector(translation);
- viewport->MoveViewport(viewport_movement.x, viewport_movement.y);
- return false;
- }
-
- viewport->MoveDesktop(translation.x, translation.y);
- return false;
-}
-
-bool DirectInputStrategy::TrackTouchInput(const ViewMatrix::Point& touch_point,
- const DesktopViewport& viewport) {
- ViewMatrix::Point new_position =
- viewport.GetTransformation().Invert().MapPoint(touch_point);
- if (!viewport.IsPointWithinDesktopBounds(new_position)) {
- return false;
- }
- cursor_position_ = new_position;
- return true;
-}
-
-ViewMatrix::Point DirectInputStrategy::GetCursorPosition() const {
- return cursor_position_;
-}
-
-ViewMatrix::Vector2D DirectInputStrategy::MapScreenVectorToDesktop(
- const ViewMatrix::Vector2D& delta,
- const DesktopViewport& viewport) const {
- return viewport.GetTransformation().Invert().MapVector(delta);
-}
-
-float DirectInputStrategy::GetFeedbackRadius(InputFeedbackType type) const {
- switch (type) {
- case InputFeedbackType::TAP_FEEDBACK:
- return kTapFeedbackRadius;
- case InputFeedbackType::DRAG_FEEDBACK:
- return kDragFeedbackRadius;
- }
- NOTREACHED();
- return 0.f;
-}
-
-bool DirectInputStrategy::IsCursorVisible() const {
- return false;
-}
-
-} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698