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

Side by Side Diff: ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm

Issue 2723453003: [ios] Improve toolbar in tab_grid (Closed)
Patch Set: Unsafe retained assign fix Created 3 years, 9 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
(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],
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698