| 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_ANDROID_OVERSCROLL_REFRESH_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ | 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "ui/gfx/geometry/size_f.h" | 11 #include "ui/gfx/geometry/size_f.h" |
| 12 #include "ui/gfx/geometry/vector2d_f.h" | 12 #include "ui/gfx/geometry/vector2d_f.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 class Layer; | 15 class Layer; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 class SystemUIResourceManager; | 19 class ResourceManager; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 // Allows both page reload activation and page reloading state queries. | 24 // Allows both page reload activation and page reloading state queries. |
| 25 class CONTENT_EXPORT OverscrollRefreshClient { | 25 class CONTENT_EXPORT OverscrollRefreshClient { |
| 26 public: | 26 public: |
| 27 virtual ~OverscrollRefreshClient() {} | 27 virtual ~OverscrollRefreshClient() {} |
| 28 | 28 |
| 29 // Called when the effect is released beyond the activation threshold. This | 29 // Called when the effect is released beyond the activation threshold. This |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 // 1) The scroll begins when the page has no vertical scroll offset. | 40 // 1) The scroll begins when the page has no vertical scroll offset. |
| 41 // 2) The page doesn't consume the initial scroll events. | 41 // 2) The page doesn't consume the initial scroll events. |
| 42 // 3) The initial scroll direction is upward. | 42 // 3) The initial scroll direction is upward. |
| 43 // The actual page reload action is triggered only when the effect is active | 43 // The actual page reload action is triggered only when the effect is active |
| 44 // and beyond a particular threshold when released. | 44 // and beyond a particular threshold when released. |
| 45 class CONTENT_EXPORT OverscrollRefresh { | 45 class CONTENT_EXPORT OverscrollRefresh { |
| 46 public: | 46 public: |
| 47 // Both |resource_manager| and |client| must not be null. | 47 // Both |resource_manager| and |client| must not be null. |
| 48 // |target_drag_offset_pixels| is the threshold beyond which the effect | 48 // |target_drag_offset_pixels| is the threshold beyond which the effect |
| 49 // will trigger a refresh action when released. | 49 // will trigger a refresh action when released. |
| 50 OverscrollRefresh(ui::SystemUIResourceManager* resource_manager, | 50 OverscrollRefresh(ui::ResourceManager* resource_manager, |
| 51 OverscrollRefreshClient* client, | 51 OverscrollRefreshClient* client, |
| 52 float target_drag_offset_pixels); | 52 float target_drag_offset_pixels); |
| 53 ~OverscrollRefresh(); | 53 ~OverscrollRefresh(); |
| 54 | 54 |
| 55 // Scroll event stream listening methods. | 55 // Scroll event stream listening methods. |
| 56 void OnScrollBegin(); | 56 void OnScrollBegin(); |
| 57 void OnScrollEnd(const gfx::Vector2dF& velocity); | 57 void OnScrollEnd(const gfx::Vector2dF& velocity); |
| 58 | 58 |
| 59 // Scroll ack listener. The effect will only be activated if the initial | 59 // Scroll ack listener. The effect will only be activated if the initial |
| 60 // updates go unconsumed. | 60 // updates go unconsumed. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 class Effect; | 103 class Effect; |
| 104 scoped_ptr<Effect> effect_; | 104 scoped_ptr<Effect> effect_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); | 106 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace content | 109 } // namespace content |
| 110 | 110 |
| 111 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ | 111 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
| OLD | NEW |