| OLD | NEW |
| 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 Loading... |
| 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([[NewTabPageToolbarController alloc] init]); |
| 72 initWithToolbarDataSource:dataSource]); | 73 [_toolbarController setDispatcher:dispatcher]; |
| 73 _toolbarController.get().readingListModel = [dataSource readingListModel]; | 74 _toolbarController.get().readingListModel = [dataSource readingListModel]; |
| 74 | 75 |
| 75 UIView* toolbarView = [_toolbarController view]; | 76 UIView* toolbarView = [_toolbarController view]; |
| 76 CGRect toolbarFrame = self.bounds; | 77 CGRect toolbarFrame = self.bounds; |
| 77 toolbarFrame.size.height = ntp_header::kToolbarHeight; | 78 toolbarFrame.size.height = ntp_header::kToolbarHeight; |
| 78 toolbarView.frame = toolbarFrame; | 79 toolbarView.frame = toolbarFrame; |
| 79 [toolbarView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 80 [toolbarView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
| 80 | 81 |
| 81 [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 82 [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
| 82 [self addSubview:[_toolbarController view]]; | 83 [self addSubview:[_toolbarController view]]; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 | 168 |
| 168 - (void)fadeOutShadow { | 169 - (void)fadeOutShadow { |
| 169 [UIView animateWithDuration:ios::material::kDuration1 | 170 [UIView animateWithDuration:ios::material::kDuration1 |
| 170 animations:^{ | 171 animations:^{ |
| 171 [_shadow setAlpha:0]; | 172 [_shadow setAlpha:0]; |
| 172 }]; | 173 }]; |
| 173 } | 174 } |
| 174 | 175 |
| 175 @end | 176 @end |
| OLD | NEW |