OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_STACK_VIEW_STACK_VIEW_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher.h" |
| 11 #include "ui/base/page_transition_types.h" |
| 12 |
| 13 class GURL; |
| 14 @class Tab; |
| 15 @class TabModel; |
| 16 |
| 17 // A protocol used by the StackViewController for test purposes. |
| 18 @protocol StackViewControllerTestDelegate |
| 19 @required |
| 20 // Informs the delegate that the show tab animation starts. |
| 21 - (void)stackViewControllerShowWithSelectedTabAnimationDidStart; |
| 22 // Informs the delegate that the show tab animation finished. |
| 23 - (void)stackViewControllerShowWithSelectedTabAnimationDidEnd; |
| 24 // Informs the delegate that the preload of card views finished. |
| 25 - (void)stackViewControllerPreloadCardViewsDidEnd; |
| 26 @end |
| 27 |
| 28 // Controller for the tab-switching UI displayed as a stack of tabs. |
| 29 @interface StackViewController : UIViewController<TabSwitcher> |
| 30 |
| 31 @property(nonatomic, assign) id<TabSwitcherDelegate> delegate; |
| 32 @property(nonatomic, assign) id<StackViewControllerTestDelegate> testDelegate; |
| 33 |
| 34 // Initializes with the given tab models, which must not be nil. |
| 35 // |activeTabModel| is the model which starts active, and must be one of the |
| 36 // other two models. |
| 37 // TODO(stuartmorgan): Replace the word 'active' in these methods and the |
| 38 // corresponding delegate methods. crbug.com/513782 |
| 39 - (instancetype)initWithMainTabModel:(TabModel*)mainModel |
| 40 otrTabModel:(TabModel*)otrModel |
| 41 activeTabModel:(TabModel*)activeModel; |
| 42 |
| 43 // Restores internal state with the given tab models, which must not be nil. |
| 44 // |activeTabModel| is the model which starts active, and must be one of the |
| 45 // other two models. Should only be called when the object is not being shown. |
| 46 - (void)restoreInternalStateWithMainTabModel:(TabModel*)mainModel |
| 47 otrTabModel:(TabModel*)otrModel |
| 48 activeTabModel:(TabModel*)activeModel; |
| 49 |
| 50 // Updates the otr tab model. Should only be called when both the current otr |
| 51 // tab model and the new otr tab model are either nil or contain no tabs. Must |
| 52 // be called when the otr tab model will be deleted because the incognito |
| 53 // browser state is deleted. |
| 54 - (void)setOtrTabModel:(TabModel*)otrModel; |
| 55 |
| 56 // Performs an animation to zoom the selected tab from the full size of the |
| 57 // content area to its proper place in the stack. Should be called after the |
| 58 // view has been made visible. |
| 59 - (void)showWithSelectedTabAnimation; |
| 60 |
| 61 // Performs an animation to zoom the selected tab to the full size of the |
| 62 // content area. When the animation completes, calls |
| 63 // |-stackViewControllerDismissAnimationWillStartWithActiveModel:| and |
| 64 // |-stackViewControllerDismissAnimationDidEnd| on the delegate. |
| 65 - (void)dismissWithSelectedTabAnimation; |
| 66 |
| 67 // If the stack view is not already being dismissed, switches to |targetModel|'s |
| 68 // mode and performs the animation for switching out of the stack view while |
| 69 // simultaneously opening a tab with |url| in |targetModel| at the given |
| 70 // |position| with |transition|. Otherwise, simply returns nil. |
| 71 // If |position| == NSNotFound the tab will be added at the end of the stack. |
| 72 - (Tab*)dismissWithNewTabAnimationToModel:(TabModel*)targetModel |
| 73 withURL:(const GURL&)url |
| 74 atIndex:(NSUInteger)position |
| 75 transition:(ui::PageTransition)transition; |
| 76 |
| 77 @end |
| 78 |
| 79 #endif // IOS_CHROME_BROWSER_UI_STACK_VIEW_STACK_VIEW_CONTROLLER_H_ |
OLD | NEW |