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

Unified Diff: ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm

Issue 2588733002: Upstream Chrome on iOS source code [9/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8f6a34f48835bea98d6e6fb5499755862500be91
--- /dev/null
+++ b/ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm
@@ -0,0 +1,52 @@
+// Copyright 2016 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.
+
+// ====== New Architecture =====
+// = This code is only used in the new iOS Chrome architecture. =
+// ============================================================================
+
+#import "ios/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+const CGFloat kCornerRadius = 4.0;
+const CGFloat kSelectedBorderWidth = 2.0;
+}
+
+@implementation TabGridTabCell
+
+@synthesize label = _label;
+
+- (instancetype)initWithFrame:(CGRect)frame {
+ if ((self = [super initWithFrame:frame])) {
+ self.contentView.layer.cornerRadius = kCornerRadius;
+ self.selectedBackgroundView.layer.cornerRadius = kCornerRadius;
+ self.selectedBackgroundView.layer.borderWidth = kSelectedBorderWidth;
+ self.selectedBackgroundView.layer.borderColor = [UIColor blueColor].CGColor;
+ self.selectedBackgroundView.transform = CGAffineTransformScale(
+ self.selectedBackgroundView.transform, 1.05, 1.05);
+
+ _label = [[UILabel alloc] initWithFrame:CGRectZero];
+ _label.translatesAutoresizingMaskIntoConstraints = NO;
+ _label.numberOfLines = 1;
+ _label.textAlignment = NSTextAlignmentCenter;
+ [self.contentView addSubview:_label];
+ [NSLayoutConstraint activateConstraints:@[
+ [_label.centerYAnchor
+ constraintEqualToAnchor:self.contentView.centerYAnchor],
+ [_label.leadingAnchor
+ constraintEqualToAnchor:self.contentView.layoutMarginsGuide
+ .leadingAnchor],
+ [_label.trailingAnchor
+ constraintEqualToAnchor:self.contentView.layoutMarginsGuide
+ .trailingAnchor],
+ ]];
+ }
+ return self;
+}
+
+@end
« 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