| 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_VIEW_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ | 6 #define IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 namespace ios_internal { | |
| 11 // Describes the current Index of an action in the OverScrollActionsView. | 10 // Describes the current Index of an action in the OverScrollActionsView. |
| 12 enum class OverscrollAction { | 11 enum class OverscrollAction { |
| 13 NONE, // No action | 12 NONE, // No action |
| 14 NEW_TAB, // New tab action | 13 NEW_TAB, // New tab action |
| 15 REFRESH, // Refresh action | 14 REFRESH, // Refresh action |
| 16 CLOSE_TAB, // Close tab action | 15 CLOSE_TAB, // Close tab action |
| 17 }; | 16 }; |
| 18 | 17 |
| 19 // Describes the style of the overscroll action UI. | 18 // Describes the style of the overscroll action UI. |
| 20 enum class OverscrollStyle { | 19 enum class OverscrollStyle { |
| 21 NTP_NON_INCOGNITO, // UI to fit the NTP in non incognito. | 20 NTP_NON_INCOGNITO, // UI to fit the NTP in non incognito. |
| 22 NTP_INCOGNITO, // UI to fit the NTP in incognito. | 21 NTP_INCOGNITO, // UI to fit the NTP in incognito. |
| 23 REGULAR_PAGE_NON_INCOGNITO, // UI to fit regular pages in non incognito. | 22 REGULAR_PAGE_NON_INCOGNITO, // UI to fit regular pages in non incognito. |
| 24 REGULAR_PAGE_INCOGNITO // UI to fit regular pages in incognito. | 23 REGULAR_PAGE_INCOGNITO // UI to fit regular pages in incognito. |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 } // namespace ios_internal | |
| 28 | |
| 29 @class OverscrollActionsView; | 26 @class OverscrollActionsView; |
| 30 | 27 |
| 31 @protocol OverscrollActionsViewDelegate | 28 @protocol OverscrollActionsViewDelegate |
| 32 | 29 |
| 33 - (void)overscrollActionsViewDidTapTriggerAction: | 30 - (void)overscrollActionsViewDidTapTriggerAction: |
| 34 (OverscrollActionsView*)overscrollActionsView; | 31 (OverscrollActionsView*)overscrollActionsView; |
| 35 | 32 |
| 36 @end | 33 @end |
| 37 | 34 |
| 38 // This view displays the actions of the OverscrollActionsController. | 35 // This view displays the actions of the OverscrollActionsController. |
| 39 // How actions are displayed depends on the vertical and horizontal offsets. | 36 // How actions are displayed depends on the vertical and horizontal offsets. |
| 40 @interface OverscrollActionsView : UIView | 37 @interface OverscrollActionsView : UIView |
| 41 | 38 |
| 42 // The currently selected action. | 39 // The currently selected action. |
| 43 @property(nonatomic, assign, readonly) | 40 @property(nonatomic, assign, readonly) OverscrollAction selectedAction; |
| 44 ios_internal::OverscrollAction selectedAction; | |
| 45 // The view displayed has the background of the overscroll actions view. | 41 // The view displayed has the background of the overscroll actions view. |
| 46 @property(nonatomic, retain, readonly) UIView* backgroundView; | 42 @property(nonatomic, retain, readonly) UIView* backgroundView; |
| 47 // Whether cropping is set on the selection circle (true by default). | 43 // Whether cropping is set on the selection circle (true by default). |
| 48 @property(nonatomic, assign) BOOL selectionCroppingEnabled; | 44 @property(nonatomic, assign) BOOL selectionCroppingEnabled; |
| 49 | 45 |
| 50 @property(nonatomic, assign) id<OverscrollActionsViewDelegate> delegate; | 46 @property(nonatomic, assign) id<OverscrollActionsViewDelegate> delegate; |
| 51 | 47 |
| 52 // Add a snapshot view on top of the background image view. The previous | 48 // Add a snapshot view on top of the background image view. The previous |
| 53 // snapshot view if any will be removed. | 49 // snapshot view if any will be removed. |
| 54 - (void)addSnapshotView:(UIView*)view; | 50 - (void)addSnapshotView:(UIView*)view; |
| 55 | 51 |
| 56 // Called to indicate that a new pull gesture has started. | 52 // Called to indicate that a new pull gesture has started. |
| 57 - (void)pullStarted; | 53 - (void)pullStarted; |
| 58 | 54 |
| 59 // Vertical offset [0, yOffset]. | 55 // Vertical offset [0, yOffset]. |
| 60 // This offset is set to the top inset of the scrollView managed by the | 56 // This offset is set to the top inset of the scrollView managed by the |
| 61 // OverscrollActionsController. | 57 // OverscrollActionsController. |
| 62 - (void)updateWithVerticalOffset:(CGFloat)offset; | 58 - (void)updateWithVerticalOffset:(CGFloat)offset; |
| 63 | 59 |
| 64 // Horizontal offset [-1,1]. | 60 // Horizontal offset [-1,1]. |
| 65 // This offset is set by the OverscrollActionsController and is used to display | 61 // This offset is set by the OverscrollActionsController and is used to display |
| 66 // the action selection circle. | 62 // the action selection circle. |
| 67 - (void)updateWithHorizontalOffset:(CGFloat)offset; | 63 - (void)updateWithHorizontalOffset:(CGFloat)offset; |
| 68 | 64 |
| 69 // This starts an "ink response" like animation typically triggered when an | 65 // This starts an "ink response" like animation typically triggered when an |
| 70 // action has been selected. | 66 // action has been selected. |
| 71 - (void)displayActionAnimation; | 67 - (void)displayActionAnimation; |
| 72 | 68 |
| 73 // Sets the style of the overscroll action UI. | 69 // Sets the style of the overscroll action UI. |
| 74 - (void)setStyle:(ios_internal::OverscrollStyle)style; | 70 - (void)setStyle:(OverscrollStyle)style; |
| 75 | 71 |
| 76 @end | 72 @end |
| 77 | 73 |
| 78 #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ | 74 #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
| OLD | NEW |