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

Unified Diff: content/browser/web_contents/aura/overscroll_window_delegate.h

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/aura/overscroll_window_delegate.h
diff --git a/content/browser/web_contents/aura/overscroll_window_delegate.h b/content/browser/web_contents/aura/overscroll_window_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..aeca347cfd8a7d9e4f79b4fcf2ab1ebffa62b474
--- /dev/null
+++ b/content/browser/web_contents/aura/overscroll_window_delegate.h
@@ -0,0 +1,73 @@
+// Copyright 2015 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 CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_
+#define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_
+
+#include "content/browser/renderer_host/overscroll_controller.h"
+#include "content/browser/web_contents/aura/overscroll_navigation_overlay.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "ui/aura_extra/image_window_delegate.h"
+
+namespace content {
+
+// The window delegate for the overscroll window. This processes UI trackpad and
+// touch events and converts them to overscroll event. The delegate destroys
+// itself when the window is destroyed.
+class CONTENT_EXPORT OverscrollWindowDelegate
+ : public aura_extra::ImageWindowDelegate {
+ public:
+ OverscrollWindowDelegate(OverscrollControllerDelegate* delegate,
+ const gfx::Image& image);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(OverscrollWindowDelegateTest, BasicOverscrollModes);
+
+ ~OverscrollWindowDelegate() override;
+
+ // Starts the overscroll gesture.
+ void StartOverscroll();
+
+ // Resets the overscroll state.
+ void ResetOverscroll();
+
+ // Completes or resets the overscroll from the current state.
+ void CompleteOrResetOverscroll();
+
+ // Updates the current horizontal overscroll.
+ void UpdateOverscroll(float delta_x);
+
+ // Overridden from ui::EventHandler.
+ void OnKeyEvent(ui::KeyEvent* event) override;
+ void OnMouseEvent(ui::MouseEvent* event) override;
+ void OnScrollEvent(ui::ScrollEvent* event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+
+ // Delegate to which we forward overscroll events.
+ OverscrollControllerDelegate* delegate_;
+
+ // The current overscroll mode.
+ OverscrollMode overscroll_mode_;
+
+ // The latest delta_x scroll update.
+ float delta_x_;
+
+ // The ratio of overscroll at which we consider the overscroll completed.
+ const float complete_threshold_ratio_;
+
+ // The threshold for starting the overscroll gesture, for touchscreen or
+ // touchpads.
+ const float start_threshold_touchscreen_;
+ const float start_threshold_touchpad_;
+
+ // The threshold for starting the overscroll gesture for the current touch
+ // input.
+ float active_start_threshold_;
+
+ DISALLOW_COPY_AND_ASSIGN(OverscrollWindowDelegate);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698