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

Side by Side Diff: ios/chrome/browser/ui/ntp/google_landing_controller.mm

Issue 2833513002: Replace TabModel with WebStateList in GoogleLandingController. (Closed)
Patch Set: Fix gn Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" 5 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Gets the text of a what's new promo. 183 // Gets the text of a what's new promo.
184 @property(nonatomic, retain) NSString* promoText; 184 @property(nonatomic, retain) NSString* promoText;
185 185
186 // Gets the icon of a what's new promo. 186 // Gets the icon of a what's new promo.
187 // TODO(crbug.com/694750): This should not be WhatsNewIcon. 187 // TODO(crbug.com/694750): This should not be WhatsNewIcon.
188 @property(nonatomic, assign) WhatsNewIcon promoIcon; 188 @property(nonatomic, assign) WhatsNewIcon promoIcon;
189 189
190 // |YES| if a what's new promo can be displayed. 190 // |YES| if a what's new promo can be displayed.
191 @property(nonatomic, assign) BOOL promoCanShow; 191 @property(nonatomic, assign) BOOL promoCanShow;
192 192
193 // The number of tabs to show in the google landing fake toolbar.
194 @property(nonatomic, assign) int tabCount;
195
193 // iPhone landscape uses a slightly different layout for the doodle and search 196 // iPhone landscape uses a slightly different layout for the doodle and search
194 // field frame. Returns the proper frame from |frames| based on orientation, 197 // field frame. Returns the proper frame from |frames| based on orientation,
195 // centered in the view. 198 // centered in the view.
196 - (CGRect)getOrientationFrame:(const CGRect[])frames; 199 - (CGRect)getOrientationFrame:(const CGRect[])frames;
197 // Returns the proper frame for the doodle. 200 // Returns the proper frame for the doodle.
198 - (CGRect)doodleFrame; 201 - (CGRect)doodleFrame;
199 // Returns the proper frame for the search field. 202 // Returns the proper frame for the search field.
200 - (CGRect)searchFieldFrame; 203 - (CGRect)searchFieldFrame;
201 // Returns the height to use for the What's New promo view. 204 // Returns the height to use for the What's New promo view.
202 - (CGFloat)promoHeaderHeight; 205 - (CGFloat)promoHeaderHeight;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 @synthesize logoVendor = _logoVendor; 255 @synthesize logoVendor = _logoVendor;
253 @synthesize dataSource = _dataSource; 256 @synthesize dataSource = _dataSource;
254 // Property declared in NewTabPagePanelProtocol. 257 // Property declared in NewTabPagePanelProtocol.
255 @synthesize delegate = _delegate; 258 @synthesize delegate = _delegate;
256 @synthesize isOffTheRecord = _isOffTheRecord; 259 @synthesize isOffTheRecord = _isOffTheRecord;
257 @synthesize logoIsShowing = _logoIsShowing; 260 @synthesize logoIsShowing = _logoIsShowing;
258 @synthesize promoText = _promoText; 261 @synthesize promoText = _promoText;
259 @synthesize promoIcon = _promoIcon; 262 @synthesize promoIcon = _promoIcon;
260 @synthesize promoCanShow = _promoCanShow; 263 @synthesize promoCanShow = _promoCanShow;
261 @synthesize maximumMostVisitedSitesShown = _maximumMostVisitedSitesShown; 264 @synthesize maximumMostVisitedSitesShown = _maximumMostVisitedSitesShown;
265 @synthesize tabCount = _tabCount;
262 @synthesize voiceSearchIsEnabled = _voiceSearchIsEnabled; 266 @synthesize voiceSearchIsEnabled = _voiceSearchIsEnabled;
263 267
264 - (void)loadView { 268 - (void)loadView {
265 self.view = [[[GoogleLandingView alloc] 269 self.view = [[[GoogleLandingView alloc]
266 initWithFrame:[UIScreen mainScreen].bounds] autorelease]; 270 initWithFrame:[UIScreen mainScreen].bounds] autorelease];
267 } 271 }
268 272
269 - (void)viewDidLoad { 273 - (void)viewDidLoad {
270 [super viewDidLoad]; 274 [super viewDidLoad];
271 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight | 275 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 withReuseIdentifier:@"header" 992 withReuseIdentifier:@"header"
989 forIndexPath:indexPath] retain]); 993 forIndexPath:indexPath] retain]);
990 [_headerView addSubview:[self.logoVendor view]]; 994 [_headerView addSubview:[self.logoVendor view]];
991 [_headerView addSubview:_searchTapTarget]; 995 [_headerView addSubview:_searchTapTarget];
992 [_headerView addViewsToSearchField:_searchTapTarget]; 996 [_headerView addViewsToSearchField:_searchTapTarget];
993 997
994 if (!IsIPadIdiom()) { 998 if (!IsIPadIdiom()) {
995 // iPhone header also contains a toolbar since the normal toolbar is 999 // iPhone header also contains a toolbar since the normal toolbar is
996 // hidden. 1000 // hidden.
997 [_headerView addToolbarWithDataSource:self.dataSource]; 1001 [_headerView addToolbarWithDataSource:self.dataSource];
1002 [_headerView setToolbarTabCount:self.tabCount];
998 } 1003 }
999 [_supplementaryViews addObject:_headerView]; 1004 [_supplementaryViews addObject:_headerView];
1000 } 1005 }
1001 return _headerView; 1006 return _headerView;
1002 } 1007 }
1003 1008
1004 if (indexPath.section == SectionWithMostVisited) { 1009 if (indexPath.section == SectionWithMostVisited) {
1005 if (!_promoHeaderView) { 1010 if (!_promoHeaderView) {
1006 _promoHeaderView.reset([[collectionView 1011 _promoHeaderView.reset([[collectionView
1007 dequeueReusableSupplementaryViewOfKind: 1012 dequeueReusableSupplementaryViewOfKind:
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 1482
1478 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index { 1483 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index {
1479 if (index > [self numberOfItems]) 1484 if (index > [self numberOfItems])
1480 return; 1485 return;
1481 1486
1482 NSIndexPath* indexPath = 1487 NSIndexPath* indexPath =
1483 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited]; 1488 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited];
1484 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]]; 1489 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]];
1485 } 1490 }
1486 1491
1492 - (void)setTabCount:(int)tabCount {
1493 _tabCount = tabCount;
1494 [_headerView setToolbarTabCount:self.tabCount];
1495 }
1496
1487 @end 1497 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ntp/google_landing_consumer.h ('k') | ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698