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

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

Issue 2835033002: Revert of 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 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
196 // iPhone landscape uses a slightly different layout for the doodle and search 193 // iPhone landscape uses a slightly different layout for the doodle and search
197 // field frame. Returns the proper frame from |frames| based on orientation, 194 // field frame. Returns the proper frame from |frames| based on orientation,
198 // centered in the view. 195 // centered in the view.
199 - (CGRect)getOrientationFrame:(const CGRect[])frames; 196 - (CGRect)getOrientationFrame:(const CGRect[])frames;
200 // Returns the proper frame for the doodle. 197 // Returns the proper frame for the doodle.
201 - (CGRect)doodleFrame; 198 - (CGRect)doodleFrame;
202 // Returns the proper frame for the search field. 199 // Returns the proper frame for the search field.
203 - (CGRect)searchFieldFrame; 200 - (CGRect)searchFieldFrame;
204 // Returns the height to use for the What's New promo view. 201 // Returns the height to use for the What's New promo view.
205 - (CGFloat)promoHeaderHeight; 202 - (CGFloat)promoHeaderHeight;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 @synthesize logoVendor = _logoVendor; 252 @synthesize logoVendor = _logoVendor;
256 @synthesize dataSource = _dataSource; 253 @synthesize dataSource = _dataSource;
257 // Property declared in NewTabPagePanelProtocol. 254 // Property declared in NewTabPagePanelProtocol.
258 @synthesize delegate = _delegate; 255 @synthesize delegate = _delegate;
259 @synthesize isOffTheRecord = _isOffTheRecord; 256 @synthesize isOffTheRecord = _isOffTheRecord;
260 @synthesize logoIsShowing = _logoIsShowing; 257 @synthesize logoIsShowing = _logoIsShowing;
261 @synthesize promoText = _promoText; 258 @synthesize promoText = _promoText;
262 @synthesize promoIcon = _promoIcon; 259 @synthesize promoIcon = _promoIcon;
263 @synthesize promoCanShow = _promoCanShow; 260 @synthesize promoCanShow = _promoCanShow;
264 @synthesize maximumMostVisitedSitesShown = _maximumMostVisitedSitesShown; 261 @synthesize maximumMostVisitedSitesShown = _maximumMostVisitedSitesShown;
265 @synthesize tabCount = _tabCount;
266 @synthesize voiceSearchIsEnabled = _voiceSearchIsEnabled; 262 @synthesize voiceSearchIsEnabled = _voiceSearchIsEnabled;
267 263
268 - (void)loadView { 264 - (void)loadView {
269 self.view = [[[GoogleLandingView alloc] 265 self.view = [[[GoogleLandingView alloc]
270 initWithFrame:[UIScreen mainScreen].bounds] autorelease]; 266 initWithFrame:[UIScreen mainScreen].bounds] autorelease];
271 } 267 }
272 268
273 - (void)viewDidLoad { 269 - (void)viewDidLoad {
274 [super viewDidLoad]; 270 [super viewDidLoad];
275 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight | 271 [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 withReuseIdentifier:@"header" 988 withReuseIdentifier:@"header"
993 forIndexPath:indexPath] retain]); 989 forIndexPath:indexPath] retain]);
994 [_headerView addSubview:[self.logoVendor view]]; 990 [_headerView addSubview:[self.logoVendor view]];
995 [_headerView addSubview:_searchTapTarget]; 991 [_headerView addSubview:_searchTapTarget];
996 [_headerView addViewsToSearchField:_searchTapTarget]; 992 [_headerView addViewsToSearchField:_searchTapTarget];
997 993
998 if (!IsIPadIdiom()) { 994 if (!IsIPadIdiom()) {
999 // iPhone header also contains a toolbar since the normal toolbar is 995 // iPhone header also contains a toolbar since the normal toolbar is
1000 // hidden. 996 // hidden.
1001 [_headerView addToolbarWithDataSource:self.dataSource]; 997 [_headerView addToolbarWithDataSource:self.dataSource];
1002 [_headerView setToolbarTabCount:self.tabCount];
1003 } 998 }
1004 [_supplementaryViews addObject:_headerView]; 999 [_supplementaryViews addObject:_headerView];
1005 } 1000 }
1006 return _headerView; 1001 return _headerView;
1007 } 1002 }
1008 1003
1009 if (indexPath.section == SectionWithMostVisited) { 1004 if (indexPath.section == SectionWithMostVisited) {
1010 if (!_promoHeaderView) { 1005 if (!_promoHeaderView) {
1011 _promoHeaderView.reset([[collectionView 1006 _promoHeaderView.reset([[collectionView
1012 dequeueReusableSupplementaryViewOfKind: 1007 dequeueReusableSupplementaryViewOfKind:
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 1477
1483 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index { 1478 - (void)mostVisitedIconMadeAvailableAtIndex:(NSUInteger)index {
1484 if (index > [self numberOfItems]) 1479 if (index > [self numberOfItems])
1485 return; 1480 return;
1486 1481
1487 NSIndexPath* indexPath = 1482 NSIndexPath* indexPath =
1488 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited]; 1483 [NSIndexPath indexPathForRow:index inSection:SectionWithMostVisited];
1489 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]]; 1484 [_mostVisitedView reloadItemsAtIndexPaths:@[ indexPath ]];
1490 } 1485 }
1491 1486
1492 - (void)setTabCount:(int)tabCount {
1493 _tabCount = tabCount;
1494 [_headerView setToolbarTabCount:self.tabCount];
1495 }
1496
1497 @end 1487 @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