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

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

Issue 2829003002: Add CommandDispatcher to BrowserViewController. (Closed)
Patch Set: Cleaner 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/new_tab_page_header_view.h" 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_header_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #import "ios/chrome/browser/tabs/tab_model.h" 9 #import "ios/chrome/browser/tabs/tab_model.h"
10 #import "ios/chrome/browser/tabs/tab_model_observer.h" 10 #import "ios/chrome/browser/tabs/tab_model_observer.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Only relinquish the toolbar controller if it's in the hierarchy. 57 // Only relinquish the toolbar controller if it's in the hierarchy.
58 relinquishedToolbarController = _toolbarController.get(); 58 relinquishedToolbarController = _toolbarController.get();
59 } 59 }
60 return relinquishedToolbarController; 60 return relinquishedToolbarController;
61 } 61 }
62 62
63 - (void)reparentToolbarController { 63 - (void)reparentToolbarController {
64 [self addSubview:[_toolbarController view]]; 64 [self addSubview:[_toolbarController view]];
65 } 65 }
66 66
67 - (void)addToolbarWithDataSource:(id<GoogleLandingDataSource>)dataSource { 67 - (void)addToolbarWithDataSource:(id<GoogleLandingDataSource>)dataSource
68 dispatcher:(id)dispatcher {
68 DCHECK(!_toolbarController); 69 DCHECK(!_toolbarController);
69 DCHECK(dataSource); 70 DCHECK(dataSource);
70 71
71 _toolbarController.reset([[NewTabPageToolbarController alloc] 72 _toolbarController.reset(
72 initWithToolbarDataSource:dataSource]); 73 [[NewTabPageToolbarController alloc] initWithToolbar]);
74 [_toolbarController setDispatcher:dispatcher];
73 _toolbarController.get().readingListModel = [dataSource readingListModel]; 75 _toolbarController.get().readingListModel = [dataSource readingListModel];
74 76
75 UIView* toolbarView = [_toolbarController view]; 77 UIView* toolbarView = [_toolbarController view];
76 CGRect toolbarFrame = self.bounds; 78 CGRect toolbarFrame = self.bounds;
77 toolbarFrame.size.height = ntp_header::kToolbarHeight; 79 toolbarFrame.size.height = ntp_header::kToolbarHeight;
78 toolbarView.frame = toolbarFrame; 80 toolbarView.frame = toolbarFrame;
79 [toolbarView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 81 [toolbarView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
80 [self hideToolbarViewsForNewTabPage]; 82 [self hideToolbarViewsForNewTabPage];
81 83
82 [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 84 [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 159 }
158 160
159 - (void)fadeOutShadow { 161 - (void)fadeOutShadow {
160 [UIView animateWithDuration:ios::material::kDuration1 162 [UIView animateWithDuration:ios::material::kDuration1
161 animations:^{ 163 animations:^{
162 [_shadow setAlpha:0]; 164 [_shadow setAlpha:0];
163 }]; 165 }];
164 } 166 }
165 167
166 @end 168 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698