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

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

Issue 2649403002: Revert of WebStateList is an array of web::WebState* wrappers. (Closed)
Patch Set: Fix conflicts with other CLs. Created 3 years, 11 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.h ('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
11 #include <memory> 11 #include <memory>
12 12
13 #import "ios/chrome/browser/tabs/tab.h"
14 #import "ios/shared/chrome/browser/tabs/web_state_list.h"
15 #import "ios/web/public/navigation_manager.h" 13 #import "ios/web/public/navigation_manager.h"
16 #include "ui/base/page_transition_types.h" 14 #include "ui/base/page_transition_types.h"
17 15
18 class GURL; 16 class GURL;
19 class SessionID; 17 class SessionID;
20 @class SessionServiceIOS; 18 @class SessionServiceIOS;
21 @class SessionWindowIOS; 19 @class SessionWindowIOS;
20 @class Tab;
22 @protocol TabModelObserver; 21 @protocol TabModelObserver;
23 class TabModelSyncedWindowDelegate; 22 class TabModelSyncedWindowDelegate;
24 class TabUsageRecorder; 23 class TabUsageRecorder;
25 24
26 namespace ios { 25 namespace ios {
27 class ChromeBrowserState; 26 class ChromeBrowserState;
28 } 27 }
29 28
30 namespace web { 29 namespace web {
31 struct Referrer; 30 struct Referrer;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // on the position where the tab will be open. 74 // on the position where the tab will be open.
76 NSUInteger const kTabPositionAutomatically = NSNotFound; 75 NSUInteger const kTabPositionAutomatically = NSNotFound;
77 76
78 } // namespace TabModelConstants 77 } // namespace TabModelConstants
79 78
80 // A model of a tab "strip". Although the UI representation may not be a 79 // A model of a tab "strip". Although the UI representation may not be a
81 // traditional strip at all, tabs are still accessed via an integral index. 80 // traditional strip at all, tabs are still accessed via an integral index.
82 // The model knows about the currently selected tab in order to maintain 81 // The model knows about the currently selected tab in order to maintain
83 // consistency between multiple views that need the current tab to be 82 // consistency between multiple views that need the current tab to be
84 // synchronized. 83 // synchronized.
85 @interface TabModel : WebStateList<Tab*> 84 @interface TabModel : NSObject<NSFastEnumeration>
86 85
87 // Currently active tab. 86 // Currently active tab.
88 @property(nonatomic, weak) Tab* currentTab; 87 @property(nonatomic, weak) Tab* currentTab;
89 88
90 // The delegate for sync. 89 // The delegate for sync.
91 @property(nonatomic, readonly) 90 @property(nonatomic, readonly)
92 TabModelSyncedWindowDelegate* syncedWindowDelegate; 91 TabModelSyncedWindowDelegate* syncedWindowDelegate;
93 92
94 // BrowserState associated with this TabModel. 93 // BrowserState associated with this TabModel.
95 @property(nonatomic, readonly) ios::ChromeBrowserState* browserState; 94 @property(nonatomic, readonly) ios::ChromeBrowserState* browserState;
(...skipping 10 matching lines...) Expand all
106 // Defaults to NO. 105 // Defaults to NO.
107 // Note that generally this should be set via BVC, not directly. 106 // Note that generally this should be set via BVC, not directly.
108 @property(nonatomic, assign) BOOL webUsageEnabled; 107 @property(nonatomic, assign) BOOL webUsageEnabled;
109 108
110 // YES if this tab set is off the record. 109 // YES if this tab set is off the record.
111 @property(nonatomic, readonly, getter=isOffTheRecord) BOOL offTheRecord; 110 @property(nonatomic, readonly, getter=isOffTheRecord) BOOL offTheRecord;
112 111
113 // NO if the model has at least one tab. 112 // NO if the model has at least one tab.
114 @property(nonatomic, readonly, getter=isEmpty) BOOL empty; 113 @property(nonatomic, readonly, getter=isEmpty) BOOL empty;
115 114
115 // Determines the number of tabs in the model.
116 @property(nonatomic, readonly) NSUInteger count;
117
116 // Initializes tabs from a restored session. |-setCurrentTab| needs to be called 118 // Initializes tabs from a restored session. |-setCurrentTab| needs to be called
117 // in order to display the views associated with the tabs. Waits until the views 119 // in order to display the views associated with the tabs. Waits until the views
118 // are ready. |browserState| cannot be nil. |service| cannot be nil; this class 120 // are ready. |browserState| cannot be nil. |service| cannot be nil; this class
119 // creates intermediate SessionWindowIOS objects which must be consumed by a 121 // creates intermediate SessionWindowIOS objects which must be consumed by a
120 // session service before they are deallocated. |window| can be nil to create 122 // session service before they are deallocated. |window| can be nil to create
121 // an empty TabModel. In that case no notification will be sent during object 123 // an empty TabModel. In that case no notification will be sent during object
122 // creation. 124 // creation.
123 - (instancetype)initWithSessionWindow:(SessionWindowIOS*)window 125 - (instancetype)initWithSessionWindow:(SessionWindowIOS*)window
124 sessionService:(SessionServiceIOS*)service 126 sessionService:(SessionServiceIOS*)service
125 browserState:(ios::ChromeBrowserState*)browserState 127 browserState:(ios::ChromeBrowserState*)browserState
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // TYPED. 309 // TYPED.
308 - (Tab*)insertTabWithURL:(const GURL&)URL 310 - (Tab*)insertTabWithURL:(const GURL&)URL
309 referrer:(const web::Referrer&)referrer 311 referrer:(const web::Referrer&)referrer
310 windowName:(NSString*)windowName 312 windowName:(NSString*)windowName
311 opener:(Tab*)parentTab 313 opener:(Tab*)parentTab
312 atIndex:(NSUInteger)index; 314 atIndex:(NSUInteger)index;
313 315
314 @end 316 @end
315 317
316 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_ 318 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_model.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698