| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 11 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 12 | 12 |
| 13 namespace gfx { | |
| 14 class Transform; | |
| 15 } | |
| 16 | |
| 17 namespace ui { | |
| 18 class Layer; | |
| 19 } | |
| 20 | |
| 21 namespace content { | 13 namespace content { |
| 22 | 14 |
| 23 class ArrowLayerDelegate; | |
| 24 class WebContentsImpl; | 15 class WebContentsImpl; |
| 25 | 16 |
| 26 // A simple delegate for the overscroll controller that paints an arrow on top | 17 // A simple delegate for the overscroll controller that paints an arrow on top |
| 27 // of the web-contents as a hint for pending navigations from overscroll. | 18 // of the web-contents as a hint for pending navigations from overscroll. |
| 28 class GestureNavSimple : public OverscrollControllerDelegate { | 19 class GestureNavSimple : public OverscrollControllerDelegate { |
| 29 public: | 20 public: |
| 30 explicit GestureNavSimple(WebContentsImpl* web_contents); | 21 explicit GestureNavSimple(WebContentsImpl* web_contents); |
| 31 ~GestureNavSimple() override; | 22 ~GestureNavSimple() override; |
| 32 | 23 |
| 33 private: | 24 private: |
| 34 void ApplyEffectsAndDestroy(const gfx::Transform& transform, float opacity); | 25 class Affordance; |
| 26 |
| 35 void AbortGestureAnimation(); | 27 void AbortGestureAnimation(); |
| 36 void CompleteGestureAnimation(); | 28 void CompleteGestureAnimation(); |
| 37 bool ApplyEffectsForDelta(float delta_x); | |
| 38 | 29 |
| 39 // OverscrollControllerDelegate: | 30 // OverscrollControllerDelegate: |
| 40 gfx::Rect GetVisibleBounds() const override; | 31 gfx::Rect GetVisibleBounds() const override; |
| 41 // Returns true if the scroll update was consumed. | |
| 42 bool OnOverscrollUpdate(float delta_x, float delta_y) override; | 32 bool OnOverscrollUpdate(float delta_x, float delta_y) override; |
| 43 void OnOverscrollComplete(OverscrollMode overscroll_mode) override; | 33 void OnOverscrollComplete(OverscrollMode overscroll_mode) override; |
| 44 void OnOverscrollModeChange(OverscrollMode old_mode, | 34 void OnOverscrollModeChange(OverscrollMode old_mode, |
| 45 OverscrollMode new_mode) override; | 35 OverscrollMode new_mode) override; |
| 46 | 36 |
| 47 WebContentsImpl* web_contents_; | 37 WebContentsImpl* web_contents_; |
| 48 std::unique_ptr<ui::Layer> clip_layer_; | 38 std::unique_ptr<Affordance> affordance_; |
| 49 std::unique_ptr<ui::Layer> arrow_; | |
| 50 std::unique_ptr<ArrowLayerDelegate> arrow_delegate_; | |
| 51 float completion_threshold_; | 39 float completion_threshold_; |
| 52 | 40 |
| 53 DISALLOW_COPY_AND_ASSIGN(GestureNavSimple); | 41 DISALLOW_COPY_AND_ASSIGN(GestureNavSimple); |
| 54 }; | 42 }; |
| 55 | 43 |
| 56 } // namespace content | 44 } // namespace content |
| 57 | 45 |
| 58 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ | 46 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_GESTURE_NAV_SIMPLE_H_ |
| OLD | NEW |