OLD | NEW |
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 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
| 13 #import "ios/web/public/navigation_item_list.h" |
13 #import "ios/web/public/navigation_manager.h" | 14 #import "ios/web/public/navigation_manager.h" |
14 #include "ui/base/page_transition_types.h" | 15 #include "ui/base/page_transition_types.h" |
15 | 16 |
16 class GURL; | 17 class GURL; |
17 class SessionID; | 18 class SessionID; |
18 @class SessionServiceIOS; | 19 @class SessionServiceIOS; |
19 @class SessionWindowIOS; | 20 @class SessionWindowIOS; |
20 @class Tab; | 21 @class Tab; |
21 @protocol TabModelObserver; | 22 @protocol TabModelObserver; |
22 class TabModelSyncedWindowDelegate; | 23 class TabModelSyncedWindowDelegate; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 inBackground:(BOOL)inBackground; | 193 inBackground:(BOOL)inBackground; |
193 | 194 |
194 // Opens a blank tab without URL and updates the current tab if |inBackground| | 195 // Opens a blank tab without URL and updates the current tab if |inBackground| |
195 // is NO. | 196 // is NO. |
196 - (Tab*)insertBlankTabWithTransition:(ui::PageTransition)transition | 197 - (Tab*)insertBlankTabWithTransition:(ui::PageTransition)transition |
197 opener:(Tab*)parentTab | 198 opener:(Tab*)parentTab |
198 openedByDOM:(BOOL)openedByDOM | 199 openedByDOM:(BOOL)openedByDOM |
199 atIndex:(NSUInteger)index | 200 atIndex:(NSUInteger)index |
200 inBackground:(BOOL)inBackground; | 201 inBackground:(BOOL)inBackground; |
201 | 202 |
202 // Inserts a new tab at the given |index| with the session history specified by | 203 // Inserts a new Tab at the given |index| restoring the session history from |
203 // |webState|. Does not go through the order controller as this is generally | 204 // the provided |navigationItems| and updates the current tab if |inBackground| |
204 // used only for restoring a previous session and the index is fixed. | 205 // is NO. |
205 - (Tab*)insertTabWithWebState:(std::unique_ptr<web::WebState>)webState | 206 - (Tab*)insertTabWithNavigationItems: |
206 atIndex:(NSUInteger)index; | 207 (web::ScopedNavigationItemList)navigationItems |
| 208 selectedNavigationIndex:(int)selectedNavigationIndex |
| 209 atIndex:(NSUInteger)index |
| 210 inBackground:(BOOL)inBackground; |
207 | 211 |
208 // Inserts |tab| at the given |index|. Broadcasts the proper notifications about | 212 // Inserts |tab| at the given |index|. Broadcasts the proper notifications about |
209 // the change. The receiver should be set as the parentTabModel for |tab|; this | 213 // the change. The receiver should be set as the parentTabModel for |tab|; this |
210 // method doesn't check that. | 214 // method doesn't check that. |
211 - (void)insertTab:(Tab*)tab atIndex:(NSUInteger)index; | 215 - (void)insertTab:(Tab*)tab atIndex:(NSUInteger)index; |
212 | 216 |
213 // Moves |tab| to the given |index|. |index| must be valid for this tab model | 217 // Moves |tab| to the given |index|. |index| must be valid for this tab model |
214 // (must be less than the current number of tabs). |tab| must already be in this | 218 // (must be less than the current number of tabs). |tab| must already be in this |
215 // tab model. If |tab| is already at |index|, this method does nothing and will | 219 // tab model. If |tab| is already at |index|, this method does nothing and will |
216 // not notify observers. | 220 // not notify observers. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Called by the Tab to inform its parent that it has been closed. | 280 // Called by the Tab to inform its parent that it has been closed. |
277 - (void)didCloseTab:(Tab*)closedTab; | 281 - (void)didCloseTab:(Tab*)closedTab; |
278 // Called by |tab| to inform the model that a navigation has taken place. | 282 // Called by |tab| to inform the model that a navigation has taken place. |
279 // TODO(crbug.com/661983): once more of the navigation state has moved into WC, | 283 // TODO(crbug.com/661983): once more of the navigation state has moved into WC, |
280 // replace this with WebStateObserver. | 284 // replace this with WebStateObserver. |
281 - (void)navigationCommittedInTab:(Tab*)tab; | 285 - (void)navigationCommittedInTab:(Tab*)tab; |
282 | 286 |
283 @end | 287 @end |
284 | 288 |
285 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ | 289 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ |
OLD | NEW |