[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / web_contents / aura / overscroll_window_delegate.h
blobaeca347cfd8a7d9e4f79b4fcf2ab1ebffa62b474
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_
8 #include "content/browser/renderer_host/overscroll_controller.h"
9 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h"
10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "ui/aura_extra/image_window_delegate.h"
13 namespace content {
15 // The window delegate for the overscroll window. This processes UI trackpad and
16 // touch events and converts them to overscroll event. The delegate destroys
17 // itself when the window is destroyed.
18 class CONTENT_EXPORT OverscrollWindowDelegate
19 : public aura_extra::ImageWindowDelegate {
20 public:
21 OverscrollWindowDelegate(OverscrollControllerDelegate* delegate,
22 const gfx::Image& image);
24 private:
25 FRIEND_TEST_ALL_PREFIXES(OverscrollWindowDelegateTest, BasicOverscrollModes);
27 ~OverscrollWindowDelegate() override;
29 // Starts the overscroll gesture.
30 void StartOverscroll();
32 // Resets the overscroll state.
33 void ResetOverscroll();
35 // Completes or resets the overscroll from the current state.
36 void CompleteOrResetOverscroll();
38 // Updates the current horizontal overscroll.
39 void UpdateOverscroll(float delta_x);
41 // Overridden from ui::EventHandler.
42 void OnKeyEvent(ui::KeyEvent* event) override;
43 void OnMouseEvent(ui::MouseEvent* event) override;
44 void OnScrollEvent(ui::ScrollEvent* event) override;
45 void OnGestureEvent(ui::GestureEvent* event) override;
47 // Delegate to which we forward overscroll events.
48 OverscrollControllerDelegate* delegate_;
50 // The current overscroll mode.
51 OverscrollMode overscroll_mode_;
53 // The latest delta_x scroll update.
54 float delta_x_;
56 // The ratio of overscroll at which we consider the overscroll completed.
57 const float complete_threshold_ratio_;
59 // The threshold for starting the overscroll gesture, for touchscreen or
60 // touchpads.
61 const float start_threshold_touchscreen_;
62 const float start_threshold_touchpad_;
64 // The threshold for starting the overscroll gesture for the current touch
65 // input.
66 float active_start_threshold_;
68 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowDelegate);
71 } // namespace content
73 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_