Chromium Code Reviews| 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/chrome/browser/tabs/web_state_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 // on the position where the tab will be open. | 75 // on the position where the tab will be open. |
| 75 NSUInteger const kTabPositionAutomatically = NSNotFound; | 76 NSUInteger const kTabPositionAutomatically = NSNotFound; |
| 76 | 77 |
| 77 } // namespace TabModelConstants | 78 } // namespace TabModelConstants |
| 78 | 79 |
| 79 // A model of a tab "strip". Although the UI representation may not be a | 80 // A model of a tab "strip". Although the UI representation may not be a |
| 80 // traditional strip at all, tabs are still accessed via an integral index. | 81 // traditional strip at all, tabs are still accessed via an integral index. |
| 81 // The model knows about the currently selected tab in order to maintain | 82 // The model knows about the currently selected tab in order to maintain |
| 82 // consistency between multiple views that need the current tab to be | 83 // consistency between multiple views that need the current tab to be |
| 83 // synchronized. | 84 // synchronized. |
| 84 @interface TabModel : NSObject<NSFastEnumeration> | 85 @interface TabModel : WebStateList |
|
marq (ping after 24h)
2017/01/19 13:37:46
WebStateList<Tab*> ?
sdefresne
2017/01/20 14:42:09
Done.
| |
| 85 | 86 |
| 86 // Currently active tab. | 87 // Currently active tab. |
| 87 @property(nonatomic, weak) Tab* currentTab; | 88 @property(nonatomic, weak) Tab* currentTab; |
| 88 | 89 |
| 89 // The delegate for sync. | 90 // The delegate for sync. |
| 90 @property(nonatomic, readonly) | 91 @property(nonatomic, readonly) |
| 91 TabModelSyncedWindowDelegate* syncedWindowDelegate; | 92 TabModelSyncedWindowDelegate* syncedWindowDelegate; |
| 92 | 93 |
| 93 // BrowserState associated with this TabModel. | 94 // BrowserState associated with this TabModel. |
| 94 @property(nonatomic, readonly) ios::ChromeBrowserState* browserState; | 95 @property(nonatomic, readonly) ios::ChromeBrowserState* browserState; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 105 // Defaults to NO. | 106 // Defaults to NO. |
| 106 // Note that generally this should be set via BVC, not directly. | 107 // Note that generally this should be set via BVC, not directly. |
| 107 @property(nonatomic, assign) BOOL webUsageEnabled; | 108 @property(nonatomic, assign) BOOL webUsageEnabled; |
| 108 | 109 |
| 109 // YES if this tab set is off the record. | 110 // YES if this tab set is off the record. |
| 110 @property(nonatomic, readonly, getter=isOffTheRecord) BOOL offTheRecord; | 111 @property(nonatomic, readonly, getter=isOffTheRecord) BOOL offTheRecord; |
| 111 | 112 |
| 112 // NO if the model has at least one tab. | 113 // NO if the model has at least one tab. |
| 113 @property(nonatomic, readonly, getter=isEmpty) BOOL empty; | 114 @property(nonatomic, readonly, getter=isEmpty) BOOL empty; |
| 114 | 115 |
| 115 // Determines the number of tabs in the model. | |
| 116 @property(nonatomic, readonly) NSUInteger count; | |
| 117 | |
| 118 // Initializes tabs from a restored session. |-setCurrentTab| needs to be called | 116 // Initializes tabs from a restored session. |-setCurrentTab| needs to be called |
| 119 // in order to display the views associated with the tabs. Waits until the views | 117 // in order to display the views associated with the tabs. Waits until the views |
| 120 // are ready. |browserState| cannot be nil. |service| cannot be nil; this class | 118 // are ready. |browserState| cannot be nil. |service| cannot be nil; this class |
| 121 // creates intermediate SessionWindowIOS objects which must be consumed by a | 119 // creates intermediate SessionWindowIOS objects which must be consumed by a |
| 122 // session service before they are deallocated. |window| can be nil to create | 120 // session service before they are deallocated. |window| can be nil to create |
| 123 // an empty TabModel. In that case no notification will be sent during object | 121 // an empty TabModel. In that case no notification will be sent during object |
| 124 // creation. | 122 // creation. |
| 125 - (instancetype)initWithSessionWindow:(SessionWindowIOS*)window | 123 - (instancetype)initWithSessionWindow:(SessionWindowIOS*)window |
| 126 sessionService:(SessionServiceIOS*)service | 124 sessionService:(SessionServiceIOS*)service |
| 127 browserState:(ios::ChromeBrowserState*)browserState | 125 browserState:(ios::ChromeBrowserState*)browserState |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 // TYPED. | 307 // TYPED. |
| 310 - (Tab*)insertTabWithURL:(const GURL&)URL | 308 - (Tab*)insertTabWithURL:(const GURL&)URL |
| 311 referrer:(const web::Referrer&)referrer | 309 referrer:(const web::Referrer&)referrer |
| 312 windowName:(NSString*)windowName | 310 windowName:(NSString*)windowName |
| 313 opener:(Tab*)parentTab | 311 opener:(Tab*)parentTab |
| 314 atIndex:(NSUInteger)index; | 312 atIndex:(NSUInteger)index; |
| 315 | 313 |
| 316 @end | 314 @end |
| 317 | 315 |
| 318 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ | 316 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ |
| OLD | NEW |