[Android] Add a flag to disable the pull-to-refresh effect

Some people may not like pull-to-refresh. Some people may not like our
implementation of pull-to-reresh. Some people may not like refreshing
at all. Let's accomodate such users with a disabling override,
particularly now as we're experimenting with the initial version of the
effect.

The flag also allows for experiments gauging accidental activation and
other potentially negative side-effects.

Also remove the kEnableOverscrollNotifications flag; overscroll
notifications are now bundled with event acks, creating
minimal extra overhead for non-consuming platforms.

BUG=428429

Review URL: https://codereview.chromium.org/733293002

Cr-Commit-Position: refs/heads/master@{#305154}
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc
index 04c4a175..c28e3d5a 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -62,6 +62,9 @@
   // WebView uses the Android system's scrollbars and overscroll glow.
   cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect);
 
+  // Pull-to-refresh should never be a default WebView action.
+  cl->AppendSwitch(switches::kDisablePullToRefreshEffect);
+
   // Not yet supported in single-process mode.
   cl->AppendSwitch(switches::kDisableSharedWorkers);
 
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index aab4ce7a..a516413 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6604,6 +6604,12 @@
         <message name="IDS_FLAGS_DISABLE_CLICK_DELAY_DESCRIPTION" desc="Description of the flag to disable the click delay.">
           Always send click events immediate upon a tap, even when it's part of a double-tap gesture.  This speeds up navigation and other tap actions by 300ms on most pages, but means links and buttons must be avoided when double tapping to zoom.
         </message>
+        <message name="IDS_FLAGS_DISABLE_PULL_TO_REFRESH_EFFECT_NAME" desc="Name of the flag to disable the pull-to-refresh effect.">
+          Disable the pull-to-refresh effect.
+        </message>
+        <message name="IDS_FLAGS_DISABLE_PULL_TO_REFRESH_EFFECT_DESCRIPTION" desc="Description of the flag to disable the pull-to-refresh effect.">
+          Disable page reloads triggered by vertically overscrolling content.
+        </message>
       </if>
       <if expr="is_macosx">
         <message name="IDS_FLAGS_ENABLE_TRANSLATE_NEW_UX_NAME" desc="Name of the flag to enable the new Translate UX.">
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 1ad51bf..b635ba9 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1644,6 +1644,13 @@
     // Java-only switch: CommandLine.DISABLE_CLICK_DELAY
     SINGLE_VALUE_TYPE("disable-click-delay")
   },
+  {
+    "disable-pull-to-refresh-effect",
+    IDS_FLAGS_DISABLE_PULL_TO_REFRESH_EFFECT_NAME,
+    IDS_FLAGS_DISABLE_PULL_TO_REFRESH_EFFECT_DESCRIPTION,
+    kOsAndroid,
+    SINGLE_VALUE_TYPE(switches::kDisablePullToRefreshEffect)
+  },
 #endif
 #if defined(OS_MACOSX)
   {
diff --git a/content/browser/android/content_startup_flags.cc b/content/browser/android/content_startup_flags.cc
index d531dbb..d8e132c4 100644
--- a/content/browser/android/content_startup_flags.cc
+++ b/content/browser/android/content_startup_flags.cc
@@ -57,7 +57,6 @@
   parsed_command_line->AppendSwitch(switches::kEnablePinch);
   parsed_command_line->AppendSwitch(switches::kEnableOverlayFullscreenVideo);
   parsed_command_line->AppendSwitch(switches::kEnableOverlayScrollbar);
-  parsed_command_line->AppendSwitch(switches::kEnableOverscrollNotifications);
   parsed_command_line->AppendSwitch(switches::kValidateInputEventStream);
 
   // Run the GPU service as a thread in the browser instead of as a
diff --git a/content/browser/android/overscroll_controller_android.cc b/content/browser/android/overscroll_controller_android.cc
index b32d809..6b794b82 100644
--- a/content/browser/android/overscroll_controller_android.cc
+++ b/content/browser/android/overscroll_controller_android.cc
@@ -5,13 +5,14 @@
 #include "content/browser/android/overscroll_controller_android.h"
 
 #include "base/android/build_info.h"
-#include "base/bind.h"
+#include "base/command_line.h"
 #include "cc/layers/layer.h"
 #include "cc/output/compositor_frame_metadata.h"
 #include "content/browser/android/edge_effect.h"
 #include "content/browser/android/edge_effect_l.h"
 #include "content/common/input/did_overscroll_params.h"
 #include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "ui/base/android/window_android_compositor.h"
 
@@ -38,24 +39,46 @@
       new EdgeEffect(resource_manager, dpi_scale));
 }
 
+scoped_ptr<OverscrollGlow> CreateGlowEffect(OverscrollGlowClient* client,
+                                            float dpi_scale) {
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kDisableOverscrollEdgeEffect)) {
+    return nullptr;
+  }
+
+  return make_scoped_ptr(new OverscrollGlow(client));
+}
+
+scoped_ptr<OverscrollRefresh> CreateRefreshEffect(
+    ui::WindowAndroidCompositor* compositor,
+    OverscrollRefreshClient* client,
+    float dpi_scale) {
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kDisablePullToRefreshEffect)) {
+    return nullptr;
+  }
+
+  return make_scoped_ptr(
+      new OverscrollRefresh(&compositor->GetSystemUIResourceManager(), client,
+                            kDefaultRefreshDragTargetDips * dpi_scale));
+}
+
 }  // namespace
 
 OverscrollControllerAndroid::OverscrollControllerAndroid(
     WebContents* web_contents,
     ui::WindowAndroidCompositor* compositor,
     float dpi_scale)
-    : WebContentsObserver(web_contents),
-      compositor_(compositor),
+    : compositor_(compositor),
       dpi_scale_(dpi_scale),
       enabled_(true),
-      glow_effect_(base::Bind(&CreateGlowEdgeEffect,
-                              &compositor->GetSystemUIResourceManager(),
-                              dpi_scale_)),
-      refresh_effect_(&compositor->GetSystemUIResourceManager(),
-                      this,
-                      kDefaultRefreshDragTargetDips * dpi_scale),
+      glow_effect_(CreateGlowEffect(this, dpi_scale)),
+      refresh_effect_(CreateRefreshEffect(compositor, this, dpi_scale)),
       triggered_refresh_active_(false) {
   DCHECK(web_contents);
+  DCHECK(compositor);
+  if (refresh_effect_)
+    Observe(web_contents);
 }
 
 OverscrollControllerAndroid::~OverscrollControllerAndroid() {
@@ -66,11 +89,14 @@
   if (!enabled_)
     return false;
 
+  if (!refresh_effect_)
+    return false;
+
   bool handled = false;
   bool maybe_needs_animate = false;
   switch (event.type) {
     case blink::WebInputEvent::GestureScrollBegin:
-      refresh_effect_.OnScrollBegin();
+      refresh_effect_->OnScrollBegin();
       break;
 
     case blink::WebInputEvent::GestureScrollUpdate: {
@@ -78,11 +104,11 @@
                                   event.data.scrollUpdate.deltaY);
       scroll_delta.Scale(dpi_scale_);
       maybe_needs_animate = true;
-      handled = refresh_effect_.WillHandleScrollUpdate(scroll_delta);
+      handled = refresh_effect_->WillHandleScrollUpdate(scroll_delta);
     } break;
 
     case blink::WebInputEvent::GestureScrollEnd:
-      refresh_effect_.OnScrollEnd(gfx::Vector2dF());
+      refresh_effect_->OnScrollEnd(gfx::Vector2dF());
       maybe_needs_animate = true;
       break;
 
@@ -90,8 +116,8 @@
       gfx::Vector2dF scroll_velocity(event.data.flingStart.velocityX,
                                      event.data.flingStart.velocityY);
       scroll_velocity.Scale(dpi_scale_);
-      refresh_effect_.OnScrollEnd(scroll_velocity);
-      if (refresh_effect_.IsActive()) {
+      refresh_effect_->OnScrollEnd(scroll_velocity);
+      if (refresh_effect_->IsActive()) {
         // TODO(jdduke): Figure out a cleaner way of suppressing a fling.
         // It's important that the any downstream code sees a scroll-ending
         // event (in this case GestureFlingStart) if it has seen a scroll begin.
@@ -111,7 +137,7 @@
       break;
   }
 
-  if (maybe_needs_animate && refresh_effect_.IsActive())
+  if (maybe_needs_animate && refresh_effect_->IsActive())
     SetNeedsAnimate();
 
   return handled;
@@ -130,12 +156,13 @@
     OnOverscrolled(DidOverscrollParams());
   }
 
-  if (event.type == blink::WebInputEvent::GestureScrollUpdate) {
+  if (event.type == blink::WebInputEvent::GestureScrollUpdate &&
+      refresh_effect_) {
     // The effect should only be allowed if both the causal touch events go
     // unconsumed and the generated scroll events go unconsumed.
     bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED ||
                     event.data.scrollUpdate.previousUpdateInSequencePrevented;
-    refresh_effect_.OnScrollUpdateAck(consumed);
+    refresh_effect_->OnScrollUpdateAck(consumed);
   }
 }
 
@@ -144,20 +171,22 @@
   if (!enabled_)
     return;
 
-  if (refresh_effect_.IsActive() ||
-      refresh_effect_.IsAwaitingScrollUpdateAck()) {
+  if (refresh_effect_ && (refresh_effect_->IsActive() ||
+                          refresh_effect_->IsAwaitingScrollUpdateAck())) {
     // An active (or potentially active) refresh effect should always pre-empt
     // the passive glow effect.
     return;
   }
 
-  if (glow_effect_.OnOverscrolled(
-      base::TimeTicks::Now(),
-      gfx::ScaleVector2d(params.accumulated_overscroll, dpi_scale_),
-      gfx::ScaleVector2d(params.latest_overscroll_delta, dpi_scale_),
-      gfx::ScaleVector2d(params.current_fling_velocity, dpi_scale_),
-      gfx::ScaleVector2d(params.causal_event_viewport_point.OffsetFromOrigin(),
-                         dpi_scale_))) {
+  if (glow_effect_ &&
+      glow_effect_->OnOverscrolled(
+          base::TimeTicks::Now(),
+          gfx::ScaleVector2d(params.accumulated_overscroll, dpi_scale_),
+          gfx::ScaleVector2d(params.latest_overscroll_delta, dpi_scale_),
+          gfx::ScaleVector2d(params.current_fling_velocity, dpi_scale_),
+          gfx::ScaleVector2d(
+              params.causal_event_viewport_point.OffsetFromOrigin(),
+              dpi_scale_))) {
     SetNeedsAnimate();
   }
 }
@@ -168,13 +197,19 @@
   if (!enabled_)
     return false;
 
-  bool needs_animate = refresh_effect_.Animate(current_time, parent_layer);
-  needs_animate |= glow_effect_.Animate(current_time, parent_layer);
+  bool needs_animate = false;
+  if (refresh_effect_)
+    needs_animate |= refresh_effect_->Animate(current_time, parent_layer);
+  if (glow_effect_)
+    needs_animate |= glow_effect_->Animate(current_time, parent_layer);
   return needs_animate;
 }
 
 void OverscrollControllerAndroid::OnFrameMetadataUpdated(
     const cc::CompositorFrameMetadata& frame_metadata) {
+  if (!refresh_effect_ && !glow_effect_)
+    return;
+
   const float scale_factor =
       frame_metadata.page_scale_factor * frame_metadata.device_scale_factor;
   gfx::SizeF viewport_size =
@@ -184,9 +219,13 @@
   gfx::Vector2dF content_scroll_offset =
       gfx::ScaleVector2d(frame_metadata.root_scroll_offset, scale_factor);
 
-  refresh_effect_.UpdateDisplay(viewport_size, content_scroll_offset);
-  glow_effect_.UpdateDisplay(viewport_size, content_size,
-                             content_scroll_offset);
+  if (refresh_effect_)
+    refresh_effect_->UpdateDisplay(viewport_size, content_scroll_offset);
+
+  if (glow_effect_) {
+    glow_effect_->UpdateDisplay(viewport_size, content_size,
+                                content_scroll_offset);
+  }
 }
 
 void OverscrollControllerAndroid::Enable() {
@@ -198,8 +237,10 @@
     return;
   enabled_ = false;
   if (!enabled_) {
-    refresh_effect_.Reset();
-    glow_effect_.Reset();
+    if (refresh_effect_)
+      refresh_effect_->Reset();
+    if (glow_effect_)
+      glow_effect_->Reset();
   }
 }
 
@@ -225,6 +266,11 @@
   return triggered_refresh_active_;
 }
 
+scoped_ptr<EdgeEffectBase> OverscrollControllerAndroid::CreateEdgeEffect() {
+  return CreateGlowEdgeEffect(&compositor_->GetSystemUIResourceManager(),
+                              dpi_scale_);
+}
+
 void OverscrollControllerAndroid::SetNeedsAnimate() {
   compositor_->SetNeedsAnimate();
 }
diff --git a/content/browser/android/overscroll_controller_android.h b/content/browser/android/overscroll_controller_android.h
index 3de5e529..fb18098c2 100644
--- a/content/browser/android/overscroll_controller_android.h
+++ b/content/browser/android/overscroll_controller_android.h
@@ -32,7 +32,8 @@
 // Glue class for handling all inputs into Android-specific overscroll effects,
 // both the passive overscroll glow and the active overscroll pull-to-refresh.
 // Note that all input coordinates (both for events and overscroll) are in DIPs.
-class OverscrollControllerAndroid : public OverscrollRefreshClient,
+class OverscrollControllerAndroid : public OverscrollGlowClient,
+                                    public OverscrollRefreshClient,
                                     public WebContentsObserver {
  public:
   OverscrollControllerAndroid(WebContents* web_contents,
@@ -72,6 +73,9 @@
   void TriggerRefresh() override;
   bool IsStillRefreshing() const override;
 
+  // OverscrollGlowClient implementation.
+  scoped_ptr<EdgeEffectBase> CreateEdgeEffect() override;
+
   void SetNeedsAnimate();
 
   ui::WindowAndroidCompositor* compositor_;
@@ -80,8 +84,8 @@
   bool enabled_;
 
   // TODO(jdduke): Factor out a common API from the two overscroll effects.
-  OverscrollGlow glow_effect_;
-  OverscrollRefresh refresh_effect_;
+  scoped_ptr<OverscrollGlow> glow_effect_;
+  scoped_ptr<OverscrollRefresh> refresh_effect_;
   bool triggered_refresh_active_;
 
   DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid);
diff --git a/content/browser/android/overscroll_glow.cc b/content/browser/android/overscroll_glow.cc
index a5355d4..8985b6a5 100644
--- a/content/browser/android/overscroll_glow.cc
+++ b/content/browser/android/overscroll_glow.cc
@@ -75,11 +75,9 @@
 
 }  // namespace
 
-OverscrollGlow::OverscrollGlow(const EdgeEffectProvider& edge_effect_provider)
-    : edge_effect_provider_(edge_effect_provider),
-      edge_offsets_(),
-      initialized_(false) {
-  DCHECK(!edge_effect_provider_.is_null());
+OverscrollGlow::OverscrollGlow(OverscrollGlowClient* client)
+    : client_(client), edge_offsets_(), initialized_(false) {
+  DCHECK(client);
 }
 
 OverscrollGlow::~OverscrollGlow() {
@@ -206,7 +204,7 @@
   DCHECK(!root_layer_.get());
   root_layer_ = cc::Layer::Create();
   for (size_t i = 0; i < EDGE_COUNT; ++i) {
-    edge_effects_[i] = edge_effect_provider_.Run();
+    edge_effects_[i] = client_->CreateEdgeEffect();
     DCHECK(edge_effects_[i]);
   }
 
diff --git a/content/browser/android/overscroll_glow.h b/content/browser/android/overscroll_glow.h
index 56fa452..6c4aed247 100644
--- a/content/browser/android/overscroll_glow.h
+++ b/content/browser/android/overscroll_glow.h
@@ -5,7 +5,6 @@
 #ifndef CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_
 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_
 
-#include "base/callback.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
@@ -20,6 +19,15 @@
 
 class EdgeEffectBase;
 
+// Provides lazy, customized EdgeEffect creation.
+class OverscrollGlowClient {
+ public:
+  virtual ~OverscrollGlowClient() {}
+
+  // Called lazily, after the initial overscrolling event.
+  virtual scoped_ptr<EdgeEffectBase> CreateEdgeEffect() = 0;
+};
+
 /* |OverscrollGlow| mirrors its Android counterpart, OverscrollGlow.java.
  * Conscious tradeoffs were made to align this as closely as possible with the
  * original Android Java version.
@@ -28,14 +36,10 @@
  public:
   enum Edge { EDGE_TOP = 0, EDGE_LEFT, EDGE_BOTTOM, EDGE_RIGHT, EDGE_COUNT };
 
-  // Allows lazy creation of the edge effects.
-  typedef base::Callback<scoped_ptr<EdgeEffectBase>(void)> EdgeEffectProvider;
-
-  // |edge_effect_provider| must be valid for the duration of the effect's
-  // lifetime.  The effect is enabled by default, but will remain dormant until
-  // the first overscroll event.
-  explicit OverscrollGlow(const EdgeEffectProvider& edge_effect_provider);
-
+  // |client| must be valid for the duration of the effect's lifetime.
+  // The effect is enabled by default, but will remain dormant until the first
+  // overscroll event.
+  explicit OverscrollGlow(OverscrollGlowClient* client);
   ~OverscrollGlow();
 
   // Called when the root content layer overscrolls.
@@ -81,7 +85,7 @@
 
   EdgeEffectBase* GetOppositeEdge(int edge_index);
 
-  EdgeEffectProvider edge_effect_provider_;
+  OverscrollGlowClient* const client_;
   scoped_ptr<EdgeEffectBase> edge_effects_[EDGE_COUNT];
 
   gfx::SizeF viewport_size_;
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 5dc07f8..33dc9bfa 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1147,7 +1147,6 @@
     switches::kEnableOneCopy,
     switches::kEnableOverlayFullscreenVideo,
     switches::kEnableOverlayScrollbar,
-    switches::kEnableOverscrollNotifications,
     switches::kEnablePinch,
     switches::kEnablePreciseMemoryInfo,
     switches::kEnableRendererMojoChannel,
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 10b2078..c5faff4 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -217,9 +217,6 @@
       ime_adapter_android_(this),
       cached_background_color_(SK_ColorWHITE),
       last_output_surface_id_(kUndefinedOutputSurfaceId),
-      overscroll_controller_enabled_(
-          !base::CommandLine::ForCurrentProcess()->HasSwitch(
-              switches::kDisableOverscrollEdgeEffect)),
       gesture_provider_(CreateGestureProviderConfig(), this),
       gesture_text_selector_(this),
       accelerated_surface_route_id_(0),
@@ -1551,7 +1548,7 @@
   if (!selection_controller_)
     selection_controller_ = CreateSelectionController(this, content_view_core_);
 
-  if (overscroll_controller_enabled_ && !overscroll_controller_ &&
+  if (!overscroll_controller_ &&
       content_view_core_->GetWindowAndroid()->GetCompositor()) {
     overscroll_controller_ = CreateOverscrollController(content_view_core_);
   }
@@ -1575,7 +1572,7 @@
 
 void RenderWidgetHostViewAndroid::OnAttachCompositor() {
   DCHECK(content_view_core_);
-  if (overscroll_controller_enabled_ && !overscroll_controller_)
+  if (!overscroll_controller_)
     overscroll_controller_ = CreateOverscrollController(content_view_core_);
 }
 
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index ac6a66d..8eb187a 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -373,7 +373,6 @@
   std::queue<base::Closure> ack_callbacks_;
 
   // Used to control and render overscroll-related effects.
-  const bool overscroll_controller_enabled_;
   scoped_ptr<OverscrollControllerAndroid> overscroll_controller_;
 
   // Provides gesture synthesis given a stream of touch events (derived from
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index ff2ef521..399d147 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -400,9 +400,6 @@
 // Enables use of hardware overlay for fullscreen video playback. Android only.
 const char kEnableOverlayFullscreenVideo[]  = "enable-overlay-fullscreen-video";
 
-// Forward overscroll event data from the renderer to the browser.
-const char kEnableOverscrollNotifications[] = "enable-overscroll-notifications";
-
 // Enables compositor-accelerated touch-screen pinch gestures.
 const char kEnablePinch[]                   = "enable-pinch";
 
@@ -910,6 +907,9 @@
 // Disable overscroll edge effects like those found in Android views.
 const char kDisableOverscrollEdgeEffect[]   = "disable-overscroll-edge-effect";
 
+// Disable the pull-to-refresh effect when vertically overscrolling content.
+const char kDisablePullToRefreshEffect[]   = "disable-pull-to-refresh-effect";
+
 // WebRTC is enabled by default on Android.
 const char kDisableWebRTC[]                 = "disable-webrtc";
 
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 233db5e..d23d0f25 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -120,7 +120,6 @@
 CONTENT_EXPORT extern const char kEnableNetworkInformation[];
 CONTENT_EXPORT extern const char kEnableOneCopy[];
 CONTENT_EXPORT extern const char kEnableOverlayFullscreenVideo[];
-CONTENT_EXPORT extern const char kEnableOverscrollNotifications[];
 CONTENT_EXPORT extern const char kEnablePinch[];
 CONTENT_EXPORT extern const char kEnablePreciseMemoryInfo[];
 CONTENT_EXPORT extern const char kEnableRegionBasedColumns[];
@@ -258,6 +257,7 @@
 CONTENT_EXPORT extern const char kDisableGestureRequirementForMediaPlayback[];
 CONTENT_EXPORT extern const char kDisableClickDelay[];
 CONTENT_EXPORT extern const char kDisableOverscrollEdgeEffect[];
+CONTENT_EXPORT extern const char kDisablePullToRefreshEffect[];
 CONTENT_EXPORT extern const char kDisableWebRTC[];
 CONTENT_EXPORT extern const char kEnableSpeechRecognition[];
 CONTENT_EXPORT extern const char kForceUseOverlayEmbeddedVideo[];
diff --git a/content/renderer/input/input_event_filter.cc b/content/renderer/input/input_event_filter.cc
index d93836a9..d2e4f7fd 100644
--- a/content/renderer/input/input_event_filter.cc
+++ b/content/renderer/input/input_event_filter.cc
@@ -6,7 +6,6 @@
 
 #include "base/auto_reset.h"
 #include "base/bind.h"
-#include "base/command_line.h"
 #include "base/debug/trace_event.h"
 #include "base/location.h"
 #include "base/message_loop/message_loop_proxy.h"
@@ -48,12 +47,8 @@
       main_listener_(main_listener),
       sender_(NULL),
       target_loop_(target_loop),
-      overscroll_notifications_enabled_(false),
       current_overscroll_params_(NULL) {
   DCHECK(target_loop_.get());
-  overscroll_notifications_enabled_ =
-      CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableOverscrollNotifications);
 }
 
 void InputEventFilter::SetBoundHandler(const Handler& handler) {
@@ -74,9 +69,6 @@
 
 void InputEventFilter::DidOverscroll(int routing_id,
                                      const DidOverscrollParams& params) {
-  if (!overscroll_notifications_enabled_)
-    return;
-
   if (current_overscroll_params_) {
     current_overscroll_params_->reset(new DidOverscrollParams(params));
     return;
diff --git a/content/renderer/input/input_event_filter.h b/content/renderer/input/input_event_filter.h
index e7982f6..19eac67 100644
--- a/content/renderer/input/input_event_filter.h
+++ b/content/renderer/input/input_event_filter.h
@@ -93,9 +93,6 @@
   // Indicates the routing_ids for which input events should be filtered.
   std::set<int> routes_;
 
-  // Specifies whether overscroll notifications are forwarded to the host.
-  bool overscroll_notifications_enabled_;
-
   // Used to intercept overscroll notifications while an event is being
   // dispatched.  If the event causes overscroll, the overscroll metadata can be
   // bundled in the event ack, saving an IPC.  Note that we must continue
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 37d3f7d..a228a7a 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -48612,6 +48612,7 @@
   <int value="851085848" label="enable-settings-window"/>
   <int value="869531646" label="enable-session-crashed-bubble"/>
   <int value="879699575" label="disable-gesture-tap-highlight"/>
+  <int value="879992337" label="disable-pull-to-refresh-effect"/>
   <int value="880510010" label="enable-permissions-bubbles"/>
   <int value="887011602" label="enable-spelling-auto-correct"/>
   <int value="909439558" label="disable-device-discovery"/>