OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_STACK_VIEW_STACK_VIEW_CONTROLLER_PRIVATE_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_STACK_VIEW_STACK_VIEW_CONTROLLER_PRIVATE_H_ |
| 7 |
| 8 #import "ios/chrome/browser/ui/stack_view/card_set.h" |
| 9 #import "ios/chrome/browser/ui/stack_view/stack_view_controller.h" |
| 10 |
| 11 @class ToolbarController; |
| 12 |
| 13 namespace { |
| 14 // Styles used to specify the transition animation type for presenting and |
| 15 // dismissing the stack view. |
| 16 typedef enum { |
| 17 STACK_TRANSITION_STYLE_NONE = 0, |
| 18 STACK_TRANSITION_STYLE_PRESENTING, |
| 19 STACK_TRANSITION_STYLE_DISMISSING |
| 20 } StackTransitionStyle; |
| 21 } // namespace |
| 22 |
| 23 @interface StackViewController ()<CardSetObserver, |
| 24 UIGestureRecognizerDelegate, |
| 25 UIScrollViewDelegate> |
| 26 |
| 27 // Separated out to allow tests to mock CardSet directly. |
| 28 - (instancetype)initWithMainCardSet:(CardSet*)mainCardSet |
| 29 otrCardSet:(CardSet*)otrCardSet |
| 30 activeCardSet:(CardSet*)activeCardSet |
| 31 NS_DESIGNATED_INITIALIZER; |
| 32 |
| 33 - (instancetype)initWithNibName:(NSString*)nibNameOrNil |
| 34 bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; |
| 35 |
| 36 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 37 |
| 38 // Sets up the display views of the card sets, including initialization, |
| 39 // initial size configuration, adding as subviews of the scroll view, and |
| 40 // attaching to the card sets. |
| 41 - (void)setUpDisplayViews; |
| 42 |
| 43 // Registers listeners for the appropriate notifications. |
| 44 - (void)registerForNotifications; |
| 45 |
| 46 // Used during |-dealloc| and |-didReceiveMemoryWaring| to clear any references |
| 47 // to the cards and removes |self| as an observer to any notifications. |
| 48 - (void)cleanUpViewsAndNotifications; |
| 49 |
| 50 // Recenters the scroll view if it gets too close to one of its boundaries. |
| 51 // Updates the positions of the card stacks' display views to remain visually |
| 52 // centered. |
| 53 - (void)recenterScrollViewIfNecessary; |
| 54 |
| 55 // Returns YES if the currently active card set is the incognito set. |
| 56 - (BOOL)isCurrentSetIncognito; |
| 57 |
| 58 // Returns the card set that is not currently active. |
| 59 - (CardSet*)inactiveCardSet; |
| 60 |
| 61 // Makes |cardSet| the active set, updating the UI accordingly. |
| 62 - (void)setActiveCardSet:(CardSet*)cardSet; |
| 63 |
| 64 // Returns YES if both decks should be visible. |
| 65 - (BOOL)bothDecksShouldBeDisplayed; |
| 66 |
| 67 // Returns the region, in scroll view coordinates, of the inactive deck. |
| 68 - (CGRect)inactiveDeckRegion; |
| 69 |
| 70 // The currently active card set. |
| 71 @property(nonatomic, readonly) CardSet* activeCardSet; |
| 72 |
| 73 // The current transition style. |
| 74 @property(nonatomic, assign) StackTransitionStyle transitionStyle; |
| 75 |
| 76 // Will be set to YES when a transition animation is cancelled before it can |
| 77 // finish. |
| 78 @property(nonatomic, assign) BOOL transitionWasCancelled; |
| 79 |
| 80 // The owner of |transitionToolbarController|. |
| 81 @property(nonatomic, retain) id<ToolbarOwner> transitionToolbarOwner; |
| 82 |
| 83 // The toolbar controller used in transition animations. |
| 84 @property(nonatomic, retain) ToolbarController* transitionToolbarController; |
| 85 |
| 86 // The dummy view used in the transition animation. |
| 87 @property(nonatomic, retain) UIView* dummyToolbarBackgroundView; |
| 88 |
| 89 // The cached frame of the transition toolbar's frame. |
| 90 @property(nonatomic, assign) CGRect transitionToolbarFrame; |
| 91 |
| 92 // Records which card was tapped mid-presentation animation, if any. |
| 93 // TODO(crbug.com/546209): Implement reversed animations for dismissing with a |
| 94 // new selected card mid-presentation. |
| 95 @property(nonatomic, retain) StackCard* transitionTappedCard; |
| 96 |
| 97 // |YES| if there is card set animation being processed. |
| 98 @property(nonatomic, readonly) BOOL inActiveDeckChangeAnimation; |
| 99 |
| 100 @end |
| 101 |
| 102 @interface StackViewController (Testing) |
| 103 |
| 104 // The driver of scroll events. |
| 105 @property(nonatomic, readonly) UIScrollView* scrollView; |
| 106 |
| 107 @end |
| 108 |
| 109 #endif // IOS_CHROME_BROWSER_UI_STACK_VIEW_STACK_VIEW_CONTROLLER_PRIVATE_H_ |
OLD | NEW |