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

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

Issue 2833513002: Replace TabModel with WebStateList in GoogleLandingController. (Closed)
Patch Set: 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 @implementation GoogleLandingController 225 @implementation GoogleLandingController
226 226
227 @dynamic view; 227 @dynamic view;
228 @synthesize logoVendor = _logoVendor; 228 @synthesize logoVendor = _logoVendor;
229 @synthesize dataSource = _dataSource; 229 @synthesize dataSource = _dataSource;
230 // Property declared in NewTabPagePanelProtocol. 230 // Property declared in NewTabPagePanelProtocol.
231 @synthesize delegate = _delegate; 231 @synthesize delegate = _delegate;
232 @synthesize showLogo = _showLogo; 232 @synthesize showLogo = _showLogo;
233 @synthesize offTheRecord = _offTheRecord; 233 @synthesize offTheRecord = _offTheRecord;
234 @synthesize tabCount = _tabCount;
234 @synthesize voiceSearchEnabled = _voiceSearchEnabled; 235 @synthesize voiceSearchEnabled = _voiceSearchEnabled;
235 236
236 - (void)loadView { 237 - (void)loadView {
237 self.view = [[[GoogleLandingView alloc] 238 self.view = [[[GoogleLandingView alloc]
238 initWithFrame:[UIScreen mainScreen].bounds] autorelease]; 239 initWithFrame:[UIScreen mainScreen].bounds] autorelease];
239 } 240 }
240 241
241 - (void)viewDidLoad { 242 - (void)viewDidLoad {
242 [super viewDidLoad]; 243 [super viewDidLoad];
243 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight | 244 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 withReuseIdentifier:@"header" 961 withReuseIdentifier:@"header"
961 forIndexPath:indexPath] retain]); 962 forIndexPath:indexPath] retain]);
962 [_headerView addSubview:[self.logoVendor view]]; 963 [_headerView addSubview:[self.logoVendor view]];
963 [_headerView addSubview:_searchTapTarget]; 964 [_headerView addSubview:_searchTapTarget];
964 [_headerView addViewsToSearchField:_searchTapTarget]; 965 [_headerView addViewsToSearchField:_searchTapTarget];
965 966
966 if (!IsIPadIdiom()) { 967 if (!IsIPadIdiom()) {
967 // iPhone header also contains a toolbar since the normal toolbar is 968 // iPhone header also contains a toolbar since the normal toolbar is
968 // hidden. 969 // hidden.
969 [_headerView addToolbarWithDataSource:self.dataSource]; 970 [_headerView addToolbarWithDataSource:self.dataSource];
971 [_headerView setToolbarTabCount:self.tabCount];
970 } 972 }
971 [_supplementaryViews addObject:_headerView]; 973 [_supplementaryViews addObject:_headerView];
972 } 974 }
973 return _headerView; 975 return _headerView;
974 } 976 }
975 977
976 if (indexPath.section == SectionWithMostVisited) { 978 if (indexPath.section == SectionWithMostVisited) {
977 if (!_promoHeaderView) { 979 if (!_promoHeaderView) {
978 _promoHeaderView.reset([[collectionView 980 _promoHeaderView.reset([[collectionView
979 dequeueReusableSupplementaryViewOfKind: 981 dequeueReusableSupplementaryViewOfKind:
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1451
1450 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index { 1452 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index {
1451 if (index > [self numberOfItems]) 1453 if (index > [self numberOfItems])
1452 return; 1454 return;
1453 1455
1454 NSIndexPath* indexPath = 1456 NSIndexPath* indexPath =
1455 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited]; 1457 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited];
1456 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]]; 1458 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]];
1457 } 1459 }
1458 1460
1461 - (void)setTabCount:(int)tabCount {
1462 _tabCount = tabCount;
rohitrao (ping after 24h) 2017/04/19 19:26:33 Why do we need to cache this in an ivar? Does hea
justincohen 2017/04/19 21:12:23 headerView is created later.
1463 [_headerView setToolbarTabCount:self.tabCount];
1464 }
1465
1459 @end 1466 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698