| 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 UI_ANDROID_OVERSCROLL_REFRESH_H_ |    5 #ifndef UI_ANDROID_OVERSCROLL_REFRESH_H_ | 
|    6 #define UI_ANDROID_OVERSCROLL_REFRESH_H_ |    6 #define UI_ANDROID_OVERSCROLL_REFRESH_H_ | 
|    7  |    7  | 
|    8 #include "base/macros.h" |    8 #include "base/macros.h" | 
|    9 #include "ui/android/ui_android_export.h" |    9 #include "ui/android/ui_android_export.h" | 
|   10 #include "ui/gfx/geometry/size_f.h" |   10 #include "ui/gfx/geometry/size_f.h" | 
|   11 #include "ui/gfx/geometry/vector2d_f.h" |   11 #include "ui/gfx/geometry/vector2d_f.h" | 
|   12  |   12  | 
|   13 namespace ui { |   13 namespace ui { | 
|   14  |   14  | 
|   15 class UI_ANDROID_EXPORT OverscrollRefreshHandler { |   15 class OverscrollRefreshHandler; | 
|   16  public: |  | 
|   17   // Signals the start of an overscrolling pull. Returns whether the handler |  | 
|   18   // will consume the overscroll gesture, in which case it will receive the |  | 
|   19   // remaining pull updates. |  | 
|   20   virtual bool PullStart() = 0; |  | 
|   21  |  | 
|   22   // Signals a pull update, where |delta| is in device pixels. |  | 
|   23   virtual void PullUpdate(float delta) = 0; |  | 
|   24  |  | 
|   25   // Signals the release of the pull, and whether the release is allowed to |  | 
|   26   // trigger the refresh action. |  | 
|   27   virtual void PullRelease(bool allow_refresh) = 0; |  | 
|   28  |  | 
|   29   // Reset the active pull state. |  | 
|   30   virtual void PullReset() = 0; |  | 
|   31  |  | 
|   32  protected: |  | 
|   33   virtual ~OverscrollRefreshHandler() {} |  | 
|   34 }; |  | 
|   35  |   16  | 
|   36 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally |   17 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally | 
|   37 // activating when: |   18 // activating when: | 
|   38 //   1) The scroll begins when the page's root layer 1) has no vertical scroll |   19 //   1) The scroll begins when the page's root layer 1) has no vertical scroll | 
|   39 //      offset and 2) lacks the overflow-y:hidden property. |   20 //      offset and 2) lacks the overflow-y:hidden property. | 
|   40 //   2) The page doesn't consume the initial scroll events. |   21 //   2) The page doesn't consume the initial scroll events. | 
|   41 //   3) The initial scroll direction is upward. |   22 //   3) The initial scroll direction is upward. | 
|   42 // The actuall pull response, animation and action are delegated to the |   23 // The actuall pull response, animation and action are delegated to the | 
|   43 // provided refresh handler. |   24 // provided refresh handler. | 
|   44 class UI_ANDROID_EXPORT OverscrollRefresh { |   25 class UI_ANDROID_EXPORT OverscrollRefresh { | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   92     DISABLED, |   73     DISABLED, | 
|   93     AWAITING_SCROLL_UPDATE_ACK, |   74     AWAITING_SCROLL_UPDATE_ACK, | 
|   94     ENABLED, |   75     ENABLED, | 
|   95   } scroll_consumption_state_; |   76   } scroll_consumption_state_; | 
|   96  |   77  | 
|   97   OverscrollRefreshHandler* const handler_; |   78   OverscrollRefreshHandler* const handler_; | 
|   98  |   79  | 
|   99   DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); |   80   DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); | 
|  100 }; |   81 }; | 
|  101  |   82  | 
|  102 }  // namespace content |   83 }  // namespace ui | 
|  103  |   84  | 
|  104 #endif  // UI_ANDROID_OVERSCROLL_REFRESH_H_ |   85 #endif  // UI_ANDROID_OVERSCROLL_REFRESH_H_ | 
| OLD | NEW |