Move fling_controller to //components/input

This is being done as a part of InputVizard project[1] where touch input
handling is being moved to Viz on Android. Earlier we had
been refactoring input related bits from browser classes and placing
them in //content/common/input but since Viz cannot depend on content,
the input code is being moved into //components/input.

[1] https://docs.google.com/document/d/1mcydbkgFCO_TT9NuFE962L8PLJWT2XOfXUAPO88VuKE

Bug: b/340182114
Change-Id: Id072fe6376f4102de9efe3bdb784d29153a3757f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5577376
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Kartar Singh <kartarsingh@google.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312180}
diff --git a/components/input/BUILD.gn b/components/input/BUILD.gn
index 6d07589..b8d82e4 100644
--- a/components/input/BUILD.gn
+++ b/components/input/BUILD.gn
@@ -12,6 +12,8 @@
   defines = [ "IS_INPUT_IMPL" ]
   sources = [
     "event_with_latency_info.h",
+    "fling_controller.cc",
+    "fling_controller.h",
     "native_web_keyboard_event.h",
     "tap_suppression_controller.cc",
     "tap_suppression_controller.h",
@@ -27,6 +29,7 @@
     "//ui/events:events",
     "//ui/events:events_base",
     "//ui/events/blink:blink",
+    "//ui/events/gestures/blink",
   ]
   if (use_aura) {
     sources += [ "native_web_keyboard_event_aura.cc" ]
@@ -63,13 +66,16 @@
   testonly = true
   sources = [
     "event_with_latency_info_unittest.cc",
+    "fling_controller_unittest.cc",
     "tap_suppression_controller_unittest.cc",
   ]
   deps = [
     ":input",
     "//base:base",
+    "//base/test:test_support",
     "//testing/gtest",
     "//third_party/blink/public/common:headers",
+    "//ui/base:features",
     "//ui/events:dom_keycode_converter",
     "//ui/events:events",
     "//ui/events:test_support",
diff --git a/components/input/DEPS b/components/input/DEPS
index 9ebeb19..dbc78990 100644
--- a/components/input/DEPS
+++ b/components/input/DEPS
@@ -1,5 +1,6 @@
 include_rules = [
   "+third_party/blink/public",
+  "+ui/base",
   "+ui/events",
   "+ui/gfx",
   "+ui/latency",
diff --git a/content/common/input/fling_controller.cc b/components/input/fling_controller.cc
similarity index 95%
rename from content/common/input/fling_controller.cc
rename to components/input/fling_controller.cc
index 05d1b88..b777a5339 100644
--- a/content/common/input/fling_controller.cc
+++ b/components/input/fling_controller.cc
@@ -2,11 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "content/common/input/fling_controller.h"
+#include "components/input/fling_controller.h"
 
 #include "base/time/default_tick_clock.h"
 #include "base/trace_event/trace_event.h"
-#include "content/public/common/content_client.h"
 #include "ui/events/base_event_utils.h"
 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
 
@@ -35,7 +34,7 @@
 
 }  // namespace
 
-namespace content {
+namespace input {
 
 FlingController::Config::Config() {}
 
@@ -57,7 +56,7 @@
 FlingController::~FlingController() = default;
 
 bool FlingController::ObserveAndFilterForTapSuppression(
-    const input::GestureEventWithLatencyInfo& gesture_event) {
+    const GestureEventWithLatencyInfo& gesture_event) {
   switch (gesture_event.event.GetType()) {
     case WebInputEvent::Type::kGestureFlingCancel:
       // The controllers' state is affected by the cancel event and assumes
@@ -93,7 +92,7 @@
 }
 
 bool FlingController::ObserveAndMaybeConsumeGestureEvent(
-    const input::GestureEventWithLatencyInfo& gesture_event) {
+    const GestureEventWithLatencyInfo& gesture_event) {
   TRACE_EVENT0("input", "FlingController::ObserveAndMaybeConsumeGestureEvent");
   // FlingCancel events arrive when a finger is touched down regardless of
   // whether there is an ongoing fling. These can affect state so if there's no
@@ -148,7 +147,7 @@
 }
 
 void FlingController::ProcessGestureFlingStart(
-    const input::GestureEventWithLatencyInfo& gesture_event) {
+    const GestureEventWithLatencyInfo& gesture_event) {
   // Don't start a touchpad gesture fling if the previous scroll events were
   // consumed.
   if (gesture_event.event.SourceDevice() ==
@@ -180,7 +179,7 @@
 }
 
 void FlingController::ProcessGestureFlingCancel(
-    const input::GestureEventWithLatencyInfo& gesture_event) {
+    const GestureEventWithLatencyInfo& gesture_event) {
   DCHECK(fling_curve_);
 
   // Note: We don't want to reset the fling booster here because a FlingCancel
@@ -263,7 +262,7 @@
     base::TimeTicks current_time,
     const gfx::Vector2dF& delta,
     blink::WebMouseWheelEvent::Phase phase) {
-  input::MouseWheelEventWithLatencyInfo synthetic_wheel(
+  MouseWheelEventWithLatencyInfo synthetic_wheel(
       WebInputEvent::Type::kMouseWheel, current_fling_parameters_.modifiers,
       current_time, ui::LatencyInfo(ui::SourceEventType::WHEEL));
   synthetic_wheel.event.delta_units =
@@ -286,7 +285,7 @@
     base::TimeTicks current_time,
     WebInputEvent::Type type,
     const gfx::Vector2dF& delta /* = gfx::Vector2dF() */) {
-  input::GestureEventWithLatencyInfo synthetic_gesture(
+  GestureEventWithLatencyInfo synthetic_gesture(
       type, current_fling_parameters_.modifiers, current_time,
       ui::LatencyInfo(ui::SourceEventType::INERTIAL));
   synthetic_gesture.event.SetPositionInWidget(current_fling_parameters_.point);
@@ -425,15 +424,14 @@
   // fling can travel based on physics based fling curve.
   float boost_multiplier = max_velocity / max_velocity_from_gfs;
 
-  fling_curve_ = std::unique_ptr<blink::WebGestureCurve>(
-      ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve(
+  fling_curve_ = ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve(
           current_fling_parameters_.source_device,
           current_fling_parameters_.velocity,
           gfx::Vector2dF() /*initial_offset*/, false /*on_main_thread*/,
           scheduler_client_->ShouldUseMobileFlingCurve(),
           scheduler_client_->GetPixelsPerInch(
               current_fling_parameters_.global_point),
-          boost_multiplier, root_widget_viewport_size));
+          boost_multiplier, root_widget_viewport_size);
   return true;
 }
 
@@ -441,17 +439,17 @@
   return current_fling_parameters_.velocity;
 }
 
-input::TouchpadTapSuppressionController*
+TouchpadTapSuppressionController*
 FlingController::GetTouchpadTapSuppressionController() {
   return &touchpad_tap_suppression_controller_;
 }
 
 void FlingController::OnWheelEventAck(
-    const input::MouseWheelEventWithLatencyInfo& event,
+    const MouseWheelEventWithLatencyInfo& event,
     blink::mojom::InputEventResultSource ack_source,
     blink::mojom::InputEventResultState ack_result) {
   last_wheel_event_consumed_ =
       (ack_result == blink::mojom::InputEventResultState::kConsumed);
 }
 
-}  // namespace content
+}  // namespace input
diff --git a/content/common/input/fling_controller.h b/components/input/fling_controller.h
similarity index 83%
rename from content/common/input/fling_controller.h
rename to components/input/fling_controller.h
index 860cae0..3413e551 100644
--- a/content/common/input/fling_controller.h
+++ b/components/input/fling_controller.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CONTENT_COMMON_INPUT_FLING_CONTROLLER_H_
-#define CONTENT_COMMON_INPUT_FLING_CONTROLLER_H_
+#ifndef COMPONENTS_INPUT_FLING_CONTROLLER_H_
+#define COMPONENTS_INPUT_FLING_CONTROLLER_H_
 
+#include "base/component_export.h"
 #include "base/memory/raw_ptr.h"
 #include "base/time/time.h"
 #include "components/input/touchpad_tap_suppression_controller.h"
 #include "components/input/touchscreen_tap_suppression_controller.h"
-#include "content/common/content_export.h"
 #include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
 #include "ui/events/blink/fling_booster.h"
 
@@ -17,7 +17,7 @@
 class WebGestureCurve;
 }
 
-namespace content {
+namespace input {
 
 class FlingController;
 
@@ -25,22 +25,22 @@
 
 // Interface with which the FlingController can forward generated fling progress
 // events.
-class CONTENT_EXPORT FlingControllerEventSenderClient {
+class COMPONENT_EXPORT(INPUT) FlingControllerEventSenderClient {
  public:
   virtual ~FlingControllerEventSenderClient() {}
 
   virtual void SendGeneratedWheelEvent(
-      const input::MouseWheelEventWithLatencyInfo& wheel_event) = 0;
+      const MouseWheelEventWithLatencyInfo& wheel_event) = 0;
 
   virtual void SendGeneratedGestureScrollEvents(
-      const input::GestureEventWithLatencyInfo& gesture_event) = 0;
+      const GestureEventWithLatencyInfo& gesture_event) = 0;
 
   // Returns the size of visible viewport in screen space, in DIPs.
   virtual gfx::Size GetRootWidgetViewportSize() = 0;
 };
 
 // Interface with which the fling progress gets scheduled.
-class CONTENT_EXPORT FlingControllerSchedulerClient {
+class COMPONENT_EXPORT(INPUT) FlingControllerSchedulerClient {
  public:
   virtual ~FlingControllerSchedulerClient() {}
 
@@ -58,16 +58,16 @@
       const gfx::PointF& position_in_screen) = 0;
 };
 
-class CONTENT_EXPORT FlingController {
+class COMPONENT_EXPORT(INPUT) FlingController {
  public:
-  struct CONTENT_EXPORT Config {
+  struct COMPONENT_EXPORT(INPUT) Config {
     Config();
 
     // Controls touchpad-related tap suppression, disabled by default.
-    input::TapSuppressionController::Config touchpad_tap_suppression_config;
+    TapSuppressionController::Config touchpad_tap_suppression_config;
 
     // Controls touchscreen-related tap suppression, disabled by default.
-    input::TapSuppressionController::Config touchscreen_tap_suppression_config;
+    TapSuppressionController::Config touchscreen_tap_suppression_config;
   };
 
   struct ActiveFlingParameters {
@@ -100,28 +100,27 @@
   // or filter some events.  It will return true if the event was consumed or
   // filtered and should not be propagated further.
   bool ObserveAndMaybeConsumeGestureEvent(
-      const input::GestureEventWithLatencyInfo& gesture_event);
+      const GestureEventWithLatencyInfo& gesture_event);
 
   void ProcessGestureFlingStart(
-      const input::GestureEventWithLatencyInfo& gesture_event);
+      const GestureEventWithLatencyInfo& gesture_event);
 
   void ProcessGestureFlingCancel(
-      const input::GestureEventWithLatencyInfo& gesture_event);
+      const GestureEventWithLatencyInfo& gesture_event);
 
   bool fling_in_progress() const { return fling_curve_.get(); }
 
   gfx::Vector2dF CurrentFlingVelocity() const;
 
   // Returns the |TouchpadTapSuppressionController| instance.
-  input::TouchpadTapSuppressionController*
-  GetTouchpadTapSuppressionController();
+  TouchpadTapSuppressionController* GetTouchpadTapSuppressionController();
 
   void set_clock_for_testing(const base::TickClock* clock) { clock_ = clock; }
 
   // The fling controller observes wheel event acks to track whether the latest
   // wheel event was consumed, in which case we should not start a fling scroll
   // for flings generated by a touchpad source.
-  void OnWheelEventAck(const input::MouseWheelEventWithLatencyInfo& event,
+  void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event,
                        blink::mojom::InputEventResultSource ack_source,
                        blink::mojom::InputEventResultState ack_result);
 
@@ -131,7 +130,7 @@
  private:
   // Sub-filter for suppressing taps immediately after a GestureFlingCancel.
   bool ObserveAndFilterForTapSuppression(
-      const input::GestureEventWithLatencyInfo& gesture_event);
+      const GestureEventWithLatencyInfo& gesture_event);
 
   void ScheduleFlingProgress();
 
@@ -178,12 +177,12 @@
   // An object tracking the state of touchpad on the delivery of mouse events to
   // the renderer to filter mouse immediately after a touchpad fling canceling
   // tap.
-  input::TouchpadTapSuppressionController touchpad_tap_suppression_controller_;
+  TouchpadTapSuppressionController touchpad_tap_suppression_controller_;
 
   // An object tracking the state of touchscreen on the delivery of gesture tap
   // events to the renderer to filter taps immediately after a touchscreen fling
   // canceling tap.
-  input::TouchscreenTapSuppressionController
+  TouchscreenTapSuppressionController
       touchscreen_tap_suppression_controller_;
 
   // Gesture curve of the current active fling. nullptr while a fling is not
@@ -209,6 +208,6 @@
   base::WeakPtrFactory<FlingController> weak_ptr_factory_{this};
 };
 
-}  // namespace content
+}  // namespace input
 
-#endif  // CONTENT_COMMON_INPUT_FLING_CONTROLLER_H_
+#endif  // COMPONENTS_INPUT_FLING_CONTROLLER_H_
diff --git a/content/common/input/fling_controller_unittest.cc b/components/input/fling_controller_unittest.cc
similarity index 97%
rename from content/common/input/fling_controller_unittest.cc
rename to components/input/fling_controller_unittest.cc
index 8e56115..ac5da94 100644
--- a/content/common/input/fling_controller_unittest.cc
+++ b/components/input/fling_controller_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "content/common/input/fling_controller.h"
+#include "components/input/fling_controller.h"
 
 #include "base/rand_util.h"
 #include "base/run_loop.h"
@@ -26,7 +26,7 @@
 constexpr double kFrameDelta = 1000.0 / 60.0;
 }  // namespace
 
-namespace content {
+namespace input {
 
 class FakeFlingController : public FlingController {
  public:
@@ -59,7 +59,7 @@
 
   // FlingControllerEventSenderClient
   void SendGeneratedWheelEvent(
-      const input::MouseWheelEventWithLatencyInfo& wheel_event) override {
+      const MouseWheelEventWithLatencyInfo& wheel_event) override {
     wheel_event_count_++;
     last_sent_wheel_ = wheel_event.event;
     first_wheel_event_sent_ = true;
@@ -68,7 +68,7 @@
       first_wheel_event_sent_ = false;
   }
   void SendGeneratedGestureScrollEvents(
-      const input::GestureEventWithLatencyInfo& gesture_event) override {
+      const GestureEventWithLatencyInfo& gesture_event) override {
     fling_controller_->ObserveAndMaybeConsumeGestureEvent(gesture_event);
     sent_scroll_gesture_count_++;
     last_sent_gesture_ = gesture_event.event;
@@ -112,7 +112,7 @@
                                 NowTicks(), source_device);
     fling_start.data.fling_start.velocity_x = velocity.x();
     fling_start.data.fling_start.velocity_y = velocity.y();
-    input::GestureEventWithLatencyInfo fling_start_with_latency(fling_start);
+    GestureEventWithLatencyInfo fling_start_with_latency(fling_start);
     if (wait_before_processing) {
       // Wait for up to one frame before processing the event.
       AdvanceTime(base::RandInt(0, static_cast<int>(kFrameDelta)));
@@ -131,7 +131,7 @@
         WebGestureEvent::InertialPhaseState::kNonMomentum;
     scroll_begin.data.scroll_begin.delta_hint_units =
         ui::ScrollGranularity::kScrollByPrecisePixel;
-    input::GestureEventWithLatencyInfo scroll_begin_with_latency(scroll_begin);
+    GestureEventWithLatencyInfo scroll_begin_with_latency(scroll_begin);
 
     fling_controller_->ObserveAndMaybeConsumeGestureEvent(
         scroll_begin_with_latency);
@@ -149,7 +149,7 @@
         WebGestureEvent::InertialPhaseState::kNonMomentum;
     scroll_update.data.scroll_update.delta_units =
         ui::ScrollGranularity::kScrollByPrecisePixel;
-    input::GestureEventWithLatencyInfo scroll_update_with_latency(
+    GestureEventWithLatencyInfo scroll_update_with_latency(
         scroll_update);
 
     fling_controller_->ObserveAndMaybeConsumeGestureEvent(
@@ -163,7 +163,7 @@
     // autoscroll fling cancel doesn't allow fling boosting.
     if (source_device == blink::WebGestureDevice::kSyntheticAutoscroll)
       fling_cancel.data.fling_cancel.prevent_boosting = true;
-    input::GestureEventWithLatencyInfo fling_cancel_with_latency(fling_cancel);
+    GestureEventWithLatencyInfo fling_cancel_with_latency(fling_cancel);
     fling_controller_->ObserveAndMaybeConsumeGestureEvent(
         fling_cancel_with_latency);
   }
@@ -572,7 +572,7 @@
                               event_time, blink::WebGestureDevice::kTouchpad);
   fling_start.data.fling_start.velocity_x = 0.f;
   fling_start.data.fling_start.velocity_y = -1000.f;
-  input::GestureEventWithLatencyInfo fling_start_with_latency(fling_start);
+  GestureEventWithLatencyInfo fling_start_with_latency(fling_start);
 
   // Move time forward. Assume a frame occurs here.
   AdvanceTime(1.f);
@@ -735,7 +735,7 @@
 TEST_P(FlingControllerTest, NoFlingStartAfterWheelEventConsumed) {
   // First ensure that a fling can start after a not consumed wheel event.
   fling_controller_->OnWheelEventAck(
-      input::MouseWheelEventWithLatencyInfo(),
+      MouseWheelEventWithLatencyInfo(),
       blink::mojom::InputEventResultSource::kCompositorThread,
       blink::mojom::InputEventResultState::kNotConsumed);
 
@@ -749,7 +749,7 @@
 
   // Now test that a consumed touchpad wheel event results in no fling.
   fling_controller_->OnWheelEventAck(
-      input::MouseWheelEventWithLatencyInfo(),
+      MouseWheelEventWithLatencyInfo(),
       blink::mojom::InputEventResultSource::kCompositorThread,
       blink::mojom::InputEventResultState::kConsumed);
 
@@ -880,4 +880,4 @@
   EXPECT_EQ(ceilf(total_scroll_delta), roundf(expected_delta));
 }
 
-}  // namespace content
+}  // namespace input
diff --git a/content/browser/renderer_host/input/fling_scheduler.cc b/content/browser/renderer_host/input/fling_scheduler.cc
index 1de88e3..57ef85cb 100644
--- a/content/browser/renderer_host/input/fling_scheduler.cc
+++ b/content/browser/renderer_host/input/fling_scheduler.cc
@@ -7,6 +7,7 @@
 #include "build/build_config.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
 #include "ui/compositor/compositor.h"
+#include "ui/display/screen.h"
 
 #if defined(USE_AURA)
 #include "ui/aura/window.h"
@@ -33,7 +34,7 @@
 }
 
 void FlingScheduler::ScheduleFlingProgress(
-    base::WeakPtr<FlingController> fling_controller) {
+    base::WeakPtr<input::FlingController> fling_controller) {
   DCHECK(fling_controller);
   fling_controller_ = fling_controller;
   // Don't do anything if a ui::Compositor is already being observed.
@@ -48,7 +49,7 @@
 }
 
 void FlingScheduler::DidStopFlingingOnBrowser(
-    base::WeakPtr<FlingController> fling_controller) {
+    base::WeakPtr<input::FlingController> fling_controller) {
   DCHECK(fling_controller);
   if (observed_compositor_) {
     observed_compositor_->RemoveAnimationObserver(this);
@@ -78,7 +79,8 @@
 #if BUILDFLAG(IS_WIN)
   return display::win::ScreenWin::GetPixelsPerInch(position_in_screen);
 #else
-  return gfx::Vector2dF(kDefaultPixelsPerInch, kDefaultPixelsPerInch);
+  return gfx::Vector2dF(input::kDefaultPixelsPerInch,
+                        input::kDefaultPixelsPerInch);
 #endif
 }
 
diff --git a/content/browser/renderer_host/input/fling_scheduler.h b/content/browser/renderer_host/input/fling_scheduler.h
index 9b76cdb..443d505 100644
--- a/content/browser/renderer_host/input/fling_scheduler.h
+++ b/content/browser/renderer_host/input/fling_scheduler.h
@@ -6,8 +6,8 @@
 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_H_
 
 #include "base/memory/raw_ptr.h"
+#include "components/input/fling_controller.h"
 #include "content/common/content_export.h"
-#include "content/common/input/fling_controller.h"
 #include "content/common/input/fling_scheduler_base.h"
 #include "ui/compositor/compositor_animation_observer.h"
 
@@ -31,9 +31,9 @@
 
   // FlingControllerSchedulerClient
   void ScheduleFlingProgress(
-      base::WeakPtr<FlingController> fling_controller) override;
+      base::WeakPtr<input::FlingController> fling_controller) override;
   void DidStopFlingingOnBrowser(
-      base::WeakPtr<FlingController> fling_controller) override;
+      base::WeakPtr<input::FlingController> fling_controller) override;
   bool NeedsBeginFrameForFlingProgress() override;
   bool ShouldUseMobileFlingCurve() override;
   gfx::Vector2dF GetPixelsPerInch(
@@ -45,7 +45,7 @@
  protected:
   virtual ui::Compositor* GetCompositor();
   raw_ptr<RenderWidgetHostImpl> host_;
-  base::WeakPtr<FlingController> fling_controller_;
+  base::WeakPtr<input::FlingController> fling_controller_;
   raw_ptr<ui::Compositor> observed_compositor_ = nullptr;
 
  private:
diff --git a/content/browser/renderer_host/input/fling_scheduler_android.cc b/content/browser/renderer_host/input/fling_scheduler_android.cc
index e43d05a..472136b 100644
--- a/content/browser/renderer_host/input/fling_scheduler_android.cc
+++ b/content/browser/renderer_host/input/fling_scheduler_android.cc
@@ -23,7 +23,7 @@
 }
 
 void FlingSchedulerAndroid::ScheduleFlingProgress(
-    base::WeakPtr<FlingController> fling_controller) {
+    base::WeakPtr<input::FlingController> fling_controller) {
   DCHECK(fling_controller);
   fling_controller_ = fling_controller;
   if (observed_compositor_)
@@ -49,7 +49,7 @@
 }
 
 void FlingSchedulerAndroid::DidStopFlingingOnBrowser(
-    base::WeakPtr<FlingController> fling_controller) {
+    base::WeakPtr<input::FlingController> fling_controller) {
   DCHECK(fling_controller);
   RemoveCompositorTick();
   fling_controller_ = nullptr;
@@ -69,7 +69,8 @@
 }
 gfx::Vector2dF FlingSchedulerAndroid::GetPixelsPerInch(
     const gfx::PointF& position_in_screen) {
-  return gfx::Vector2dF(kDefaultPixelsPerInch, kDefaultPixelsPerInch);
+  return gfx::Vector2dF(input::kDefaultPixelsPerInch,
+                        input::kDefaultPixelsPerInch);
 }
 
 void FlingSchedulerAndroid::ProgressFlingOnBeginFrameIfneeded(
diff --git a/content/browser/renderer_host/input/fling_scheduler_android.h b/content/browser/renderer_host/input/fling_scheduler_android.h
index 32a7706..f5079d1 100644
--- a/content/browser/renderer_host/input/fling_scheduler_android.h
+++ b/content/browser/renderer_host/input/fling_scheduler_android.h
@@ -33,9 +33,9 @@
 
   // FlingControllerSchedulerClient
   void ScheduleFlingProgress(
-      base::WeakPtr<FlingController> fling_controller) override;
+      base::WeakPtr<input::FlingController> fling_controller) override;
   void DidStopFlingingOnBrowser(
-      base::WeakPtr<FlingController> fling_controller) override;
+      base::WeakPtr<input::FlingController> fling_controller) override;
   bool NeedsBeginFrameForFlingProgress() override;
   bool ShouldUseMobileFlingCurve() override;
   gfx::Vector2dF GetPixelsPerInch(
@@ -46,7 +46,7 @@
 
  protected:
   raw_ptr<RenderWidgetHostImpl> host_;
-  base::WeakPtr<FlingController> fling_controller_;
+  base::WeakPtr<input::FlingController> fling_controller_;
 
  private:
   ui::WindowAndroid* GetRootWindow();
diff --git a/content/browser/renderer_host/input/fling_scheduler_unittest.cc b/content/browser/renderer_host/input/fling_scheduler_unittest.cc
index 7a765a34..82fea07 100644
--- a/content/browser/renderer_host/input/fling_scheduler_unittest.cc
+++ b/content/browser/renderer_host/input/fling_scheduler_unittest.cc
@@ -31,13 +31,13 @@
   FakeFlingScheduler& operator=(const FakeFlingScheduler&) = delete;
 
   void ScheduleFlingProgress(
-      base::WeakPtr<FlingController> fling_controller) override {
+      base::WeakPtr<input::FlingController> fling_controller) override {
     FlingScheduler::ScheduleFlingProgress(fling_controller);
     fling_in_progress_ = true;
   }
 
   void DidStopFlingingOnBrowser(
-      base::WeakPtr<FlingController> fling_controller) override {
+      base::WeakPtr<input::FlingController> fling_controller) override {
     FlingScheduler::DidStopFlingingOnBrowser(fling_controller);
     fling_in_progress_ = false;
   }
@@ -47,7 +47,7 @@
   ui::Compositor* compositor() { return GetCompositor(); }
   ui::Compositor* observed_compositor() { return observed_compositor_; }
 
-  base::WeakPtr<FlingController> fling_controller() const {
+  base::WeakPtr<input::FlingController> fling_controller() const {
     return fling_controller_;
   }
 
@@ -56,7 +56,7 @@
 };
 
 class FlingSchedulerTest : public testing::Test,
-                           public FlingControllerEventSenderClient {
+                           public input::FlingControllerEventSenderClient {
  public:
   FlingSchedulerTest() {}
 
@@ -68,8 +68,8 @@
     widget_host_->SetView(view_.get());
 
     fling_scheduler_ = std::make_unique<FakeFlingScheduler>(widget_host_.get());
-    fling_controller_ = std::make_unique<FlingController>(
-        this, fling_scheduler_.get(), FlingController::Config());
+    fling_controller_ = std::make_unique<input::FlingController>(
+        this, fling_scheduler_.get(), input::FlingController::Config());
   }
 
   void TearDown() override {
@@ -116,7 +116,7 @@
     return gfx::Size(1920, 1080);
   }
 
-  FlingController* fling_controller() { return fling_controller_.get(); }
+  input::FlingController* fling_controller() { return fling_controller_.get(); }
   FakeFlingScheduler* fling_scheduler() { return fling_scheduler_.get(); }
 
  private:
@@ -144,7 +144,7 @@
   std::unique_ptr<TestBrowserContext> browser_context_;
   std::unique_ptr<RenderWidgetHostImpl> widget_host_;
   std::unique_ptr<FakeFlingScheduler> fling_scheduler_;
-  std::unique_ptr<FlingController> fling_controller_;
+  std::unique_ptr<input::FlingController> fling_controller_;
   std::unique_ptr<MockRenderProcessHost> process_host_;
   scoped_refptr<SiteInstanceGroup> site_instance_group_;
   std::unique_ptr<TestRenderWidgetHostView> view_;
diff --git a/content/browser/renderer_host/input/mock_input_router_client.cc b/content/browser/renderer_host/input/mock_input_router_client.cc
index b42c755..5aef6d0 100644
--- a/content/browser/renderer_host/input/mock_input_router_client.cc
+++ b/content/browser/renderer_host/input/mock_input_router_client.cc
@@ -127,7 +127,8 @@
 
 gfx::Vector2dF MockInputRouterClient::GetPixelsPerInch(
     const gfx::PointF& position_in_screen) {
-  return gfx::Vector2dF(kDefaultPixelsPerInch, kDefaultPixelsPerInch);
+  return gfx::Vector2dF(input::kDefaultPixelsPerInch,
+                        input::kDefaultPixelsPerInch);
 }
 
 }  // namespace content
diff --git a/content/browser/renderer_host/input/mock_input_router_client.h b/content/browser/renderer_host/input/mock_input_router_client.h
index eb9c09e9..15d1f3d 100644
--- a/content/browser/renderer_host/input/mock_input_router_client.h
+++ b/content/browser/renderer_host/input/mock_input_router_client.h
@@ -10,8 +10,8 @@
 #include <memory>
 
 #include "base/memory/raw_ptr.h"
+#include "components/input/fling_controller.h"
 #include "content/browser/scheduler/browser_ui_thread_scheduler.h"
-#include "content/common/input/fling_controller.h"
 #include "content/common/input/input_router_client.h"
 #include "ui/events/blink/did_overscroll_params.h"
 
@@ -20,7 +20,7 @@
 class InputRouter;
 
 class MockInputRouterClient : public InputRouterClient,
-                              public FlingControllerSchedulerClient {
+                              public input::FlingControllerSchedulerClient {
  public:
   MockInputRouterClient();
   ~MockInputRouterClient() override;
@@ -82,9 +82,9 @@
 
   // FlingControllerSchedulerClient
   void ScheduleFlingProgress(
-      base::WeakPtr<FlingController> fling_controller) override {}
+      base::WeakPtr<input::FlingController> fling_controller) override {}
   void DidStopFlingingOnBrowser(
-      base::WeakPtr<FlingController> fling_controller) override {}
+      base::WeakPtr<input::FlingController> fling_controller) override {}
   bool NeedsBeginFrameForFlingProgress() override;
   bool ShouldUseMobileFlingCurve() override;
   gfx::Vector2dF GetPixelsPerInch(
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index c2d9006..5ed83d5 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -117,8 +117,6 @@
     "input/cursor_manager.h",
     "input/events_helper.cc",
     "input/events_helper.h",
-    "input/fling_controller.cc",
-    "input/fling_controller.h",
     "input/fling_scheduler_base.h",
     "input/gesture_event_queue.cc",
     "input/gesture_event_queue.h",
@@ -267,7 +265,6 @@
     "//ui/accessibility",
     "//ui/accessibility/mojom",
     "//ui/base/cursor",
-    "//ui/events/gestures/blink",
     "//ui/events/ipc",
   ]
   deps = [
diff --git a/content/common/input/fling_scheduler_base.h b/content/common/input/fling_scheduler_base.h
index e8ee63f..8f211cf 100644
--- a/content/common/input/fling_scheduler_base.h
+++ b/content/common/input/fling_scheduler_base.h
@@ -5,11 +5,11 @@
 #ifndef CONTENT_COMMON_INPUT_FLING_SCHEDULER_BASE_H_
 #define CONTENT_COMMON_INPUT_FLING_SCHEDULER_BASE_H_
 
-#include "content/common/input/fling_controller.h"
+#include "components/input/fling_controller.h"
 
 namespace content {
 
-class FlingSchedulerBase : public FlingControllerSchedulerClient {
+class FlingSchedulerBase : public input::FlingControllerSchedulerClient {
  public:
   virtual void ProgressFlingOnBeginFrameIfneeded(
       base::TimeTicks current_time) = 0;
diff --git a/content/common/input/gesture_event_queue.cc b/content/common/input/gesture_event_queue.cc
index 00256e83..c56e6f2 100644
--- a/content/common/input/gesture_event_queue.cc
+++ b/content/common/input/gesture_event_queue.cc
@@ -25,8 +25,8 @@
 
 GestureEventQueue::GestureEventQueue(
     GestureEventQueueClient* client,
-    FlingControllerEventSenderClient* fling_event_sender_client,
-    FlingControllerSchedulerClient* fling_scheduler_client,
+    input::FlingControllerEventSenderClient* fling_event_sender_client,
+    input::FlingControllerSchedulerClient* fling_scheduler_client,
     const Config& config)
     : client_(client),
       scrolling_in_progress_(false),
diff --git a/content/common/input/gesture_event_queue.h b/content/common/input/gesture_event_queue.h
index aaae4dc..96ff421 100644
--- a/content/common/input/gesture_event_queue.h
+++ b/content/common/input/gesture_event_queue.h
@@ -12,8 +12,8 @@
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "components/input/event_with_latency_info.h"
+#include "components/input/fling_controller.h"
 #include "content/common/content_export.h"
-#include "content/common/input/fling_controller.h"
 #include "third_party/blink/public/common/input/web_input_event.h"
 #include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
 
@@ -64,7 +64,7 @@
   struct CONTENT_EXPORT Config {
     Config();
 
-    FlingController::Config fling_config;
+    input::FlingController::Config fling_config;
 
     // Determines whether non-scroll gesture events are "debounced" during an
     // active scroll sequence, suppressing brief scroll interruptions.
@@ -73,10 +73,11 @@
   };
 
   // Both |client| and |touchpad_client| must outlive the GestureEventQueue.
-  GestureEventQueue(GestureEventQueueClient* client,
-                    FlingControllerEventSenderClient* fling_event_sender_client,
-                    FlingControllerSchedulerClient* fling_scheduler_client,
-                    const Config& config);
+  GestureEventQueue(
+      GestureEventQueueClient* client,
+      input::FlingControllerEventSenderClient* fling_event_sender_client,
+      input::FlingControllerSchedulerClient* fling_scheduler_client,
+      const Config& config);
 
   GestureEventQueue(const GestureEventQueue&) = delete;
   GestureEventQueue& operator=(const GestureEventQueue&) = delete;
@@ -218,7 +219,7 @@
   // An object for filtering unnecessary GFC events, as well as gestureTap/mouse
   // events that happen immediately after touchscreen/touchpad fling canceling
   // taps.
-  FlingController fling_controller_;
+  input::FlingController fling_controller_;
 
   // True when the last GSE event is either in the debouncing_deferral_queue_ or
   // pushed to the queue and dropped from it later on.
diff --git a/content/common/input/gesture_event_queue_unittest.cc b/content/common/input/gesture_event_queue_unittest.cc
index afd9d32..d982de8d 100644
--- a/content/common/input/gesture_event_queue_unittest.cc
+++ b/content/common/input/gesture_event_queue_unittest.cc
@@ -31,8 +31,8 @@
 
 class GestureEventQueueTest : public testing::Test,
                               public GestureEventQueueClient,
-                              public FlingControllerEventSenderClient,
-                              public FlingControllerSchedulerClient {
+                              public input::FlingControllerEventSenderClient,
+                              public input::FlingControllerSchedulerClient {
  public:
   GestureEventQueueTest()
       : task_environment_(
@@ -100,9 +100,9 @@
 
   // FlingControllerSchedulerClient
   void ScheduleFlingProgress(
-      base::WeakPtr<FlingController> fling_controller) override {}
+      base::WeakPtr<input::FlingController> fling_controller) override {}
   void DidStopFlingingOnBrowser(
-      base::WeakPtr<FlingController> fling_controller) override {}
+      base::WeakPtr<input::FlingController> fling_controller) override {}
   bool NeedsBeginFrameForFlingProgress() override { return false; }
   bool ShouldUseMobileFlingCurve() override {
 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
@@ -113,7 +113,8 @@
   }
   gfx::Vector2dF GetPixelsPerInch(
       const gfx::PointF& position_in_screen) override {
-    return gfx::Vector2dF(kDefaultPixelsPerInch, kDefaultPixelsPerInch);
+    return gfx::Vector2dF(input::kDefaultPixelsPerInch,
+                          input::kDefaultPixelsPerInch);
   }
 
  protected:
diff --git a/content/common/input/input_router_impl.cc b/content/common/input/input_router_impl.cc
index 56c46bc..42130ac 100644
--- a/content/common/input/input_router_impl.cc
+++ b/content/common/input/input_router_impl.cc
@@ -76,7 +76,7 @@
 InputRouterImpl::InputRouterImpl(
     InputRouterImplClient* client,
     InputDispositionHandler* disposition_handler,
-    FlingControllerSchedulerClient* fling_scheduler_client,
+    input::FlingControllerSchedulerClient* fling_scheduler_client,
     const Config& config)
     : client_(client),
       disposition_handler_(disposition_handler),
diff --git a/content/common/input/input_router_impl.h b/content/common/input/input_router_impl.h
index 0e14fca3..541af0d 100644
--- a/content/common/input/input_router_impl.h
+++ b/content/common/input/input_router_impl.h
@@ -63,7 +63,7 @@
 class CONTENT_EXPORT InputRouterImpl
     : public InputRouter,
       public GestureEventQueueClient,
-      public FlingControllerEventSenderClient,
+      public input::FlingControllerEventSenderClient,
       public MouseWheelEventQueueClient,
       public PassthroughTouchEventQueueClient,
       public TouchpadPinchEventQueueClient,
@@ -71,7 +71,7 @@
  public:
   InputRouterImpl(InputRouterImplClient* client,
                   InputDispositionHandler* disposition_handler,
-                  FlingControllerSchedulerClient* fling_scheduler_client,
+                  input::FlingControllerSchedulerClient* fling_scheduler_client,
                   const Config& config);
 
   InputRouterImpl(const InputRouterImpl&) = delete;
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 8b587af..25a4aff 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -2818,7 +2818,6 @@
     "../common/frame_owner_element_type_mojom_traits_unittest.cc",
     "../common/input/actions_parser_test_driver_unittest.cc",
     "../common/input/actions_parser_unittest.cc",
-    "../common/input/fling_controller_unittest.cc",
     "../common/input/gesture_event_queue_unittest.cc",
     "../common/input/gesture_event_stream_validator_unittest.cc",
     "../common/input/mouse_wheel_event_queue_unittest.cc",