 Chromium Code Reviews
 Chromium Code Reviews Issue 2723453003:
  [ios] Improve toolbar in tab_grid  (Closed)
    
  
    Issue 2723453003:
  [ios] Improve toolbar in tab_grid  (Closed) 
  | Index: ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm | 
| diff --git a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..8f583b4a2250204f12ba610555a88961efd7487a | 
| --- /dev/null | 
| +++ b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm | 
| @@ -0,0 +1,57 @@ | 
| +// Copyright 2017 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" | 
| + | 
| +#import "ios/clean/chrome/browser/ui/tab_grid/ui_stack_view+cr_tab_grid.h" | 
| + | 
| +#if !defined(__has_feature) || !__has_feature(objc_arc) | 
| +#error "This file requires ARC support." | 
| +#endif | 
| + | 
| +namespace { | 
| +const CGFloat kToolbarHeight = 44.0f; | 
| +} | 
| + | 
| +@implementation TabGridToolbar | 
| + | 
| +- (instancetype)init { | 
| + if (self = [super init]) { | 
| + UIVisualEffect* blurEffect = | 
| + [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; | 
| + UIVisualEffectView* toolbarView = | 
| + [[UIVisualEffectView alloc] initWithEffect:blurEffect]; | 
| + toolbarView.autoresizingMask = | 
| + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | 
| + [self addSubview:toolbarView]; | 
| + | 
| + UIStackView* toolbarContent = [UIStackView cr_tabGridToolbarStackView]; | 
| + [toolbarView.contentView addSubview:toolbarContent]; | 
| + | 
| + // Sets the stackview to a fixed height, anchored to the bottom of the | 
| + // blur view. | 
| + toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; | 
| + [NSLayoutConstraint activateConstraints:@[ | 
| + [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
 | 
| + [toolbarContent.leadingAnchor | 
| + constraintEqualToAnchor:toolbarView.contentView.leadingAnchor], | 
| + [toolbarContent.trailingAnchor | 
| + constraintEqualToAnchor:toolbarView.contentView.trailingAnchor], | 
| + [toolbarContent.bottomAnchor | 
| + constraintEqualToAnchor:toolbarView.contentView.bottomAnchor] | 
| + ]]; | 
| + } | 
| + return self; | 
| +} | 
| + | 
| +#pragma mark - UIView | 
| + | 
| +// Returns an intrinsic height so that explicit height constraints are | 
| +// not necessary. Status bar conditional logic can be set using this | 
| +// intrinsic size. | 
| +- (CGSize)intrinsicContentSize { | 
| + return CGSizeMake(UIViewNoIntrinsicMetric, kToolbarHeight); | 
| +} | 
| + | 
| +@end |