Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" | |
| 6 | |
| 7 #import "ios/clean/chrome/browser/ui/tab_grid/ui_stack_view+cr_tab_grid.h" | |
| 8 | |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 10 #error "This file requires ARC support." | |
| 11 #endif | |
| 12 | |
| 13 namespace { | |
| 14 const CGFloat kToolbarHeight = 44.0f; | |
| 15 } | |
| 16 | |
| 17 @implementation TabGridToolbar | |
| 18 | |
| 19 - (instancetype)init { | |
| 20 if (self = [super init]) { | |
| 21 UIVisualEffect* blurEffect = | |
| 22 [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; | |
| 23 UIVisualEffectView* toolbarView = | |
| 24 [[UIVisualEffectView alloc] initWithEffect:blurEffect]; | |
| 25 toolbarView.autoresizingMask = | |
| 26 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | |
| 27 [self addSubview:toolbarView]; | |
| 28 | |
| 29 UIStackView* toolbarContent = [UIStackView cr_tabGridToolbarStackView]; | |
| 30 [toolbarView.contentView addSubview:toolbarContent]; | |
| 31 | |
| 32 // Sets the stackview to a fixed height, anchored to the bottom of the | |
| 33 // blur view. | |
| 34 toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; | |
| 35 [NSLayoutConstraint activateConstraints:@[ | |
| 36 [toolbarContent.heightAnchor constraintEqualToConstant:kToolbarHeight], | |
|
marq (ping after 24h)
2017/03/02 06:04:54
Is this constraint necessary, or can we just have
edchin
2017/03/02 07:12:44
The VC which uses TabGridToolbar wants to visually
| |
| 37 [toolbarContent.leadingAnchor | |
| 38 constraintEqualToAnchor:toolbarView.contentView.leadingAnchor], | |
| 39 [toolbarContent.trailingAnchor | |
| 40 constraintEqualToAnchor:toolbarView.contentView.trailingAnchor], | |
| 41 [toolbarContent.bottomAnchor | |
| 42 constraintEqualToAnchor:toolbarView.contentView.bottomAnchor] | |
| 43 ]]; | |
| 44 } | |
| 45 return self; | |
| 46 } | |
| 47 | |
| 48 #pragma mark - UIView | |
| 49 | |
| 50 // Returns an intrinsic height so that explicit height constraints are | |
| 51 // not necessary. Status bar conditional logic can be set using this | |
| 52 // intrinsic size. | |
| 53 - (CGSize)intrinsicContentSize { | |
| 54 return CGSizeMake(UIViewNoIntrinsicMetric, kToolbarHeight); | |
| 55 } | |
| 56 | |
| 57 @end | |
| OLD | NEW |