Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher.h

Issue 2588733002: Upstream Chrome on iOS source code [9/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_TAB_SWITCHER_TAB_SWITCHER_H_
6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_H_
7
8 #import <UIKit/UIKit.h>
9
10 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
11 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h"
12 #include "ui/base/page_transition_types.h"
13 #include "url/gurl.h"
14
15 @class Tab;
16 @class TabModel;
17 @protocol TabSwitcher;
18 @protocol ToolbarOwner;
19
20 // This delegate is used to drive the TabSwitcher dismissal and execute code
21 // when the presentation and dismmiss animations finishes. The main controller
22 // is a good exemple of the implementation of this delegate.
23 @protocol TabSwitcherDelegate<NSObject>
24
25 // Informs the delegate the stack controller is starting to be dismissed with
26 // the given model active.
27 - (void)tabSwitcher:(id<TabSwitcher>)tabSwitcher
28 dismissTransitionWillStartWithActiveModel:(TabModel*)tabModel;
29
30 // Informs the delegate that the stack controller is done and should be
31 // dismissed.
32 - (void)tabSwitcherDismissTransitionDidEnd:(id<TabSwitcher>)tabSwitcher;
33
34 // Informs the delegate that the stack controller has finished its
35 // presentation transition animation.
36 - (void)tabSwitcherPresentationTransitionDidEnd:(id<TabSwitcher>)tabSwitcher;
37
38 // Returns a reference to the owner of the toolbar that should be used in the
39 // transition animations.
40 - (id<ToolbarOwner>)tabSwitcherTransitionToolbarOwner;
41
42 @end
43
44 // This protocol describes the common interface between the two implementations
45 // of the tab switcher. StackViewController for iPhone and TabSwitcherController
46 // for iPad are examples of implementers of this protocol.
47 @protocol TabSwitcher
48
49 // This delegate must be set on the tab switcher in order to drive the tab
50 // switcher.
51 @property(nonatomic, assign) id<TabSwitcherDelegate> delegate;
52
53 // Restores the internal state of the tab switcher with the given tab models,
54 // which must not be nil. |activeTabModel| is the model which starts active,
55 // and must be one of the other two models. Should only be called when the
56 // object is not being shown.
57 - (void)restoreInternalStateWithMainTabModel:(TabModel*)mainModel
58 otrTabModel:(TabModel*)otrModel
59 activeTabModel:(TabModel*)activeModel;
60
61 // Returns the root view of the tab switcher.
62 - (UIView*)view;
63
64 // Performs an animation of the selected tab from its presented state to its
65 // place in the tab switcher. Should be called after the tab switcher's view has
66 // been presented.
67 - (void)showWithSelectedTabAnimation;
68
69 // Performs an animation from the selected tab in the tab switcher to the
70 // presented tab in the content area. When the animation completes, calls the
71 // delegate methods:
72 // |-tabSwitcher:dismissTransitionWillStartWithActiveModel:| and
73 // |-tabSwitcherDismissTransitionDidEnd:|
74 - (Tab*)dismissWithNewTabAnimationToModel:(TabModel*)targetModel
75 withURL:(const GURL&)url
76 atIndex:(NSUInteger)position
77 transition:(ui::PageTransition)transition;
78
79 // Updates the OTR (Off The Record) tab model. Should only be called when both
80 // the current OTR tab model and the new OTR tab model are either nil or contain
81 // no tabs. This must be called after the otr tab model has been deleted because
82 // the incognito browser state is deleted.
83 - (void)setOtrTabModel:(TabModel*)otrModel;
84
85 @optional
86 @property(nonatomic, retain) TabSwitcherTransitionContext* transitionContext;
87
88 // Dismisses the tab switcher using the given tab model. The dismissal of the
89 // tab switcher will be animated if the |animated| parameter is set to YES.
90 - (void)tabSwitcherDismissWithModel:(TabModel*)model animated:(BOOL)animated;
91
92 @end
93
94 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698