| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_ANDROID_OVERSCROLL_GLOW_H_ | 5 #ifndef UI_ANDROID_OVERSCROLL_GLOW_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | 6 #define UI_ANDROID_OVERSCROLL_GLOW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "content/browser/android/edge_effect_base.h" | 12 #include "ui/android/edge_effect_base.h" |
| 13 #include "ui/android/ui_android_export.h" |
| 12 #include "ui/gfx/geometry/size_f.h" | 14 #include "ui/gfx/geometry/size_f.h" |
| 13 #include "ui/gfx/geometry/vector2d_f.h" | 15 #include "ui/gfx/geometry/vector2d_f.h" |
| 14 | 16 |
| 15 namespace cc { | 17 namespace cc { |
| 16 class Layer; | 18 class Layer; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace ui { |
| 20 | 22 |
| 21 // Provides lazy, customized EdgeEffect creation. | 23 // Provides lazy, customized EdgeEffect creation. |
| 22 class OverscrollGlowClient { | 24 class UI_ANDROID_EXPORT OverscrollGlowClient { |
| 23 public: | 25 public: |
| 24 virtual ~OverscrollGlowClient() {} | 26 virtual ~OverscrollGlowClient() {} |
| 25 | 27 |
| 26 // Called lazily, after the initial overscrolling event. | 28 // Called lazily, after the initial overscrolling event. |
| 27 virtual scoped_ptr<EdgeEffectBase> CreateEdgeEffect() = 0; | 29 virtual scoped_ptr<EdgeEffectBase> CreateEdgeEffect() = 0; |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 /* |OverscrollGlow| mirrors its Android counterpart, OverscrollGlow.java. | 32 /* |OverscrollGlow| mirrors its Android counterpart, OverscrollGlow.java. |
| 31 * Conscious tradeoffs were made to align this as closely as possible with the | 33 * Conscious tradeoffs were made to align this as closely as possible with the |
| 32 * original Android Java version. | 34 * original Android Java version. |
| 33 */ | 35 */ |
| 34 class OverscrollGlow { | 36 class UI_ANDROID_EXPORT OverscrollGlow { |
| 35 public: | 37 public: |
| 36 // |client| must be valid for the duration of the effect's lifetime. | 38 // |client| must be valid for the duration of the effect's lifetime. |
| 37 // The effect is enabled by default, but will remain dormant until the first | 39 // The effect is enabled by default, but will remain dormant until the first |
| 38 // overscroll event. | 40 // overscroll event. |
| 39 explicit OverscrollGlow(OverscrollGlowClient* client); | 41 explicit OverscrollGlow(OverscrollGlowClient* client); |
| 40 ~OverscrollGlow(); | 42 ~OverscrollGlow(); |
| 41 | 43 |
| 42 // Called when the root content layer overscrolls. | 44 // Called when the root content layer overscrolls. |
| 43 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while | 45 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while |
| 44 // |velocity| is in device pixels / second. | 46 // |velocity| is in device pixels / second. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 float edge_offsets_[EDGE_COUNT]; | 100 float edge_offsets_[EDGE_COUNT]; |
| 99 bool initialized_; | 101 bool initialized_; |
| 100 bool allow_horizontal_overscroll_; | 102 bool allow_horizontal_overscroll_; |
| 101 bool allow_vertical_overscroll_; | 103 bool allow_vertical_overscroll_; |
| 102 | 104 |
| 103 scoped_refptr<cc::Layer> root_layer_; | 105 scoped_refptr<cc::Layer> root_layer_; |
| 104 | 106 |
| 105 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 107 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace content | 110 } // namespace ui |
| 109 | 111 |
| 110 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | 112 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ |
| OLD | NEW |