[go: nahoru, domu]

Merge Compositor's ScrollbarAnimationControllers into single class

This patch is for merge ScrollbarAnimationControllerLinearFade and
ScrollbarAnimationControllerThinning into ScrollbarAnimationController.

BUG=656606
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2692243005
Cr-Commit-Position: refs/heads/master@{#451397}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 1d17fc8..c0bbd2b0 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -70,10 +70,6 @@
     "input/scroll_state_data.h",
     "input/scrollbar_animation_controller.cc",
     "input/scrollbar_animation_controller.h",
-    "input/scrollbar_animation_controller_linear_fade.cc",
-    "input/scrollbar_animation_controller_linear_fade.h",
-    "input/scrollbar_animation_controller_thinning.cc",
-    "input/scrollbar_animation_controller_thinning.h",
     "input/selection.h",
     "input/single_scrollbar_animation_controller_thinning.cc",
     "input/single_scrollbar_animation_controller_thinning.h",
@@ -755,8 +751,7 @@
     "debug/rendering_stats_unittest.cc",
     "input/browser_controls_offset_manager_unittest.cc",
     "input/scroll_state_unittest.cc",
-    "input/scrollbar_animation_controller_linear_fade_unittest.cc",
-    "input/scrollbar_animation_controller_thinning_unittest.cc",
+    "input/scrollbar_animation_controller_unittest.cc",
     "input/single_scrollbar_animation_controller_thinning_unittest.cc",
     "ipc/cc_param_traits_unittest.cc",
     "ipc/struct_traits_unittest.cc",
diff --git a/cc/input/scrollbar_animation_controller.cc b/cc/input/scrollbar_animation_controller.cc
index dd4b6da..49d24920 100644
--- a/cc/input/scrollbar_animation_controller.cc
+++ b/cc/input/scrollbar_animation_controller.cc
@@ -11,11 +11,37 @@
 
 namespace cc {
 
+std::unique_ptr<ScrollbarAnimationController>
+ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid(
+    int scroll_layer_id,
+    ScrollbarAnimationControllerClient* client,
+    base::TimeDelta delay_before_starting,
+    base::TimeDelta resize_delay_before_starting,
+    base::TimeDelta fade_duration) {
+  return base::WrapUnique(new ScrollbarAnimationController(
+      scroll_layer_id, client, delay_before_starting,
+      resize_delay_before_starting, fade_duration));
+}
+
+std::unique_ptr<ScrollbarAnimationController>
+ScrollbarAnimationController::CreateScrollbarAnimationControllerAuraOverlay(
+    int scroll_layer_id,
+    ScrollbarAnimationControllerClient* client,
+    base::TimeDelta delay_before_starting,
+    base::TimeDelta resize_delay_before_starting,
+    base::TimeDelta fade_duration,
+    base::TimeDelta thinning_duration) {
+  return base::WrapUnique(new ScrollbarAnimationController(
+      scroll_layer_id, client, delay_before_starting,
+      resize_delay_before_starting, fade_duration, thinning_duration));
+}
+
 ScrollbarAnimationController::ScrollbarAnimationController(
     int scroll_layer_id,
     ScrollbarAnimationControllerClient* client,
     base::TimeDelta delay_before_starting,
-    base::TimeDelta resize_delay_before_starting)
+    base::TimeDelta resize_delay_before_starting,
+    base::TimeDelta fade_duration)
     : client_(client),
       delay_before_starting_(delay_before_starting),
       resize_delay_before_starting_(resize_delay_before_starting),
@@ -23,21 +49,78 @@
       scroll_layer_id_(scroll_layer_id),
       currently_scrolling_(false),
       scroll_gesture_has_scrolled_(false),
+      opacity_(0.0f),
+      fade_duration_(fade_duration),
+      need_thinning_animation_(false),
       weak_factory_(this) {
+  ApplyOpacityToScrollbars(0.0f);
+}
+
+ScrollbarAnimationController::ScrollbarAnimationController(
+    int scroll_layer_id,
+    ScrollbarAnimationControllerClient* client,
+    base::TimeDelta delay_before_starting,
+    base::TimeDelta resize_delay_before_starting,
+    base::TimeDelta fade_duration,
+    base::TimeDelta thinning_duration)
+    : client_(client),
+      delay_before_starting_(delay_before_starting),
+      resize_delay_before_starting_(resize_delay_before_starting),
+      is_animating_(false),
+      scroll_layer_id_(scroll_layer_id),
+      currently_scrolling_(false),
+      scroll_gesture_has_scrolled_(false),
+      opacity_(0.0f),
+      fade_duration_(fade_duration),
+      need_thinning_animation_(true),
+      weak_factory_(this) {
+  vertical_controller_ = SingleScrollbarAnimationControllerThinning::Create(
+      scroll_layer_id, ScrollbarOrientation::VERTICAL, client,
+      thinning_duration);
+  horizontal_controller_ = SingleScrollbarAnimationControllerThinning::Create(
+      scroll_layer_id, ScrollbarOrientation::HORIZONTAL, client,
+      thinning_duration);
+  ApplyOpacityToScrollbars(0.0f);
 }
 
 ScrollbarAnimationController::~ScrollbarAnimationController() {}
 
+ScrollbarSet ScrollbarAnimationController::Scrollbars() const {
+  return client_->ScrollbarsFor(scroll_layer_id_);
+}
+
 SingleScrollbarAnimationControllerThinning&
 ScrollbarAnimationController::GetScrollbarAnimationController(
     ScrollbarOrientation orientation) const {
-  DCHECK(NeedThinningAnimation());
+  DCHECK(need_thinning_animation_);
   if (orientation == ScrollbarOrientation::VERTICAL)
     return *(vertical_controller_.get());
   else
     return *(horizontal_controller_.get());
 }
 
+void ScrollbarAnimationController::StartAnimation() {
+  delayed_scrollbar_fade_.Cancel();
+  is_animating_ = true;
+  last_awaken_time_ = base::TimeTicks();
+  client_->SetNeedsAnimateForScrollbarAnimation();
+}
+
+void ScrollbarAnimationController::StopAnimation() {
+  delayed_scrollbar_fade_.Cancel();
+  is_animating_ = false;
+}
+
+void ScrollbarAnimationController::PostDelayedAnimationTask(bool on_resize) {
+  base::TimeDelta delay =
+      on_resize ? resize_delay_before_starting_ : delay_before_starting_;
+  delayed_scrollbar_fade_.Reset(
+      base::Bind(&ScrollbarAnimationController::StartAnimation,
+                 weak_factory_.GetWeakPtr()));
+  client_->PostDelayedScrollbarAnimationTask(delayed_scrollbar_fade_.callback(),
+                                             delay);
+}
+
 bool ScrollbarAnimationController::Animate(base::TimeTicks now) {
   bool animated = false;
 
@@ -53,7 +136,7 @@
     animated = true;
   }
 
-  if (NeedThinningAnimation()) {
+  if (need_thinning_animation_) {
     animated |= vertical_controller_->Animate(now);
     animated |= horizontal_controller_->Animate(now);
   }
@@ -61,18 +144,10 @@
   return animated;
 }
 
-bool ScrollbarAnimationController::ScrollbarsHidden() const {
-  return false;
-}
-
-bool ScrollbarAnimationController::NeedThinningAnimation() const {
-  return false;
-}
-
 float ScrollbarAnimationController::AnimationProgressAtTime(
     base::TimeTicks now) {
   base::TimeDelta delta = now - last_awaken_time_;
-  float progress = delta.InSecondsF() / Duration().InSecondsF();
+  float progress = delta.InSecondsF() / fade_duration_.InSecondsF();
   return std::max(std::min(progress, 1.f), 0.f);
 }
 
@@ -80,28 +155,55 @@
   currently_scrolling_ = true;
 }
 
+void ScrollbarAnimationController::RunAnimationFrame(float progress) {
+  ApplyOpacityToScrollbars(1.f - progress);
+  client_->SetNeedsRedrawForScrollbarAnimation();
+  if (progress == 1.f)
+    StopAnimation();
+}
+
 void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) {
+  if (need_thinning_animation_ && Captured())
+    return;
+
   StopAnimation();
 
   // As an optimization, we avoid spamming fade delay tasks during active fast
   // scrolls.  But if we're not within one, we need to post every scroll update.
-  if (!currently_scrolling_)
-    PostDelayedAnimationTask(on_resize);
-  else
+  if (!currently_scrolling_) {
+    // We don't fade out scrollbar if they need thinning animation and mouse is
+    // near.
+    if (!need_thinning_animation_ || !mouse_is_near_any_scrollbar())
+      PostDelayedAnimationTask(on_resize);
+  } else {
     scroll_gesture_has_scrolled_ = true;
+  }
+
+  ApplyOpacityToScrollbars(1);
+
+  if (need_thinning_animation_) {
+    vertical_controller_->UpdateThumbThicknessScale();
+    horizontal_controller_->UpdateThumbThicknessScale();
+  }
 }
 
 void ScrollbarAnimationController::DidScrollEnd() {
-  if (scroll_gesture_has_scrolled_) {
-    PostDelayedAnimationTask(false);
-    scroll_gesture_has_scrolled_ = false;
-  }
+  bool has_scrolled = scroll_gesture_has_scrolled_;
+  scroll_gesture_has_scrolled_ = false;
 
   currently_scrolling_ = false;
+
+  // We don't fade out scrollbar if they need thinning animation and mouse is
+  // near.
+  if (need_thinning_animation_ && mouse_is_near_any_scrollbar())
+    return;
+
+  if (has_scrolled)
+    PostDelayedAnimationTask(false);
 }
 
 void ScrollbarAnimationController::DidMouseDown() {
-  if (!NeedThinningAnimation() || ScrollbarsHidden())
+  if (!need_thinning_animation_ || ScrollbarsHidden())
     return;
 
   vertical_controller_->DidMouseDown();
@@ -109,7 +211,7 @@
 }
 
 void ScrollbarAnimationController::DidMouseUp() {
-  if (!NeedThinningAnimation())
+  if (!need_thinning_animation_)
     return;
 
   vertical_controller_->DidMouseUp();
@@ -120,7 +222,7 @@
 }
 
 void ScrollbarAnimationController::DidMouseLeave() {
-  if (!NeedThinningAnimation())
+  if (!need_thinning_animation_)
     return;
 
   vertical_controller_->DidMouseLeave();
@@ -135,7 +237,7 @@
 void ScrollbarAnimationController::DidMouseMoveNear(
     ScrollbarOrientation orientation,
     float distance) {
-  if (!NeedThinningAnimation())
+  if (!need_thinning_animation_)
     return;
 
   GetScrollbarAnimationController(orientation).DidMouseMoveNear(distance);
@@ -146,64 +248,66 @@
   if (mouse_is_near_any_scrollbar()) {
     ApplyOpacityToScrollbars(1);
     StopAnimation();
-  } else if (!animating_fade()) {
+  } else if (!is_animating_) {
     PostDelayedAnimationTask(false);
   }
 }
 
 bool ScrollbarAnimationController::mouse_is_over_scrollbar(
     ScrollbarOrientation orientation) const {
-  DCHECK(NeedThinningAnimation());
+  DCHECK(need_thinning_animation_);
   return GetScrollbarAnimationController(orientation).mouse_is_over_scrollbar();
 }
 
 bool ScrollbarAnimationController::mouse_is_near_scrollbar(
     ScrollbarOrientation orientation) const {
-  DCHECK(NeedThinningAnimation());
+  DCHECK(need_thinning_animation_);
   return GetScrollbarAnimationController(orientation).mouse_is_near_scrollbar();
 }
 
 bool ScrollbarAnimationController::mouse_is_near_any_scrollbar() const {
-  DCHECK(NeedThinningAnimation());
+  DCHECK(need_thinning_animation_);
   return vertical_controller_->mouse_is_near_scrollbar() ||
          horizontal_controller_->mouse_is_near_scrollbar();
 }
 
+bool ScrollbarAnimationController::ScrollbarsHidden() const {
+  return opacity_ == 0.0f;
+}
+
 bool ScrollbarAnimationController::Captured() const {
-  DCHECK(NeedThinningAnimation());
+  DCHECK(need_thinning_animation_);
   return vertical_controller_->captured() || horizontal_controller_->captured();
 }
 
-void ScrollbarAnimationController::PostDelayedAnimationTask(bool on_resize) {
-  base::TimeDelta delay =
-      on_resize ? resize_delay_before_starting_ : delay_before_starting_;
-  delayed_scrollbar_fade_.Reset(
-      base::Bind(&ScrollbarAnimationController::StartAnimation,
-                 weak_factory_.GetWeakPtr()));
-  client_->PostDelayedScrollbarAnimationTask(delayed_scrollbar_fade_.callback(),
-                                             delay);
-}
+void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) {
+  for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
+    if (!scrollbar->is_overlay_scrollbar())
+      continue;
+    float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0;
+    PropertyTrees* property_trees =
+        scrollbar->layer_tree_impl()->property_trees();
+    // If this method is called during LayerImpl::PushPropertiesTo, we may not
+    // yet have valid layer_id_to_effect_node_index entries as property trees
+    // are pushed after layers during activation. We can skip updating opacity
+    // in that case as we are only registering a scrollbar and because opacity
+    // will be overwritten anyway when property trees are pushed.
+    if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
+                                         scrollbar->id())) {
+      property_trees->effect_tree.OnOpacityAnimated(
+          effective_opacity,
+          property_trees->layer_id_to_effect_node_index[scrollbar->id()],
+          scrollbar->layer_tree_impl());
+    }
+  }
 
-void ScrollbarAnimationController::StartAnimation() {
-  delayed_scrollbar_fade_.Cancel();
-  is_animating_ = true;
-  last_awaken_time_ = base::TimeTicks();
-  client_->SetNeedsAnimateForScrollbarAnimation();
-}
+  bool previouslyVisible = opacity_ > 0.0f;
+  bool currentlyVisible = opacity > 0.0f;
 
-void ScrollbarAnimationController::StopAnimation() {
-  delayed_scrollbar_fade_.Cancel();
-  is_animating_ = false;
-}
+  opacity_ = opacity;
 
-ScrollbarSet ScrollbarAnimationController::Scrollbars() const {
-  return client_->ScrollbarsFor(scroll_layer_id_);
-}
-
-void ScrollbarAnimationController::set_mouse_move_distance_for_test(
-    float distance) {
-  vertical_controller_->set_mouse_move_distance_for_test(distance);
-  horizontal_controller_->set_mouse_move_distance_for_test(distance);
+  if (previouslyVisible != currentlyVisible)
+    client_->DidChangeScrollbarVisibility();
 }
 
 }  // namespace cc
diff --git a/cc/input/scrollbar_animation_controller.h b/cc/input/scrollbar_animation_controller.h
index 25e12966..17d07d0 100644
--- a/cc/input/scrollbar_animation_controller.h
+++ b/cc/input/scrollbar_animation_controller.h
@@ -29,24 +29,44 @@
   virtual ~ScrollbarAnimationControllerClient() {}
 };
 
-// This abstract class represents the compositor-side analogy of
-// ScrollbarAnimator.  Individual platforms should subclass it to provide
-// specialized implementation.
+// This class fade in scrollbars when scroll and fade out after an idle delay.
+// The fade animations works on both scrollbars and is controlled in this class
 // This class also passes the mouse state to each
 // SingleScrollbarAnimationControllerThinning. The thinning animations are
 // independent between vertical/horizontal and are managed by the
 // SingleScrollbarAnimationControllerThinnings.
 class CC_EXPORT ScrollbarAnimationController {
  public:
-  virtual ~ScrollbarAnimationController();
+  // ScrollbarAnimationController for Android. It only has fade in/out
+  // animation.
+  static std::unique_ptr<ScrollbarAnimationController>
+  CreateScrollbarAnimationControllerAndroid(
+      int scroll_layer_id,
+      ScrollbarAnimationControllerClient* client,
+      base::TimeDelta delay_before_starting,
+      base::TimeDelta resize_delay_before_starting,
+      base::TimeDelta fade_duration);
+
+  // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has fade in/
+  // out animation and thinning animation.
+  static std::unique_ptr<ScrollbarAnimationController>
+  CreateScrollbarAnimationControllerAuraOverlay(
+      int scroll_layer_id,
+      ScrollbarAnimationControllerClient* client,
+      base::TimeDelta delay_before_starting,
+      base::TimeDelta resize_delay_before_starting,
+      base::TimeDelta fade_duration,
+      base::TimeDelta thinning_duration);
+
+  ~ScrollbarAnimationController();
+
+  bool ScrollbarsHidden() const;
 
   bool Animate(base::TimeTicks now);
 
-  virtual void DidScrollBegin();
-  virtual void DidScrollUpdate(bool on_resize);
-  virtual void DidScrollEnd();
-  virtual bool ScrollbarsHidden() const;
-  virtual bool NeedThinningAnimation() const;
+  void DidScrollBegin();
+  void DidScrollUpdate(bool on_resize);
+  void DidScrollEnd();
 
   void DidMouseDown();
   void DidMouseUp();
@@ -57,44 +77,39 @@
   bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const;
   bool mouse_is_near_any_scrollbar() const;
 
-  void set_mouse_move_distance_for_test(float distance);
-
- protected:
+ private:
   ScrollbarAnimationController(int scroll_layer_id,
                                ScrollbarAnimationControllerClient* client,
                                base::TimeDelta delay_before_starting,
-                               base::TimeDelta resize_delay_before_starting);
+                               base::TimeDelta resize_delay_before_starting,
+                               base::TimeDelta fade_duration);
 
-  virtual void RunAnimationFrame(float progress) = 0;
-  virtual const base::TimeDelta& Duration() = 0;
-  virtual void ApplyOpacityToScrollbars(float opacity) = 0;
+  ScrollbarAnimationController(int scroll_layer_id,
+                               ScrollbarAnimationControllerClient* client,
+                               base::TimeDelta delay_before_starting,
+                               base::TimeDelta resize_delay_before_starting,
+                               base::TimeDelta fade_duration,
+                               base::TimeDelta thinning_duration);
+
+  ScrollbarSet Scrollbars() const;
+  SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController(
+      ScrollbarOrientation) const;
+
+  // Returns how far through the animation we are as a progress value from
+  // 0 to 1.
+  float AnimationProgressAtTime(base::TimeTicks now);
+  void RunAnimationFrame(float progress);
 
   void StartAnimation();
   void StopAnimation();
-  ScrollbarSet Scrollbars() const;
 
   ScrollbarAnimationControllerClient* client_;
 
   void PostDelayedAnimationTask(bool on_resize);
 
-  int scroll_layer_id() const { return scroll_layer_id_; }
-
-  bool animating_fade() const { return is_animating_; }
-
   bool Captured() const;
 
-  std::unique_ptr<SingleScrollbarAnimationControllerThinning>
-      vertical_controller_;
-  std::unique_ptr<SingleScrollbarAnimationControllerThinning>
-      horizontal_controller_;
-
- private:
-  // Returns how far through the animation we are as a progress value from
-  // 0 to 1.
-  float AnimationProgressAtTime(base::TimeTicks now);
-
-  SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController(
-      ScrollbarOrientation) const;
+  void ApplyOpacityToScrollbars(float opacity);
 
   base::TimeTicks last_awaken_time_;
   base::TimeDelta delay_before_starting_;
@@ -102,10 +117,19 @@
 
   bool is_animating_;
 
-  int scroll_layer_id_;
+  const int scroll_layer_id_;
   bool currently_scrolling_;
   bool scroll_gesture_has_scrolled_;
+
   base::CancelableClosure delayed_scrollbar_fade_;
+  float opacity_;
+  base::TimeDelta fade_duration_;
+
+  const bool need_thinning_animation_;
+  std::unique_ptr<SingleScrollbarAnimationControllerThinning>
+      vertical_controller_;
+  std::unique_ptr<SingleScrollbarAnimationControllerThinning>
+      horizontal_controller_;
 
   base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
 };
diff --git a/cc/input/scrollbar_animation_controller_linear_fade.cc b/cc/input/scrollbar_animation_controller_linear_fade.cc
deleted file mode 100644
index deca7f4..0000000
--- a/cc/input/scrollbar_animation_controller_linear_fade.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 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 "cc/input/scrollbar_animation_controller_linear_fade.h"
-
-#include "base/memory/ptr_util.h"
-#include "base/time/time.h"
-#include "cc/layers/layer_impl.h"
-#include "cc/layers/scrollbar_layer_impl_base.h"
-#include "cc/trees/layer_tree_impl.h"
-
-namespace cc {
-
-std::unique_ptr<ScrollbarAnimationControllerLinearFade>
-ScrollbarAnimationControllerLinearFade::Create(
-    int scroll_layer_id,
-    ScrollbarAnimationControllerClient* client,
-    base::TimeDelta delay_before_starting,
-    base::TimeDelta resize_delay_before_starting,
-    base::TimeDelta duration) {
-  return base::WrapUnique(new ScrollbarAnimationControllerLinearFade(
-      scroll_layer_id, client, delay_before_starting,
-      resize_delay_before_starting, duration));
-}
-
-ScrollbarAnimationControllerLinearFade::ScrollbarAnimationControllerLinearFade(
-    int scroll_layer_id,
-    ScrollbarAnimationControllerClient* client,
-    base::TimeDelta delay_before_starting,
-    base::TimeDelta resize_delay_before_starting,
-    base::TimeDelta duration)
-    : ScrollbarAnimationController(scroll_layer_id,
-                                   client,
-                                   delay_before_starting,
-                                   resize_delay_before_starting),
-      duration_(duration) {}
-
-ScrollbarAnimationControllerLinearFade::
-    ~ScrollbarAnimationControllerLinearFade() {}
-
-void ScrollbarAnimationControllerLinearFade::RunAnimationFrame(float progress) {
-  ApplyOpacityToScrollbars(1.f - progress);
-  client_->SetNeedsRedrawForScrollbarAnimation();
-  if (progress == 1.f)
-    StopAnimation();
-}
-
-const base::TimeDelta& ScrollbarAnimationControllerLinearFade::Duration() {
-  return duration_;
-}
-
-void ScrollbarAnimationControllerLinearFade::DidScrollUpdate(bool on_resize) {
-  ScrollbarAnimationController::DidScrollUpdate(on_resize);
-  ApplyOpacityToScrollbars(1.f);
-}
-
-void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars(
-    float opacity) {
-  for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
-    if (!scrollbar->is_overlay_scrollbar())
-      continue;
-    PropertyTrees* property_trees =
-        scrollbar->layer_tree_impl()->property_trees();
-    // If this method is called during LayerImpl::PushPropertiesTo, we may not
-    // yet have valid layer_id_to_effect_node_index entries as property trees
-    // are pushed after layers during activation. We can skip updating opacity
-    // in that case as we are only registering a scrollbar and because opacity
-    // will be overwritten anyway when property trees are pushed.
-    if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
-                                         scrollbar->id())) {
-      property_trees->effect_tree.OnOpacityAnimated(
-          scrollbar->CanScrollOrientation() ? opacity : 0,
-          property_trees->layer_id_to_effect_node_index[scrollbar->id()],
-          scrollbar->layer_tree_impl());
-    }
-  }
-}
-
-}  // namespace cc
diff --git a/cc/input/scrollbar_animation_controller_linear_fade.h b/cc/input/scrollbar_animation_controller_linear_fade.h
deleted file mode 100644
index 62dddcf7..0000000
--- a/cc/input/scrollbar_animation_controller_linear_fade.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 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.
-
-#ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_LINEAR_FADE_H_
-#define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_LINEAR_FADE_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "cc/base/cc_export.h"
-#include "cc/input/scrollbar_animation_controller.h"
-
-namespace cc {
-
-class CC_EXPORT ScrollbarAnimationControllerLinearFade
-    : public ScrollbarAnimationController {
- public:
-  static std::unique_ptr<ScrollbarAnimationControllerLinearFade> Create(
-      int scroll_layer_id,
-      ScrollbarAnimationControllerClient* client,
-      base::TimeDelta delay_before_starting,
-      base::TimeDelta resize_delay_before_starting,
-      base::TimeDelta duration);
-
-  ~ScrollbarAnimationControllerLinearFade() override;
-
-  void DidScrollUpdate(bool on_resize) override;
-
- protected:
-  ScrollbarAnimationControllerLinearFade(
-      int scroll_layer_id,
-      ScrollbarAnimationControllerClient* client,
-      base::TimeDelta delay_before_starting,
-      base::TimeDelta resize_delay_before_starting,
-      base::TimeDelta duration);
-
-  void RunAnimationFrame(float progress) override;
-  const base::TimeDelta& Duration() override;
-
- private:
-  float OpacityAtTime(base::TimeTicks now) const;
-  void ApplyOpacityToScrollbars(float opacity) override;
-
-  base::TimeDelta duration_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerLinearFade);
-};
-
-}  // namespace cc
-
-#endif  // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_LINEAR_FADE_H_
diff --git a/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc
deleted file mode 100644
index cc79c37..0000000
--- a/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc
+++ /dev/null
@@ -1,505 +0,0 @@
-// Copyright 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 "cc/input/scrollbar_animation_controller_linear_fade.h"
-
-#include "cc/layers/solid_color_scrollbar_layer_impl.h"
-#include "cc/test/fake_impl_task_runner_provider.h"
-#include "cc/test/fake_layer_tree_host_impl.h"
-#include "cc/test/geometry_test_utils.h"
-#include "cc/test/test_task_graph_runner.h"
-#include "cc/trees/layer_tree_impl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc {
-namespace {
-
-class ScrollbarAnimationControllerLinearFadeTest
-    : public testing::Test,
-      public ScrollbarAnimationControllerClient {
- public:
-  ScrollbarAnimationControllerLinearFadeTest()
-      : host_impl_(&task_runner_provider_,
-                   &task_graph_runner_),
-        did_request_redraw_(false),
-        did_request_animate_(false) {}
-
-  void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
-                                         base::TimeDelta delay) override {
-    start_fade_ = start_fade;
-    delay_ = delay;
-  }
-  void SetNeedsRedrawForScrollbarAnimation() override {
-    did_request_redraw_ = true;
-  }
-  void SetNeedsAnimateForScrollbarAnimation() override {
-    did_request_animate_ = true;
-  }
-  ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override {
-    return host_impl_.ScrollbarsFor(scroll_layer_id);
-  }
-  void DidChangeScrollbarVisibility() override {}
-
- protected:
-  void SetUp() override {
-    const int kThumbThickness = 10;
-    const int kTrackStart = 0;
-    const bool kIsLeftSideVerticalScrollbar = false;
-    const bool kIsOverlayScrollbar = true;  // Allow opacity animations.
-
-    std::unique_ptr<LayerImpl> scroll_layer =
-        LayerImpl::Create(host_impl_.active_tree(), 1);
-    std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
-        SolidColorScrollbarLayerImpl::Create(
-            host_impl_.active_tree(), 2, orientation(), kThumbThickness,
-            kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
-    scrollbar_layer_ = scrollbar.get();
-    scrollbar_layer_->test_properties()->opacity_can_animate = true;
-    std::unique_ptr<LayerImpl> clip =
-        LayerImpl::Create(host_impl_.active_tree(), 3);
-    clip_layer_ = clip.get();
-    scroll_layer->SetScrollClipLayer(clip_layer_->id());
-    LayerImpl* scroll_layer_ptr = scroll_layer.get();
-    scroll_layer->test_properties()->AddChild(std::move(scrollbar));
-    clip->test_properties()->AddChild(std::move(scroll_layer));
-    host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
-
-    scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
-    clip_layer_->SetBounds(gfx::Size(100, 100));
-    scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
-    host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
-
-    scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create(
-        scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
-        base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3));
-  }
-
-  virtual ScrollbarOrientation orientation() const { return HORIZONTAL; }
-
-  FakeImplTaskRunnerProvider task_runner_provider_;
-  TestTaskGraphRunner task_graph_runner_;
-  FakeLayerTreeHostImpl host_impl_;
-  std::unique_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_;
-  LayerImpl* clip_layer_;
-  SolidColorScrollbarLayerImpl* scrollbar_layer_;
-
-  base::Closure start_fade_;
-  base::TimeDelta delay_;
-  bool did_request_redraw_;
-  bool did_request_animate_;
-};
-
-class VerticalScrollbarAnimationControllerLinearFadeTest
-    : public ScrollbarAnimationControllerLinearFadeTest {
- protected:
-  ScrollbarOrientation orientation() const override { return VERTICAL; }
-};
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) {
-  scrollbar_layer_->layer_tree_impl()
-      ->property_trees()
-      ->effect_tree.OnOpacityAnimated(0.0f,
-                                      scrollbar_layer_->effect_tree_index(),
-                                      scrollbar_layer_->layer_tree_impl());
-  scrollbar_controller_->DidScrollBegin();
-  scrollbar_controller_->DidScrollUpdate(true);
-  scrollbar_controller_->DidScrollEnd();
-  // Normal Animation delay of 2 seconds.
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-  EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2));
-
-  scrollbar_layer_->layer_tree_impl()
-      ->property_trees()
-      ->effect_tree.OnOpacityAnimated(0.0f,
-                                      scrollbar_layer_->effect_tree_index(),
-                                      scrollbar_layer_->layer_tree_impl());
-  scrollbar_controller_->DidScrollUpdate(true);
-  // Delay animation on resize to 5 seconds.
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-  EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5));
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest, HiddenInBegin) {
-  scrollbar_layer_->layer_tree_impl()
-      ->property_trees()
-      ->effect_tree.OnOpacityAnimated(0.0f,
-                                      scrollbar_layer_->effect_tree_index(),
-                                      scrollbar_layer_->layer_tree_impl());
-  scrollbar_controller_->Animate(base::TimeTicks());
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest,
-       HiddenAfterNonScrollingGesture) {
-  scrollbar_layer_->layer_tree_impl()
-      ->property_trees()
-      ->effect_tree.OnOpacityAnimated(0.0f,
-                                      scrollbar_layer_->effect_tree_index(),
-                                      scrollbar_layer_->layer_tree_impl());
-  scrollbar_controller_->DidScrollBegin();
-
-  base::TimeTicks time;
-  time += base::TimeDelta::FromSeconds(100);
-  scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-  scrollbar_controller_->DidScrollEnd();
-
-  EXPECT_TRUE(start_fade_.Equals(base::Closure()));
-
-  time += base::TimeDelta::FromSeconds(100);
-  scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest, HideOnResize) {
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
-
-  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
-
-  // Shrink along X axis, horizontal scrollbar should appear.
-  clip_layer_->SetBounds(gfx::Size(100, 200));
-  EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds());
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-
-  // Shrink along Y axis and expand along X, horizontal scrollbar
-  // should disappear.
-  clip_layer_->SetBounds(gfx::Size(200, 100));
-  EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds());
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest, HideOnResize) {
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
-
-  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
-
-  // Shrink along X axis, vertical scrollbar should remain invisible.
-  clip_layer_->SetBounds(gfx::Size(100, 200));
-  EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds());
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-
-  // Shrink along Y axis and expand along X, vertical scrollbar should appear.
-  clip_layer_->SetBounds(gfx::Size(200, 100));
-  EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds());
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest,
-       HideOnUserNonScrollableHorz) {
-  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
-
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  scroll_layer->set_user_scrollable_horizontal(false);
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest,
-       ShowOnUserNonScrollableVert) {
-  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
-
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  scroll_layer->set_user_scrollable_vertical(false);
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest,
-       HideOnUserNonScrollableVert) {
-  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
-
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  scroll_layer->set_user_scrollable_vertical(false);
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest,
-       ShowOnUserNonScrollableHorz) {
-  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
-
-  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
-  ASSERT_TRUE(scroll_layer);
-  scroll_layer->set_user_scrollable_horizontal(false);
-
-  scrollbar_controller_->DidScrollBegin();
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest, AwakenByScrollingGesture) {
-  base::TimeTicks time;
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollBegin();
-  EXPECT_FALSE(did_request_animate_);
-
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  EXPECT_TRUE(start_fade_.Equals(base::Closure()));
-
-  time += base::TimeDelta::FromSeconds(100);
-
-  scrollbar_controller_->Animate(time);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-  scrollbar_controller_->DidScrollEnd();
-  EXPECT_FALSE(did_request_animate_);
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-
-  time += base::TimeDelta::FromSeconds(2);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-
-  scrollbar_controller_->DidScrollBegin();
-  scrollbar_controller_->DidScrollUpdate(false);
-  scrollbar_controller_->DidScrollEnd();
-
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-
-  time += base::TimeDelta::FromSeconds(2);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest, AwakenByProgrammaticScroll) {
-  base::TimeTicks time;
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FALSE(did_request_animate_);
-
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FALSE(did_request_animate_);
-
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  time += base::TimeDelta::FromSeconds(2);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollUpdate(false);
-  start_fade_.Run();
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest,
-       AnimationPreservedByNonScrollingGesture) {
-  base::TimeTicks time;
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollUpdate(false);
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollBegin();
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollEnd();
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
-}
-
-TEST_F(ScrollbarAnimationControllerLinearFadeTest,
-       AnimationOverriddenByScrollingGesture) {
-  base::TimeTicks time;
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FALSE(did_request_animate_);
-  start_fade_.Run();
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  scrollbar_controller_->DidScrollBegin();
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->Animate(time);
-  EXPECT_TRUE(did_request_animate_);
-  did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
-
-  time += base::TimeDelta::FromSeconds(1);
-  scrollbar_controller_->DidScrollEnd();
-  EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
-}
-
-}  // namespace
-}  // namespace cc
diff --git a/cc/input/scrollbar_animation_controller_thinning.cc b/cc/input/scrollbar_animation_controller_thinning.cc
deleted file mode 100644
index 548f4624..0000000
--- a/cc/input/scrollbar_animation_controller_thinning.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2013 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 "cc/input/scrollbar_animation_controller_thinning.h"
-
-#include "base/memory/ptr_util.h"
-#include "base/time/time.h"
-#include "cc/layers/layer_impl.h"
-#include "cc/layers/scrollbar_layer_impl_base.h"
-#include "cc/trees/layer_tree_impl.h"
-
-namespace cc {
-
-std::unique_ptr<ScrollbarAnimationControllerThinning>
-ScrollbarAnimationControllerThinning::Create(
-    int scroll_layer_id,
-    ScrollbarAnimationControllerClient* client,
-    base::TimeDelta delay_before_starting,
-    base::TimeDelta resize_delay_before_starting,
-    base::TimeDelta fade_duration,
-    base::TimeDelta thinning_duration) {
-  return base::WrapUnique(new ScrollbarAnimationControllerThinning(
-      scroll_layer_id, client, delay_before_starting,
-      resize_delay_before_starting, fade_duration, thinning_duration));
-}
-
-ScrollbarAnimationControllerThinning::ScrollbarAnimationControllerThinning(
-    int scroll_layer_id,
-    ScrollbarAnimationControllerClient* client,
-    base::TimeDelta delay_before_starting,
-    base::TimeDelta resize_delay_before_starting,
-    base::TimeDelta fade_duration,
-    base::TimeDelta thinning_duration)
-    : ScrollbarAnimationController(scroll_layer_id,
-                                   client,
-                                   delay_before_starting,
-                                   resize_delay_before_starting),
-      opacity_(0.0f),
-      fade_duration_(fade_duration) {
-  vertical_controller_ = SingleScrollbarAnimationControllerThinning::Create(
-      scroll_layer_id, ScrollbarOrientation::VERTICAL, client,
-      thinning_duration);
-  horizontal_controller_ = SingleScrollbarAnimationControllerThinning::Create(
-      scroll_layer_id, ScrollbarOrientation::HORIZONTAL, client,
-      thinning_duration);
-  ApplyOpacityToScrollbars(0.0f);
-}
-
-ScrollbarAnimationControllerThinning::~ScrollbarAnimationControllerThinning() {}
-
-
-
-bool ScrollbarAnimationControllerThinning::ScrollbarsHidden() const {
-  return opacity_ == 0.0f;
-}
-
-bool ScrollbarAnimationControllerThinning::NeedThinningAnimation() const {
-  return true;
-}
-
-void ScrollbarAnimationControllerThinning::RunAnimationFrame(float progress) {
-  ApplyOpacityToScrollbars(1.f - progress);
-  if (progress == 1.f)
-    StopAnimation();
-}
-
-const base::TimeDelta& ScrollbarAnimationControllerThinning::Duration() {
-  return fade_duration_;
-}
-
-void ScrollbarAnimationControllerThinning::DidScrollUpdate(bool on_resize) {
-  if (Captured())
-    return;
-
-  ScrollbarAnimationController::DidScrollUpdate(on_resize);
-
-  ApplyOpacityToScrollbars(1);
-  vertical_controller_->UpdateThumbThicknessScale();
-  horizontal_controller_->UpdateThumbThicknessScale();
-
-  // we started a fade out timer in
-  // |ScrollbarAnimationController::DidScrollUpdate| but don't want to
-  // fade out if the mouse is nearby.
-  if (mouse_is_near_any_scrollbar())
-    StopAnimation();
-}
-
-void ScrollbarAnimationControllerThinning::DidScrollEnd() {
-  ScrollbarAnimationController::DidScrollEnd();
-
-  // Don't fade out the scrollbar when mouse is near.
-  if (mouse_is_near_any_scrollbar())
-    StopAnimation();
-}
-
-void ScrollbarAnimationControllerThinning::ApplyOpacityToScrollbars(
-    float opacity) {
-  for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
-    if (!scrollbar->is_overlay_scrollbar())
-      continue;
-    float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0;
-    PropertyTrees* property_trees =
-        scrollbar->layer_tree_impl()->property_trees();
-    // If this method is called during LayerImpl::PushPropertiesTo, we may not
-    // yet have valid layer_id_to_effect_node_index entries as property trees
-    // are pushed after layers during activation. We can skip updating opacity
-    // in that case as we are only registering a scrollbar and because opacity
-    // will be overwritten anyway when property trees are pushed.
-    if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
-                                         scrollbar->id())) {
-      property_trees->effect_tree.OnOpacityAnimated(
-          effective_opacity,
-          property_trees->layer_id_to_effect_node_index[scrollbar->id()],
-          scrollbar->layer_tree_impl());
-    }
-  }
-
-  bool previouslyVisible = opacity_ > 0.0f;
-  bool currentlyVisible = opacity > 0.0f;
-
-  opacity_ = opacity;
-
-  if (previouslyVisible != currentlyVisible)
-    client_->DidChangeScrollbarVisibility();
-}
-
-}  // namespace cc
diff --git a/cc/input/scrollbar_animation_controller_thinning.h b/cc/input/scrollbar_animation_controller_thinning.h
deleted file mode 100644
index 1c53a97..0000000
--- a/cc/input/scrollbar_animation_controller_thinning.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2013 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.
-
-#ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_
-#define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "cc/base/cc_export.h"
-#include "cc/input/scrollbar_animation_controller.h"
-#include "cc/input/single_scrollbar_animation_controller_thinning.h"
-
-namespace cc {
-
-// This class fade in scrollbars when scroll and fade out after an idle delay.
-// The fade animations works on both scrollbars and is controlled in this class.
-
-// TODO(chaopeng) clean up the inheritance hierarchy after
-// ScrollbarAnimationControllerLinearFade merge into
-// ScrollbarAnimationControllerThinning so we can remove the empty overrides and
-// NOTREACHED() checks.
-class CC_EXPORT ScrollbarAnimationControllerThinning
-    : public ScrollbarAnimationController {
- public:
-  static std::unique_ptr<ScrollbarAnimationControllerThinning> Create(
-      int scroll_layer_id,
-      ScrollbarAnimationControllerClient* client,
-      base::TimeDelta delay_before_starting,
-      base::TimeDelta resize_delay_before_starting,
-      base::TimeDelta fade_duration,
-      base::TimeDelta thinning_duration);
-
-  ~ScrollbarAnimationControllerThinning() override;
-
-  void DidScrollUpdate(bool on_resize) override;
-  void DidScrollEnd() override;
-  bool ScrollbarsHidden() const override;
-
- protected:
-  bool NeedThinningAnimation() const override;
-
- private:
-  ScrollbarAnimationControllerThinning(
-      int scroll_layer_id,
-      ScrollbarAnimationControllerClient* client,
-      base::TimeDelta delay_before_starting,
-      base::TimeDelta resize_delay_before_starting,
-      base::TimeDelta fade_duration,
-      base::TimeDelta thinning_duration);
-
-  void ApplyOpacityToScrollbars(float opacity) override;
-  void RunAnimationFrame(float progress) override;
-  const base::TimeDelta& Duration() override;
-
-  float opacity_;
-  base::TimeDelta fade_duration_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerThinning);
-};
-
-}  // namespace cc
-
-#endif  // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_
diff --git a/cc/input/scrollbar_animation_controller_thinning_unittest.cc b/cc/input/scrollbar_animation_controller_unittest.cc
similarity index 64%
rename from cc/input/scrollbar_animation_controller_thinning_unittest.cc
rename to cc/input/scrollbar_animation_controller_unittest.cc
index f238b8b9..9e8487d 100644
--- a/cc/input/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/input/scrollbar_animation_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 "cc/input/scrollbar_animation_controller_thinning.h"
+#include "cc/input/scrollbar_animation_controller.h"
 
 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
 #include "cc/test/fake_impl_task_runner_provider.h"
@@ -21,10 +21,11 @@
 namespace cc {
 namespace {
 
-// These constants are hard-coded and should match the values in
-// scrollbar_animation_controller_thinning.cc.
-const float kIdleThicknessScale = 0.4f;
-const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
+const float kIdleThicknessScale =
+    SingleScrollbarAnimationControllerThinning::kIdleThicknessScale;
+const float kDefaultMouseMoveDistanceToTriggerAnimation =
+    SingleScrollbarAnimationControllerThinning::
+        kDefaultMouseMoveDistanceToTriggerAnimation;
 
 class MockScrollbarAnimationControllerClient
     : public ScrollbarAnimationControllerClient {
@@ -54,9 +55,9 @@
   LayerTreeHostImpl* host_impl_;
 };
 
-class ScrollbarAnimationControllerThinningTest : public testing::Test {
+class ScrollbarAnimationControllerAuraOverlayTest : public testing::Test {
  public:
-  ScrollbarAnimationControllerThinningTest()
+  ScrollbarAnimationControllerAuraOverlayTest()
       : host_impl_(&task_runner_provider_, &task_graph_runner_),
         client_(&host_impl_) {}
 
@@ -110,15 +111,16 @@
     scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
     host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
 
-    scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create(
-        scroll_layer_ptr->id(), &client_, kDelayBeforeStarting,
-        kResizeDelayBeforeStarting, kFadeDuration, kThinningDuration);
+    scrollbar_controller_ = ScrollbarAnimationController::
+        CreateScrollbarAnimationControllerAuraOverlay(
+            scroll_layer_ptr->id(), &client_, kDelayBeforeStarting,
+            kResizeDelayBeforeStarting, kFadeDuration, kThinningDuration);
   }
 
   FakeImplTaskRunnerProvider task_runner_provider_;
   TestTaskGraphRunner task_graph_runner_;
   FakeLayerTreeHostImpl host_impl_;
-  std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
+  std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_;
   LayerImpl* clip_layer_;
   SolidColorScrollbarLayerImpl* v_scrollbar_layer_;
   SolidColorScrollbarLayerImpl* h_scrollbar_layer_;
@@ -126,7 +128,7 @@
 };
 
 // Check initialization of scrollbar. Should start off invisible and thin.
-TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, Idle) {
   ExpectScrollbarsOpacity(0);
   EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden());
   EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -136,7 +138,7 @@
 }
 
 // Check that scrollbar appears again when the layer becomes scrollable.
-TEST_F(ScrollbarAnimationControllerThinningTest, AppearOnResize) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, AppearOnResize) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -157,7 +159,7 @@
 }
 
 // Check that scrollbar disappears when the layer becomes non-scrollable.
-TEST_F(ScrollbarAnimationControllerThinningTest, HideOnResize) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, HideOnResize) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -190,7 +192,7 @@
 }
 
 // Scroll content. Confirm the scrollbar appears and fades out.
-TEST_F(ScrollbarAnimationControllerThinningTest, BasicAppearAndFadeOut) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicAppearAndFadeOut) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -227,7 +229,7 @@
 
 // Scroll content. Move the mouse near the scrollbar and confirm it becomes
 // thick. Ensure it remains visible as long as the mouse is near the scrollbar.
-TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndDontFadeOut) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -268,7 +270,7 @@
 
 // Scroll content. Move the mouse over the scrollbar and confirm it becomes
 // thick. Ensure it remains visible as long as the mouse is over the scrollbar.
-TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndDontFadeOut) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -309,7 +311,7 @@
 
 // Make sure a scrollbar captured before the thickening animation doesn't try
 // to fade out.
-TEST_F(ScrollbarAnimationControllerThinningTest,
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
        DontFadeWhileCapturedBeforeThick) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
@@ -337,7 +339,7 @@
 }
 
 // Make sure a scrollbar captured then move mouse away doesn't try to fade out.
-TEST_F(ScrollbarAnimationControllerThinningTest,
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
        DontFadeWhileCapturedThenAway) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
@@ -374,7 +376,7 @@
 
 // Make sure a scrollbar captured after a thickening animation doesn't try to
 // fade out.
-TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -411,7 +413,7 @@
 
 // Make sure releasing a captured scrollbar when the mouse isn't near it, causes
 // the scrollbar to fade out.
-TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -462,7 +464,7 @@
 
 // Make sure releasing a captured scrollbar when the mouse is near/over it,
 // doesn't cause the scrollbar to fade out.
-TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeAfterReleasedNear) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -500,7 +502,8 @@
 
 // Make sure moving near a scrollbar while it's fading out causes it to reset
 // the opacity and thicken.
-TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
+       MoveNearScrollbarWhileFading) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -540,7 +543,7 @@
 }
 
 // Make sure we can't capture scrollbar that's completely faded out.
-TEST_F(ScrollbarAnimationControllerThinningTest, TestCantCaptureWhenFaded) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -593,7 +596,7 @@
 
 // Initiate a scroll when the pointer is already near the scrollbar. It should
 // appear thick and remain thick.
-TEST_F(ScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -617,7 +620,6 @@
   // An animation for the fade should be either null or cancelled, since
   // mouse is still near the scrollbar.
   scrollbar_controller_->DidScrollEnd();
-  EXPECT_EQ(kDelayBeforeStarting, client_.delay());
   EXPECT_TRUE(client_.start_fade().is_null() ||
               client_.start_fade().IsCancelled());
 
@@ -638,7 +640,8 @@
 
 // Tests that main thread scroll updates immediatley queue a fade animation
 // without requiring a ScrollEnd.
-TEST_F(ScrollbarAnimationControllerThinningTest, MainThreadScrollQueuesFade) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
+       MainThreadScrollQueuesFade) {
   ASSERT_TRUE(client_.start_fade().is_null());
 
   // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update
@@ -662,7 +665,7 @@
 
 // Make sure that if the scroll update is as a result of a resize, we use the
 // resize delay time instead of the default one.
-TEST_F(ScrollbarAnimationControllerThinningTest, ResizeFadeDuration) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ResizeFadeDuration) {
   ASSERT_TRUE(client_.delay().is_zero());
 
   scrollbar_controller_->DidScrollUpdate(true);
@@ -682,7 +685,7 @@
 }
 
 // Tests that the fade effect is animated.
-TEST_F(ScrollbarAnimationControllerThinningTest, FadeAnimated) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAnimated) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -713,7 +716,7 @@
 }
 
 // Tests that the controller tells the client when the scrollbars hide/show.
-TEST_F(ScrollbarAnimationControllerThinningTest, NotifyChangedVisibility) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, NotifyChangedVisibility) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -762,7 +765,7 @@
 
 // Move the pointer near each scrollbar. Confirm it gets thick and narrow when
 // moved away.
-TEST_F(ScrollbarAnimationControllerThinningTest, MouseNearEach) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -855,7 +858,7 @@
 }
 
 // Move mouse near both scrollbars at the same time.
-TEST_F(ScrollbarAnimationControllerThinningTest, MouseNearBoth) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -884,7 +887,7 @@
 
 // Move mouse from one to the other scrollbar before animation is finished, then
 // away before animation finished.
-TEST_F(ScrollbarAnimationControllerThinningTest,
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
        MouseNearOtherBeforeAnimationFinished) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
@@ -948,7 +951,7 @@
 
 // Ensure we have a delay fadeout animation after mouse leave without a mouse
 // move.
-TEST_F(ScrollbarAnimationControllerThinningTest, MouseLeaveFadeOut) {
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
 
@@ -972,5 +975,489 @@
   EXPECT_EQ(kDelayBeforeStarting, client_.delay());
 }
 
+class ScrollbarAnimationControllerAndroidTest
+    : public testing::Test,
+      public ScrollbarAnimationControllerClient {
+ public:
+  ScrollbarAnimationControllerAndroidTest()
+      : host_impl_(&task_runner_provider_, &task_graph_runner_),
+        did_request_redraw_(false),
+        did_request_animate_(false) {}
+
+  void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
+                                         base::TimeDelta delay) override {
+    start_fade_ = start_fade;
+    delay_ = delay;
+  }
+  void SetNeedsRedrawForScrollbarAnimation() override {
+    did_request_redraw_ = true;
+  }
+  void SetNeedsAnimateForScrollbarAnimation() override {
+    did_request_animate_ = true;
+  }
+  ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override {
+    return host_impl_.ScrollbarsFor(scroll_layer_id);
+  }
+  void DidChangeScrollbarVisibility() override {}
+
+ protected:
+  void SetUp() override {
+    const int kThumbThickness = 10;
+    const int kTrackStart = 0;
+    const bool kIsLeftSideVerticalScrollbar = false;
+    const bool kIsOverlayScrollbar = true;  // Allow opacity animations.
+
+    std::unique_ptr<LayerImpl> scroll_layer =
+        LayerImpl::Create(host_impl_.active_tree(), 1);
+    std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
+        SolidColorScrollbarLayerImpl::Create(
+            host_impl_.active_tree(), 2, orientation(), kThumbThickness,
+            kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
+    scrollbar_layer_ = scrollbar.get();
+    scrollbar_layer_->test_properties()->opacity_can_animate = true;
+    std::unique_ptr<LayerImpl> clip =
+        LayerImpl::Create(host_impl_.active_tree(), 3);
+    clip_layer_ = clip.get();
+    scroll_layer->SetScrollClipLayer(clip_layer_->id());
+    LayerImpl* scroll_layer_ptr = scroll_layer.get();
+    scroll_layer->test_properties()->AddChild(std::move(scrollbar));
+    clip->test_properties()->AddChild(std::move(scroll_layer));
+    host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
+
+    scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
+    clip_layer_->SetBounds(gfx::Size(100, 100));
+    scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
+    host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
+
+    scrollbar_controller_ =
+        ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid(
+            scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
+            base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3));
+  }
+
+  virtual ScrollbarOrientation orientation() const { return HORIZONTAL; }
+
+  FakeImplTaskRunnerProvider task_runner_provider_;
+  TestTaskGraphRunner task_graph_runner_;
+  FakeLayerTreeHostImpl host_impl_;
+  std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_;
+  LayerImpl* clip_layer_;
+  SolidColorScrollbarLayerImpl* scrollbar_layer_;
+
+  base::Closure start_fade_;
+  base::TimeDelta delay_;
+  bool did_request_redraw_;
+  bool did_request_animate_;
+};
+
+class VerticalScrollbarAnimationControllerAndroidTest
+    : public ScrollbarAnimationControllerAndroidTest {
+ protected:
+  ScrollbarOrientation orientation() const override { return VERTICAL; }
+};
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, DelayAnimationOnResize) {
+  scrollbar_layer_->layer_tree_impl()
+      ->property_trees()
+      ->effect_tree.OnOpacityAnimated(0.0f,
+                                      scrollbar_layer_->effect_tree_index(),
+                                      scrollbar_layer_->layer_tree_impl());
+  scrollbar_controller_->DidScrollBegin();
+  scrollbar_controller_->DidScrollUpdate(true);
+  scrollbar_controller_->DidScrollEnd();
+  // Normal Animation delay of 2 seconds.
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+  EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2));
+
+  scrollbar_layer_->layer_tree_impl()
+      ->property_trees()
+      ->effect_tree.OnOpacityAnimated(0.0f,
+                                      scrollbar_layer_->effect_tree_index(),
+                                      scrollbar_layer_->layer_tree_impl());
+  scrollbar_controller_->DidScrollUpdate(true);
+  // Delay animation on resize to 5 seconds.
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+  EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5));
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, HiddenInBegin) {
+  scrollbar_layer_->layer_tree_impl()
+      ->property_trees()
+      ->effect_tree.OnOpacityAnimated(0.0f,
+                                      scrollbar_layer_->effect_tree_index(),
+                                      scrollbar_layer_->layer_tree_impl());
+  scrollbar_controller_->Animate(base::TimeTicks());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest,
+       HiddenAfterNonScrollingGesture) {
+  scrollbar_layer_->layer_tree_impl()
+      ->property_trees()
+      ->effect_tree.OnOpacityAnimated(0.0f,
+                                      scrollbar_layer_->effect_tree_index(),
+                                      scrollbar_layer_->layer_tree_impl());
+  scrollbar_controller_->DidScrollBegin();
+
+  base::TimeTicks time;
+  time += base::TimeDelta::FromSeconds(100);
+  scrollbar_controller_->Animate(time);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+  scrollbar_controller_->DidScrollEnd();
+
+  EXPECT_TRUE(start_fade_.Equals(base::Closure()));
+
+  time += base::TimeDelta::FromSeconds(100);
+  scrollbar_controller_->Animate(time);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, HideOnResize) {
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
+
+  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
+
+  // Shrink along X axis, horizontal scrollbar should appear.
+  clip_layer_->SetBounds(gfx::Size(100, 200));
+  EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds());
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+
+  // Shrink along Y axis and expand along X, horizontal scrollbar
+  // should disappear.
+  clip_layer_->SetBounds(gfx::Size(200, 100));
+  EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds());
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(VerticalScrollbarAnimationControllerAndroidTest, HideOnResize) {
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
+
+  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
+
+  // Shrink along X axis, vertical scrollbar should remain invisible.
+  clip_layer_->SetBounds(gfx::Size(100, 200));
+  EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds());
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+
+  // Shrink along Y axis and expand along X, vertical scrollbar should appear.
+  clip_layer_->SetBounds(gfx::Size(200, 100));
+  EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds());
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, HideOnUserNonScrollableHorz) {
+  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
+
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  scroll_layer->set_user_scrollable_horizontal(false);
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, ShowOnUserNonScrollableVert) {
+  EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
+
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  scroll_layer->set_user_scrollable_vertical(false);
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(VerticalScrollbarAnimationControllerAndroidTest,
+       HideOnUserNonScrollableVert) {
+  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
+
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  scroll_layer->set_user_scrollable_vertical(false);
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(VerticalScrollbarAnimationControllerAndroidTest,
+       ShowOnUserNonScrollableHorz) {
+  EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation());
+
+  LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
+  ASSERT_TRUE(scroll_layer);
+  scroll_layer->set_user_scrollable_horizontal(false);
+
+  scrollbar_controller_->DidScrollBegin();
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByScrollingGesture) {
+  base::TimeTicks time;
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollBegin();
+  EXPECT_FALSE(did_request_animate_);
+
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  EXPECT_TRUE(start_fade_.Equals(base::Closure()));
+
+  time += base::TimeDelta::FromSeconds(100);
+
+  scrollbar_controller_->Animate(time);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+  scrollbar_controller_->DidScrollEnd();
+  EXPECT_FALSE(did_request_animate_);
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+
+  time += base::TimeDelta::FromSeconds(2);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+
+  scrollbar_controller_->DidScrollBegin();
+  scrollbar_controller_->DidScrollUpdate(false);
+  scrollbar_controller_->DidScrollEnd();
+
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+
+  time += base::TimeDelta::FromSeconds(2);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByProgrammaticScroll) {
+  base::TimeTicks time;
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FALSE(did_request_animate_);
+
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FALSE(did_request_animate_);
+
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  time += base::TimeDelta::FromSeconds(2);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollUpdate(false);
+  start_fade_.Run();
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest,
+       AnimationPreservedByNonScrollingGesture) {
+  base::TimeTicks time;
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollUpdate(false);
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollBegin();
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollEnd();
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
+}
+
+TEST_F(ScrollbarAnimationControllerAndroidTest,
+       AnimationOverriddenByScrollingGesture) {
+  base::TimeTicks time;
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FALSE(did_request_animate_);
+  start_fade_.Run();
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  scrollbar_controller_->DidScrollBegin();
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->Animate(time);
+  EXPECT_TRUE(did_request_animate_);
+  did_request_animate_ = false;
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollUpdate(false);
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
+
+  time += base::TimeDelta::FromSeconds(1);
+  scrollbar_controller_->DidScrollEnd();
+  EXPECT_FALSE(did_request_animate_);
+  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
+}
+
 }  // namespace
 }  // namespace cc
diff --git a/cc/input/single_scrollbar_animation_controller_thinning.cc b/cc/input/single_scrollbar_animation_controller_thinning.cc
index d2ba28b1..d09dd05 100644
--- a/cc/input/single_scrollbar_animation_controller_thinning.cc
+++ b/cc/input/single_scrollbar_animation_controller_thinning.cc
@@ -13,11 +13,6 @@
 #include "cc/layers/scrollbar_layer_impl_base.h"
 #include "cc/trees/layer_tree_impl.h"
 
-namespace {
-const float kIdleThicknessScale = 0.4f;
-const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
-}
-
 namespace cc {
 
 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
@@ -44,8 +39,6 @@
       mouse_is_over_scrollbar_(false),
       mouse_is_near_scrollbar_(false),
       thickness_change_(NONE),
-      mouse_move_distance_to_trigger_animation_(
-          kDefaultMouseMoveDistanceToTriggerAnimation),
       thinning_duration_(thinning_duration) {
   ApplyThumbThicknessScale(kIdleThicknessScale);
 }
@@ -140,7 +133,7 @@
     float distance) {
   bool mouse_is_over_scrollbar = distance == 0.0f;
   bool mouse_is_near_scrollbar =
-      distance < mouse_move_distance_to_trigger_animation_;
+      distance < kDefaultMouseMoveDistanceToTriggerAnimation;
 
   if (!captured_ && mouse_is_near_scrollbar != mouse_is_near_scrollbar_) {
     thickness_change_ = mouse_is_near_scrollbar ? INCREASE : DECREASE;
diff --git a/cc/input/single_scrollbar_animation_controller_thinning.h b/cc/input/single_scrollbar_animation_controller_thinning.h
index b974387..1437ccde 100644
--- a/cc/input/single_scrollbar_animation_controller_thinning.h
+++ b/cc/input/single_scrollbar_animation_controller_thinning.h
@@ -22,6 +22,9 @@
 // ScrollbarAnimationControllerThinning for one scrollbar
 class CC_EXPORT SingleScrollbarAnimationControllerThinning {
  public:
+  static constexpr float kIdleThicknessScale = 0.4f;
+  static constexpr float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
+
   static std::unique_ptr<SingleScrollbarAnimationControllerThinning> Create(
       int scroll_layer_id,
       ScrollbarOrientation orientation,
@@ -30,9 +33,6 @@
 
   ~SingleScrollbarAnimationControllerThinning() {}
 
-  void set_mouse_move_distance_for_test(float distance) {
-    mouse_move_distance_to_trigger_animation_ = distance;
-  }
   bool mouse_is_over_scrollbar() const { return mouse_is_over_scrollbar_; }
   bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; }
   bool captured() const { return captured_; }
@@ -84,8 +84,6 @@
   bool mouse_is_near_scrollbar_;
   // Are we narrowing or thickening the bars.
   AnimationChange thickness_change_;
-  // How close should the mouse be to the scrollbar before we thicken it.
-  float mouse_move_distance_to_trigger_animation_;
 
   base::TimeDelta thinning_duration_;
 
diff --git a/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc b/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
index 4486a87c..50659ff 100644
--- a/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
@@ -21,10 +21,11 @@
 namespace cc {
 namespace {
 
-// These constants are hard-coded and should match the values in
-// single_scrollbar_animation_controller_thinning.cc.
-const float kIdleThicknessScale = 0.4f;
-const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
+const float kIdleThicknessScale =
+    SingleScrollbarAnimationControllerThinning::kIdleThicknessScale;
+const float kDefaultMouseMoveDistanceToTriggerAnimation =
+    SingleScrollbarAnimationControllerThinning::
+        kDefaultMouseMoveDistanceToTriggerAnimation;
 
 class MockSingleScrollbarAnimationControllerClient
     : public ScrollbarAnimationControllerClient {
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 2cc8c05..a454c4c 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -103,7 +103,8 @@
   ScrollbarLayerTest() {
     layer_tree_settings_.single_thread_proxy_scheduler = false;
     layer_tree_settings_.use_zero_copy = true;
-    layer_tree_settings_.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
+    layer_tree_settings_.scrollbar_animator =
+        LayerTreeSettings::ANDROID_OVERLAY;
     layer_tree_settings_.scrollbar_fade_delay =
         base::TimeDelta::FromMilliseconds(20);
     layer_tree_settings_.scrollbar_fade_duration =
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 2b0b9676..c1f61444 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -22,7 +22,6 @@
 #include "cc/input/browser_controls_offset_manager.h"
 #include "cc/input/main_thread_scrolling_reason.h"
 #include "cc/input/page_scale_animation.h"
-#include "cc/input/scrollbar_animation_controller_thinning.h"
 #include "cc/layers/append_quads_data.h"
 #include "cc/layers/heads_up_display_layer_impl.h"
 #include "cc/layers/layer_impl.h"
@@ -2889,12 +2888,12 @@
   }
 };
 
-TEST_F(LayerTreeHostImplTestScrollbarAnimation, LinearFade) {
-  RunTest(LayerTreeSettings::LINEAR_FADE);
+TEST_F(LayerTreeHostImplTestScrollbarAnimation, Android) {
+  RunTest(LayerTreeSettings::ANDROID_OVERLAY);
 }
 
-TEST_F(LayerTreeHostImplTestScrollbarAnimation, Thinning) {
-  RunTest(LayerTreeSettings::THINNING);
+TEST_F(LayerTreeHostImplTestScrollbarAnimation, AuraOverlay) {
+  RunTest(LayerTreeSettings::AURA_OVERLAY);
 }
 
 TEST_F(LayerTreeHostImplTestScrollbarAnimation, NoAnimator) {
@@ -2988,12 +2987,12 @@
   }
 };
 
-TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) {
-  RunTest(LayerTreeSettings::LINEAR_FADE);
+TEST_F(LayerTreeHostImplTestScrollbarOpacity, Android) {
+  RunTest(LayerTreeSettings::ANDROID_OVERLAY);
 }
 
-TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) {
-  RunTest(LayerTreeSettings::THINNING);
+TEST_F(LayerTreeHostImplTestScrollbarOpacity, AuraOverlay) {
+  RunTest(LayerTreeSettings::AURA_OVERLAY);
 }
 
 TEST_F(LayerTreeHostImplTestScrollbarOpacity, NoAnimator) {
@@ -3036,7 +3035,7 @@
 
 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) {
   LayerTreeSettings settings = DefaultSettings();
-  settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
+  settings.scrollbar_animator = LayerTreeSettings::ANDROID_OVERLAY;
   settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20);
   settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20);
   CreateHostImpl(settings, CreateCompositorFrameSink());
@@ -3159,7 +3158,7 @@
   LayerTreeSettings settings = DefaultSettings();
   settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
   settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
-  settings.scrollbar_animator = LayerTreeSettings::THINNING;
+  settings.scrollbar_animator = LayerTreeSettings::AURA_OVERLAY;
 
   gfx::Size viewport_size(300, 200);
   gfx::Size device_viewport_size =
@@ -3194,28 +3193,28 @@
   DrawFrame();
   host_impl_->active_tree()->UpdateDrawProperties(false);
 
-  ScrollbarAnimationControllerThinning* scrollbar_animation_controller =
-      static_cast<ScrollbarAnimationControllerThinning*>(
-          host_impl_->ScrollbarAnimationControllerForId(root_scroll->id()));
-  scrollbar_animation_controller->set_mouse_move_distance_for_test(100.f);
+  ScrollbarAnimationController* scrollbar_animation_controller =
+      host_impl_->ScrollbarAnimationControllerForId(root_scroll->id());
 
-  host_impl_->MouseMoveAt(gfx::Point(200, 1));
+  const float kMouseDistanceToTriggerAnimation =
+      SingleScrollbarAnimationControllerThinning::
+          kDefaultMouseMoveDistanceToTriggerAnimation;
+
+  host_impl_->MouseMoveAt(
+      gfx::Point(15 + kMouseDistanceToTriggerAnimation * 2, 1));
   EXPECT_FALSE(
       scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
 
-  host_impl_->MouseMoveAt(gfx::Point(100, 50));
+  host_impl_->MouseMoveAt(
+      gfx::Point(15 + kMouseDistanceToTriggerAnimation - 1, 50));
   EXPECT_TRUE(
       scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
 
-  host_impl_->MouseMoveAt(gfx::Point(116, 100));
+  host_impl_->MouseMoveAt(
+      gfx::Point(15 + kMouseDistanceToTriggerAnimation, 100));
   EXPECT_FALSE(
       scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
 
-  scrollbar_animation_controller->set_mouse_move_distance_for_test(102.f);
-  host_impl_->MouseMoveAt(gfx::Point(116, 100));
-  EXPECT_TRUE(
-      scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
-
   did_request_redraw_ = false;
   EXPECT_FALSE(
       scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
@@ -11562,7 +11561,7 @@
   LayerTreeSettings settings = DefaultSettings();
   settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
   settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
-  settings.scrollbar_animator = LayerTreeSettings::THINNING;
+  settings.scrollbar_animator = LayerTreeSettings::AURA_OVERLAY;
 
   gfx::Size viewport_size(300, 200);
   gfx::Size content_size(1000, 1000);
@@ -11609,20 +11608,24 @@
   DrawFrame();
   host_impl_->active_tree()->UpdateDrawProperties(false);
 
-  ScrollbarAnimationControllerThinning* scrollbar_1_animation_controller =
-      static_cast<ScrollbarAnimationControllerThinning*>(
-          host_impl_->ScrollbarAnimationControllerForId(root_scroll->id()));
+  ScrollbarAnimationController* scrollbar_1_animation_controller =
+      host_impl_->ScrollbarAnimationControllerForId(root_scroll->id());
   EXPECT_TRUE(scrollbar_1_animation_controller);
-  scrollbar_1_animation_controller->set_mouse_move_distance_for_test(40.f);
+
+  const float kMouseDistanceToTriggerAnimation =
+      SingleScrollbarAnimationControllerThinning::
+          kDefaultMouseMoveDistanceToTriggerAnimation;
 
   // Mouse moves close to the scrollbar, goes over the scrollbar, and
   // moves back to where it was.
-  host_impl_->MouseMoveAt(gfx::Point(100, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(15 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_FALSE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
       scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
-  host_impl_->MouseMoveAt(gfx::Point(40, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(14 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_TRUE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
@@ -11632,12 +11635,14 @@
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_TRUE(
       scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
-  host_impl_->MouseMoveAt(gfx::Point(40, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(14 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_TRUE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
       scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
-  host_impl_->MouseMoveAt(gfx::Point(100, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(15 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_FALSE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
@@ -11673,11 +11678,9 @@
   host_impl_->active_tree()->BuildPropertyTreesForTesting();
   host_impl_->active_tree()->DidBecomeActive();
 
-  ScrollbarAnimationControllerThinning* scrollbar_2_animation_controller =
-      static_cast<ScrollbarAnimationControllerThinning*>(
-          host_impl_->ScrollbarAnimationControllerForId(child_scroll_id));
+  ScrollbarAnimationController* scrollbar_2_animation_controller =
+      host_impl_->ScrollbarAnimationControllerForId(child_scroll_id);
   EXPECT_TRUE(scrollbar_2_animation_controller);
-  scrollbar_2_animation_controller->set_mouse_move_distance_for_test(40.f);
 
   // Mouse goes over scrollbar_2, moves close to scrollbar_2, moves close to
   // scrollbar_1, goes over scrollbar_1.
@@ -11690,7 +11693,8 @@
       scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_TRUE(
       scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
-  host_impl_->MouseMoveAt(gfx::Point(100, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(64 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_FALSE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
@@ -11699,7 +11703,8 @@
       scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
       scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
-  host_impl_->MouseMoveAt(gfx::Point(40, 150));
+  host_impl_->MouseMoveAt(
+      gfx::Point(14 + kMouseDistanceToTriggerAnimation, 150));
   EXPECT_TRUE(
       scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
   EXPECT_FALSE(
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 58ccb0c..a231d6f 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -24,8 +24,6 @@
 #include "cc/debug/traced_value.h"
 #include "cc/input/page_scale_animation.h"
 #include "cc/input/scrollbar_animation_controller.h"
-#include "cc/input/scrollbar_animation_controller_linear_fade.h"
-#include "cc/input/scrollbar_animation_controller_thinning.h"
 #include "cc/layers/heads_up_display_layer_impl.h"
 #include "cc/layers/layer.h"
 #include "cc/layers/layer_iterator.h"
@@ -1379,17 +1377,19 @@
   base::TimeDelta resize_delay = settings().scrollbar_fade_resize_delay;
   base::TimeDelta fade_duration = settings().scrollbar_fade_duration;
   switch (settings().scrollbar_animator) {
-    case LayerTreeSettings::LINEAR_FADE: {
-      return ScrollbarAnimationControllerLinearFade::Create(
-          scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
-          fade_duration);
+    case LayerTreeSettings::ANDROID_OVERLAY: {
+      return ScrollbarAnimationController::
+          CreateScrollbarAnimationControllerAndroid(
+              scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
+              fade_duration);
     }
-    case LayerTreeSettings::THINNING: {
+    case LayerTreeSettings::AURA_OVERLAY: {
       base::TimeDelta thinning_duration =
           settings().scrollbar_thinning_duration;
-      return ScrollbarAnimationControllerThinning::Create(
-          scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
-          fade_duration, thinning_duration);
+      return ScrollbarAnimationController::
+          CreateScrollbarAnimationControllerAuraOverlay(
+              scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
+              fade_duration, thinning_duration);
     }
     case LayerTreeSettings::NO_ANIMATOR:
       NOTREACHED();
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index 9aecae6..d414879 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -45,8 +45,8 @@
 
   enum ScrollbarAnimator {
     NO_ANIMATOR,
-    LINEAR_FADE,
-    THINNING,
+    ANDROID_OVERLAY,
+    AURA_OVERLAY,
   };
   ScrollbarAnimator scrollbar_animator = NO_ANIMATOR;
   base::TimeDelta scrollbar_fade_delay;
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 6d2da4302..a7642b1 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -385,7 +385,7 @@
     settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
     settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
   } else {
-    settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
+    settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY;
     settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300);
     settings.scrollbar_fade_resize_delay =
         base::TimeDelta::FromMilliseconds(2000);
@@ -424,7 +424,7 @@
 #else  // defined(OS_ANDROID)
 #if !defined(OS_MACOSX)
   if (ui::IsOverlayScrollbarEnabled()) {
-    settings.scrollbar_animator = cc::LayerTreeSettings::THINNING;
+    settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY;
     settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeOutDelay;
     settings.scrollbar_fade_resize_delay =
         ui::kOverlayScrollbarFadeOutDelay;
@@ -435,7 +435,7 @@
   } else {
     // TODO(bokan): This section is probably unneeded? We don't use scrollbar
     // animations for non overlay scrollbars.
-    settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
+    settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY;
     settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
     settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
     settings.scrollbar_fade_resize_delay =