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

Side by Side Diff: ios/chrome/browser/tabs/tab_model.h

Issue 2720983002: Remove windowName from CRWSessionController. (Closed)
Patch Set: Address comments. Created 3 years, 9 months 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
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/chrome/browser/tabs/tab_model.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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_TABS_TAB_MODEL_H_ 5 #ifndef IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_
6 #define IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ 6 #define IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window; 136 - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window;
137 137
138 // Uses the SessionServiceIOS to persist the tab model to disk, either 138 // Uses the SessionServiceIOS to persist the tab model to disk, either
139 // immediately or deferred based on the value of |immediately|. 139 // immediately or deferred based on the value of |immediately|.
140 - (void)saveSessionImmediately:(BOOL)immediately; 140 - (void)saveSessionImmediately:(BOOL)immediately;
141 141
142 // Accesses the tab at the given index. 142 // Accesses the tab at the given index.
143 - (Tab*)tabAtIndex:(NSUInteger)index; 143 - (Tab*)tabAtIndex:(NSUInteger)index;
144 - (NSUInteger)indexOfTab:(Tab*)tab; 144 - (NSUInteger)indexOfTab:(Tab*)tab;
145 145
146 // Returns the tab object associated from the given JS-level window name.
147 - (Tab*)tabWithWindowName:(NSString*)windowName;
148
149 // Returns the next Tab, starting after |tab|, spawned by the specified Tab, If 146 // Returns the next Tab, starting after |tab|, spawned by the specified Tab, If
150 // |after| is a valid tab, will only look at tabs following it (in tab ordering, 147 // |after| is a valid tab, will only look at tabs following it (in tab ordering,
151 // not order opened) in the list, even if it comes before |tab|. Returns nil if 148 // not order opened) in the list, even if it comes before |tab|. Returns nil if
152 // no tab meets this constraint. 149 // no tab meets this constraint.
153 - (Tab*)nextTabWithOpener:(Tab*)tab afterTab:(Tab*)afterTab; 150 - (Tab*)nextTabWithOpener:(Tab*)tab afterTab:(Tab*)afterTab;
154 151
155 // TODO(crbug.com/661980): Make these |firstTabOpenedBy| and |lastTabOpenedBy| 152 // TODO(crbug.com/661980): Make these |firstTabOpenedBy| and |lastTabOpenedBy|
156 // better mimic what desktop chrome does. Or, better yet, use shared code. 153 // better mimic what desktop chrome does. Or, better yet, use shared code.
157 // Placing anew tab in its proper location along the tab strip is based on the 154 // Placing anew tab in its proper location along the tab strip is based on the
158 // tab's 'opener' tab, the tab from which the new tab was opened. For the user, 155 // tab's 'opener' tab, the tab from which the new tab was opened. For the user,
159 // that does not mean the tab in UI terms, but the page from which the new tab 156 // that does not mean the tab in UI terms, but the page from which the new tab
160 // is opened. Currently, to best provide this behavior, the session ID of the 157 // is opened. Currently, to best provide this behavior, the session ID of the
161 // tab is supplemented with its navigation index. If both those items match, it 158 // tab is supplemented with its navigation index. If both those items match, it
162 // is assumed that the tabs belong to the same owner's group. Note that using 159 // is assumed that the tabs belong to the same owner's group. Note that using
163 // navigation index is a limited solution, and may in some cases be incorrect, 160 // navigation index is a limited solution, and may in some cases be incorrect,
164 // as forward or back navigations (incrementing/decrementing the navigation 161 // as forward or back navigations (incrementing/decrementing the navigation
165 // index) may result in incorrect tab pairings. 162 // index) may result in incorrect tab pairings.
166 163
167 // Returns the last tab in the model opened by the specified tab at its current 164 // Returns the last tab in the model opened by the specified tab at its current
168 // navigation index. The search starts at |tab|. Returns nil if no tab meets 165 // navigation index. The search starts at |tab|. Returns nil if no tab meets
169 // these constraints. 166 // these constraints.
170 - (Tab*)lastTabWithOpener:(Tab*)tab; 167 - (Tab*)lastTabWithOpener:(Tab*)tab;
171 168
172 // Returns the tab which opened this tab, or nil if it's not a child. 169 // Returns the tab which opened this tab, or nil if it's not a child.
173 - (Tab*)openerOfTab:(Tab*)tab; 170 - (Tab*)openerOfTab:(Tab*)tab;
174 171
175 // Add/modify tabs. 172 // Add/modify tabs.
176 173
177 // Either opens a tab at the specified URL and register its JS-supplied window 174 // Opens a tab at the specified URL. For certain transition types, will consult
178 // name if appropriate, or navigates the tab corresponding to |windowName| to 175 // the order controller and thus may only use |index| as a hint. |parentTab| may
179 // the given |URL|. Will also update the current tab if |inBackground| is NO. 176 // be nil if there is no parent associated with this new tab. |openedByDOM| is
180 // |openedByDOM| is YES if the page was opened by DOM. The |index| parameter can 177 // YES if the page was opened by DOM. The |index| parameter can be set to
181 // be set to TabModelConstants::kTabPositionAutomatically if the caller doesn't 178 // TabModelConstants::kTabPositionAutomatically if the caller doesn't have a
182 // have a preference for the position of the tab. 179 // preference for the position of the tab.
183 - (Tab*)insertOrUpdateTabWithURL:(const GURL&)URL 180 - (Tab*)insertTabWithURL:(const GURL&)URL
184 referrer:(const web::Referrer&)referrer 181 referrer:(const web::Referrer&)referrer
185 transition:(ui::PageTransition)transition 182 transition:(ui::PageTransition)transition
186 windowName:(NSString*)windowName 183 opener:(Tab*)parentTab
187 opener:(Tab*)parentTab 184 openedByDOM:(BOOL)openedByDOM
188 openedByDOM:(BOOL)openedByDOM 185 atIndex:(NSUInteger)index
189 atIndex:(NSUInteger)index 186 inBackground:(BOOL)inBackground;
190 inBackground:(BOOL)inBackground;
191 187
192 // As above, but using WebLoadParams to specify various optional parameters. 188 // As above, but using WebLoadParams to specify various optional parameters.
193 - (Tab*)insertOrUpdateTabWithLoadParams: 189 - (Tab*)insertTabWithLoadParams:
194 (const web::NavigationManager::WebLoadParams&)params 190 (const web::NavigationManager::WebLoadParams&)params
195 windowName:(NSString*)windowName 191 opener:(Tab*)parentTab
196 opener:(Tab*)parentTab 192 openedByDOM:(BOOL)openedByDOM
197 openedByDOM:(BOOL)openedByDOM 193 atIndex:(NSUInteger)index
198 atIndex:(NSUInteger)index 194 inBackground:(BOOL)inBackground;
199 inBackground:(BOOL)inBackground;
200 195
201 // Opens a blank tab without URL and updates the current tab if |inBackground| 196 // Opens a blank tab without URL and updates the current tab if |inBackground|
202 // is NO. 197 // is NO.
203 - (Tab*)insertBlankTabWithTransition:(ui::PageTransition)transition 198 - (Tab*)insertBlankTabWithTransition:(ui::PageTransition)transition
204 opener:(Tab*)parentTab 199 opener:(Tab*)parentTab
205 openedByDOM:(BOOL)openedByDOM 200 openedByDOM:(BOOL)openedByDOM
206 atIndex:(NSUInteger)index 201 atIndex:(NSUInteger)index
207 inBackground:(BOOL)inBackground; 202 inBackground:(BOOL)inBackground;
208 203
209 // Inserts a new tab at the given |index| with the session history specified by 204 // Inserts a new tab at the given |index| with the session history specified by
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 - (void)didCloseTab:(Tab*)closedTab; 279 - (void)didCloseTab:(Tab*)closedTab;
285 // Called by |tab| to inform the model that a navigation has taken place. 280 // Called by |tab| to inform the model that a navigation has taken place.
286 // TODO(crbug.com/661983): once more of the navigation state has moved into WC, 281 // TODO(crbug.com/661983): once more of the navigation state has moved into WC,
287 // replace this with WebStateObserver. 282 // replace this with WebStateObserver.
288 - (void)navigationCommittedInTab:(Tab*)tab; 283 - (void)navigationCommittedInTab:(Tab*)tab;
289 284
290 @end 285 @end
291 286
292 @interface TabModel (PrivateForTestingOnly) 287 @interface TabModel (PrivateForTestingOnly)
293 288
294 // Opens a tab at the specified URL and register its JS-supplied window name if 289 // Opens a tab at the specified URL. The newly created tab will not be the child
295 // appropriate. The newly created tab will not be the child of any other tab. 290 // of any other tab. This does not go through the order controller. Used a page
296 // This does not go through the order controller. Used a page transition of 291 // transition of TYPED.
297 // TYPED. 292 - (Tab*)addTabWithURL:(const GURL&)URL referrer:(const web::Referrer&)referrer;
298 - (Tab*)addTabWithURL:(const GURL&)URL
299 referrer:(const web::Referrer&)referrer
300 windowName:(NSString*)windowName;
301 293
302 // Inserts a new tab at the given |index| with the given |URL| and |referrer|. 294 // Inserts a new tab at the given |index| with the given |URL| and |referrer|.
303 // This does not go through the order controller. Uses a page transition of 295 // This does not go through the order controller. Uses a page transition of
304 // TYPED. 296 // TYPED.
305 - (Tab*)insertTabWithURL:(const GURL&)URL 297 - (Tab*)insertTabWithURL:(const GURL&)URL
306 referrer:(const web::Referrer&)referrer 298 referrer:(const web::Referrer&)referrer
307 windowName:(NSString*)windowName
308 opener:(Tab*)parentTab 299 opener:(Tab*)parentTab
309 atIndex:(NSUInteger)index; 300 atIndex:(NSUInteger)index;
310 301
311 @end 302 @end
312 303
313 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ 304 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/chrome/browser/tabs/tab_model.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698