1 // Copyright 2014 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_GESTURE_NAV_SIMPLE_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
21 class ArrowLayerDelegate
;
22 class WebContentsImpl
;
24 // A simple delegate for the overscroll controller that paints an arrow on top
25 // of the web-contents as a hint for pending navigations from overscroll.
26 class GestureNavSimple
: public OverscrollControllerDelegate
{
28 explicit GestureNavSimple(WebContentsImpl
* web_contents
);
29 ~GestureNavSimple() override
;
32 void ApplyEffectsAndDestroy(const gfx::Transform
& transform
, float opacity
);
33 void AbortGestureAnimation();
34 void CompleteGestureAnimation();
35 bool ApplyEffectsForDelta(float delta_x
);
37 // OverscrollControllerDelegate:
38 gfx::Rect
GetVisibleBounds() const override
;
39 // Returns true if the scroll update was consumed.
40 bool OnOverscrollUpdate(float delta_x
, float delta_y
) override
;
41 void OnOverscrollComplete(OverscrollMode overscroll_mode
) override
;
42 void OnOverscrollModeChange(OverscrollMode old_mode
,
43 OverscrollMode new_mode
) override
;
45 WebContentsImpl
* web_contents_
;
46 scoped_ptr
<ui::Layer
> clip_layer_
;
47 scoped_ptr
<ui::Layer
> arrow_
;
48 scoped_ptr
<ArrowLayerDelegate
> arrow_delegate_
;
49 float completion_threshold_
;
51 DISALLOW_COPY_AND_ASSIGN(GestureNavSimple
);
54 } // namespace content
56 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_