| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLER_H
_ | 5 #ifndef IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLER_H
_ |
| 6 #define IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLER_H
_ | 6 #define IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLER_H
_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h" | 10 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h" |
| 11 #import "ios/chrome/browser/ui/util/relaxed_bounds_constraints_hittest.h" | 11 #import "ios/chrome/browser/ui/util/relaxed_bounds_constraints_hittest.h" |
| 12 #import "ios/web/public/web_state/crw_web_controller_observer.h" | 12 #import "ios/web/public/web_state/crw_web_controller_observer.h" |
| 13 #import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h" | 13 #import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h" |
| 14 | 14 |
| 15 @class OverscrollActionsController; | 15 @class OverscrollActionsController; |
| 16 | 16 |
| 17 namespace ios_internal { | |
| 18 // Describe the current state of the overscroll action controller. | 17 // Describe the current state of the overscroll action controller. |
| 19 enum class OverscrollState { | 18 enum class OverscrollState { |
| 20 NO_PULL_STARTED, // No pull started. | 19 NO_PULL_STARTED, // No pull started. |
| 21 STARTED_PULLING, // Started pulling. | 20 STARTED_PULLING, // Started pulling. |
| 22 ACTION_READY // Ready to take action on pull end. | 21 ACTION_READY // Ready to take action on pull end. |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 // Notification sent when the overscroll actions controller will start | 24 // Notification sent when the overscroll actions controller will start |
| 26 // displaying the UI. | 25 // displaying the UI. |
| 27 extern NSString* const kOverscollActionsWillStart; | 26 extern NSString* const kOverscrollActionsWillStart; |
| 28 // Notification sent when the overscroll actions controller did stop displaying | 27 // Notification sent when the overscroll actions controller did stop displaying |
| 29 // the UI. | 28 // the UI. |
| 30 extern NSString* const kOverscollActionsDidEnd; | 29 extern NSString* const kOverscrollActionsDidEnd; |
| 31 } // namespace ios_internal | |
| 32 | 30 |
| 33 // The delegate of the OverscrollActionsController, it provides the headerView | 31 // The delegate of the OverscrollActionsController, it provides the headerView |
| 34 // on which the OverscrollActionsView will be added. | 32 // on which the OverscrollActionsView will be added. |
| 35 // The scrollView is used to control the state of the | 33 // The scrollView is used to control the state of the |
| 36 // OverscrollActionsController. | 34 // OverscrollActionsController. |
| 37 // The delegate must implement the shouldAllowOverscrollActions method in order | 35 // The delegate must implement the shouldAllowOverscrollActions method in order |
| 38 // to allow overscroll actions. | 36 // to allow overscroll actions. |
| 39 // Finally the overscrollActionsController:didTriggerActionAtIndex: method is | 37 // Finally the overscrollActionsController:didTriggerActionAtIndex: method is |
| 40 // called when an action has been triggered. | 38 // called when an action has been triggered. |
| 41 @protocol OverscrollActionsControllerDelegate<NSObject> | 39 @protocol OverscrollActionsControllerDelegate<NSObject> |
| 42 // Called when an action has been triggered. | 40 // Called when an action has been triggered. |
| 43 // The action index holds the current triggered action which are numbered left | 41 // The action index holds the current triggered action which are numbered left |
| 44 // to right. | 42 // to right. |
| 45 - (void)overscrollActionsController:(OverscrollActionsController*)controller | 43 - (void)overscrollActionsController:(OverscrollActionsController*)controller |
| 46 didTriggerAction:(ios_internal::OverscrollAction)action; | 44 didTriggerAction:(OverscrollAction)action; |
| 47 // Should return true when the delegate wants to enable the overscroll actions. | 45 // Should return true when the delegate wants to enable the overscroll actions. |
| 48 - (BOOL)shouldAllowOverscrollActions; | 46 - (BOOL)shouldAllowOverscrollActions; |
| 49 // The toolbar snapshot view that will be used to fade in/out the toolbar. | 47 // The toolbar snapshot view that will be used to fade in/out the toolbar. |
| 50 // This snapshot will be animated when performing the pull down animation | 48 // This snapshot will be animated when performing the pull down animation |
| 51 // revealing the actions. | 49 // revealing the actions. |
| 52 - (UIView*)toolbarSnapshotView; | 50 - (UIView*)toolbarSnapshotView; |
| 53 // The header view over which the overscroll action view will be added. | 51 // The header view over which the overscroll action view will be added. |
| 54 - (UIView<RelaxedBoundsConstraintsHitTestSupport>*)headerView; | 52 - (UIView<RelaxedBoundsConstraintsHitTestSupport>*)headerView; |
| 55 // Called to retrieve the top inset added to the scrollview for the header. | 53 // Called to retrieve the top inset added to the scrollview for the header. |
| 56 - (CGFloat)overscrollActionsControllerHeaderInset: | 54 - (CGFloat)overscrollActionsControllerHeaderInset: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 83 // configured to use the scrollview from the CRWWebControllerObserver. | 81 // configured to use the scrollview from the CRWWebControllerObserver. |
| 84 - (instancetype)init; | 82 - (instancetype)init; |
| 85 // Designated initializer, when initialized with a scrollview, the | 83 // Designated initializer, when initialized with a scrollview, the |
| 86 // OverscrollActionsController will not use the CRWWebControllerObserver to | 84 // OverscrollActionsController will not use the CRWWebControllerObserver to |
| 87 // configure the scrollview, it will directly use the passed scrollview. | 85 // configure the scrollview, it will directly use the passed scrollview. |
| 88 - (instancetype)initWithScrollView:(UIScrollView*)scrollView; | 86 - (instancetype)initWithScrollView:(UIScrollView*)scrollView; |
| 89 | 87 |
| 90 // The scrollview the overscroll controller will control. | 88 // The scrollview the overscroll controller will control. |
| 91 @property(nonatomic, readonly) UIScrollView* scrollView; | 89 @property(nonatomic, readonly) UIScrollView* scrollView; |
| 92 // The current state of the overscroll controller. | 90 // The current state of the overscroll controller. |
| 93 @property(nonatomic, assign, readonly) | 91 @property(nonatomic, assign, readonly) OverscrollState overscrollState; |
| 94 ios_internal::OverscrollState overscrollState; | |
| 95 // The delegate must be set for the OverscrollActionsController to work | 92 // The delegate must be set for the OverscrollActionsController to work |
| 96 // properly. | 93 // properly. |
| 97 @property(nonatomic, assign) id<OverscrollActionsControllerDelegate> delegate; | 94 @property(nonatomic, assign) id<OverscrollActionsControllerDelegate> delegate; |
| 98 | 95 |
| 99 // Used to clear state maintained by the controller and de-register from | 96 // Used to clear state maintained by the controller and de-register from |
| 100 // notifications. After this call the controller ceases to function and will | 97 // notifications. After this call the controller ceases to function and will |
| 101 // clear its delegate. | 98 // clear its delegate. |
| 102 - (void)invalidate; | 99 - (void)invalidate; |
| 103 // Force the controller to switch to NO_PULL_STARTED state. | 100 // Force the controller to switch to NO_PULL_STARTED state. |
| 104 - (void)clear; | 101 - (void)clear; |
| 105 // Disabling overscroll actions will stop showing the overscroll actions view on | 102 // Disabling overscroll actions will stop showing the overscroll actions view on |
| 106 // top of the header when the user is pulling the webview's scrollview. | 103 // top of the header when the user is pulling the webview's scrollview. |
| 107 // Disable/enableOverscrollActions method calls are ref counted, this means | 104 // Disable/enableOverscrollActions method calls are ref counted, this means |
| 108 // that calls to disable must be compensated by the same amount of call to | 105 // that calls to disable must be compensated by the same amount of call to |
| 109 // enable in order to reenable overscroll actions. | 106 // enable in order to reenable overscroll actions. |
| 110 - (void)disableOverscrollActions; | 107 - (void)disableOverscrollActions; |
| 111 // Enabling overscroll actions will reverse the effect of a call to | 108 // Enabling overscroll actions will reverse the effect of a call to |
| 112 // -disableOverscrollActions. | 109 // -disableOverscrollActions. |
| 113 - (void)enableOverscrollActions; | 110 - (void)enableOverscrollActions; |
| 114 // Sets the style of the overscroll actions. | 111 // Sets the style of the overscroll actions. |
| 115 - (void)setStyle:(ios_internal::OverscrollStyle)style; | 112 - (void)setStyle:(OverscrollStyle)style; |
| 116 | 113 |
| 117 @end | 114 @end |
| 118 | 115 |
| 119 #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLE
R_H_ | 116 #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_CONTROLLE
R_H_ |
| OLD | NEW |