[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 1 | // Copyright (c) 2012 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. | ||||
4 | |||||
5 | #ifndef CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_DELEGATE_H_ | ||||
6 | #define CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_DELEGATE_H_ | ||||
7 | |||||
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 8 | #include "base/compiler_specific.h" |
avi | b533f5d | 2015-12-25 03:11:15 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 10 | #include "content/browser/renderer_host/overscroll_controller.h" |
nsatragno | c0b2fa5 | 2015-04-09 22:30:51 | [diff] [blame] | 11 | #include "content/common/content_export.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 12 | #include "ui/gfx/geometry/rect.h" |
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 13 | |
14 | namespace content { | ||||
15 | |||||
16 | // The delegate receives overscroll gesture updates from the controller and | ||||
17 | // should perform appropriate actions. | ||||
nsatragno | c0b2fa5 | 2015-04-09 22:30:51 | [diff] [blame] | 18 | class CONTENT_EXPORT OverscrollControllerDelegate { |
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 19 | public: |
[email protected] | e42b1f8 | 2012-11-16 21:18:46 | [diff] [blame] | 20 | OverscrollControllerDelegate() {} |
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 21 | virtual ~OverscrollControllerDelegate() {} |
22 | |||||
[email protected] | fc4b06d0 | 2013-10-23 20:47:11 | [diff] [blame] | 23 | // Get the bounds of the view corresponding to the delegate. Overscroll-ending |
24 | // events will only be processed if the visible bounds are non-empty. | ||||
25 | virtual gfx::Rect GetVisibleBounds() const = 0; | ||||
26 | |||||
[email protected] | bfab3d0 | 2014-08-20 03:16:55 | [diff] [blame] | 27 | // This is called for each update in the overscroll amount. Returns true if |
28 | // the delegate consumed the event. | ||||
29 | virtual bool OnOverscrollUpdate(float delta_x, float delta_y) = 0; | ||||
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 30 | |
31 | // This is called when the overscroll completes. | ||||
32 | virtual void OnOverscrollComplete(OverscrollMode overscroll_mode) = 0; | ||||
33 | |||||
34 | // This is called when the direction of the overscroll changes. | ||||
mfomitchev | 09f0d64a | 2017-03-02 19:40:07 | [diff] [blame] | 35 | // When a new overscroll is started (i.e. when |new_mode| is not |
36 | // equal to OVERSCROLL_NONE), |source| will be set to the device that | ||||
37 | // triggered the overscroll gesture. | ||||
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 38 | virtual void OnOverscrollModeChange(OverscrollMode old_mode, |
mfomitchev | 09f0d64a | 2017-03-02 19:40:07 | [diff] [blame] | 39 | OverscrollMode new_mode, |
40 | OverscrollSource source) = 0; | ||||
[email protected] | b4df9df | 2012-11-16 01:58:58 | [diff] [blame] | 41 | |
42 | private: | ||||
43 | DISALLOW_COPY_AND_ASSIGN(OverscrollControllerDelegate); | ||||
44 | }; | ||||
45 | |||||
46 | } // namespace content | ||||
47 | |||||
48 | #endif // CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_DELEGATE_H_ |