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

Unified Diff: ios/chrome/browser/ui/ntp/new_tab_page_header_view.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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm b/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
index a9a519412da9c7a5afbea8479ae889211ed5c3c9..46590152472ef374e572197757653b01f1809938 100644
--- a/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
+++ b/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
@@ -25,8 +25,9 @@
} // namespace
-@interface NewTabPageHeaderView () {
+@interface NewTabPageHeaderView ()<TabModelObserver> {
base::scoped_nsobject<NewTabPageToolbarController> _toolbarController;
+ base::scoped_nsobject<TabModel> _tabModel;
base::scoped_nsobject<UIImageView> _searchBoxBorder;
base::scoped_nsobject<UIImageView> _shadow;
}
@@ -44,6 +45,7 @@
}
- (void)dealloc {
+ [_tabModel removeObserver:self];
[super dealloc];
}
@@ -72,6 +74,9 @@
initWithToolbarDelegate:[dataSource toolbarDelegate]
focuser:dataSource]);
_toolbarController.get().readingListModel = [dataSource readingListModel];
+ [_tabModel removeObserver:self];
+ _tabModel.reset([[dataSource tabModel] retain]);
+ [self addTabModelObserver];
UIView* toolbarView = [_toolbarController view];
CGRect toolbarFrame = self.bounds;
@@ -88,8 +93,9 @@
[_toolbarController hideViewsForNewTabPage:YES];
};
-- (void)setToolbarTabCount:(int)tabCount {
- [_toolbarController setTabCount:tabCount];
+- (void)addTabModelObserver {
+ [_tabModel addObserver:self];
+ [_toolbarController setTabCount:[_tabModel count]];
}
- (void)addViewsToSearchField:(UIView*)searchField {
@@ -114,6 +120,11 @@
UIViewAutoresizingFlexibleTopMargin];
[searchField addSubview:_shadow];
[_shadow setAlpha:0];
+}
+
+- (void)tabModelDidChangeTabCount:(TabModel*)model {
+ DCHECK(model == _tabModel);
+ [_toolbarController setTabCount:[_tabModel count]];
}
- (void)updateSearchField:(UIView*)searchField
« no previous file with comments | « ios/chrome/browser/ui/ntp/new_tab_page_header_view.h ('k') | ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698