OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // ====== New Architecture ===== | 5 // ====== New Architecture ===== |
6 // = This code is only used in the new iOS Chrome architecture. = | 6 // = This code is only used in the new iOS Chrome architecture. = |
7 // ============================================================================ | 7 // ============================================================================ |
8 | 8 |
9 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ | 9 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ |
10 #define IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ | 10 #define IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ |
11 | 11 |
12 #import <UIKit/UIKit.h> | 12 #import <UIKit/UIKit.h> |
13 | 13 |
14 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_delegate.h" | 14 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_delegate.h" |
15 | 15 |
| 16 const int kTabGridDataSourceInvalidIndex = -1; |
| 17 |
16 @protocol SettingsCommands; | 18 @protocol SettingsCommands; |
17 @protocol TabCommands; | 19 @protocol TabCommands; |
18 @protocol TabGridCommands; | 20 @protocol TabGridCommands; |
19 | 21 |
20 // The data source for tab grid UI. | 22 // The data source for tab grid UI. |
21 // Conceptually the tab grid represents a group of WebState objects (which | 23 // Conceptually the tab grid represents a group of WebState objects (which |
22 // are ultimately the model-layer representation of a browser tab). The data | 24 // are ultimately the model-layer representation of a browser tab). The data |
23 // source must be able to map between indices and WebStates. | 25 // source must be able to map between indices and WebStates. |
24 @protocol TabGridDataSource<NSObject> | 26 @protocol TabGridDataSource<NSObject> |
25 | 27 |
26 // The number of tabs to be displayed in the grid. | 28 // The number of tabs to be displayed in the grid. |
27 - (NSUInteger)numberOfTabsInTabGrid; | 29 - (int)numberOfTabsInTabGrid; |
28 | 30 |
29 // Title for the tab at |index| in the grid. | 31 // Title for the tab at |index| in the grid. |
30 - (NSString*)titleAtIndex:(NSInteger)index; | 32 - (NSString*)titleAtIndex:(int)index; |
31 | 33 |
32 // Index for the active tab. | 34 // Index for the active tab or kTabGridDataSourceInvalidIndex if there is no |
33 - (NSInteger)indexOfActiveTab; | 35 // active tab. |
| 36 - (int)indexOfActiveTab; |
34 | 37 |
35 @end | 38 @end |
36 | 39 |
37 // Controller for a scrolling view displaying square cells that represent | 40 // Controller for a scrolling view displaying square cells that represent |
38 // the user's open tabs. | 41 // the user's open tabs. |
39 @interface TabGridViewController : UIViewController<ZoomTransitionDelegate> | 42 @interface TabGridViewController : UIViewController<ZoomTransitionDelegate> |
40 | 43 |
41 // Data source for the tabs to be displayed. | 44 // Data source for the tabs to be displayed. |
42 @property(nonatomic, weak) id<TabGridDataSource> dataSource; | 45 @property(nonatomic, weak) id<TabGridDataSource> dataSource; |
43 // Command handlers. | 46 // Command handlers. |
44 @property(nonatomic, weak) id<SettingsCommands> settingsCommandHandler; | 47 @property(nonatomic, weak) id<SettingsCommands> settingsCommandHandler; |
45 @property(nonatomic, weak) id<TabCommands> tabCommandHandler; | 48 @property(nonatomic, weak) id<TabCommands> tabCommandHandler; |
46 @property(nonatomic, weak) id<TabGridCommands> tabGridCommandHandler; | 49 @property(nonatomic, weak) id<TabGridCommands> tabGridCommandHandler; |
47 @end | 50 @end |
48 | 51 |
49 #endif // IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ | 52 #endif // IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_VIEW_CONTROLLER_H_ |
OLD | NEW |