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

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

Issue 2592983003: [Clean Skeleton] Migrate code to clean/ (Closed)
Patch Set: Rebased Created 3 years, 11 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 2016 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 // ====== New Architecture =====
6 // = This code is only used in the new iOS Chrome architecture. =
7 // ============================================================================
8
9 #import "ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 namespace {
16 const CGFloat kCornerRadius = 4.0;
17 const CGFloat kSelectedBorderWidth = 2.0;
18 }
19
20 @implementation TabGridTabCell
21
22 @synthesize label = _label;
23
24 - (instancetype)initWithFrame:(CGRect)frame {
25 if ((self = [super initWithFrame:frame])) {
26 self.contentView.layer.cornerRadius = kCornerRadius;
27 self.selectedBackgroundView.layer.cornerRadius = kCornerRadius;
28 self.selectedBackgroundView.layer.borderWidth = kSelectedBorderWidth;
29 self.selectedBackgroundView.layer.borderColor = [UIColor blueColor].CGColor;
30 self.selectedBackgroundView.transform = CGAffineTransformScale(
31 self.selectedBackgroundView.transform, 1.05, 1.05);
32
33 _label = [[UILabel alloc] initWithFrame:CGRectZero];
34 _label.translatesAutoresizingMaskIntoConstraints = NO;
35 _label.numberOfLines = 1;
36 _label.textAlignment = NSTextAlignmentCenter;
37 [self.contentView addSubview:_label];
38 [NSLayoutConstraint activateConstraints:@[
39 [_label.centerYAnchor
40 constraintEqualToAnchor:self.contentView.centerYAnchor],
41 [_label.leadingAnchor
42 constraintEqualToAnchor:self.contentView.layoutMarginsGuide
43 .leadingAnchor],
44 [_label.trailingAnchor
45 constraintEqualToAnchor:self.contentView.layoutMarginsGuide
46 .trailingAnchor],
47 ]];
48 }
49 return self;
50 }
51
52 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h ('k') | ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698