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

Unified Diff: ios/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.mm

Issue 2589803002: Upstream Chrome on iOS source code [6/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/ntp/recent_tabs/views/spacers_view.mm
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.mm b/ios/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7b9878425c02695c805b1097ffc2b3527f80d080
--- /dev/null
+++ b/ios/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.mm
@@ -0,0 +1,81 @@
+// Copyright 2014 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/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.h"
+
+#include "base/logging.h"
+#import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h"
+#include "ios/chrome/browser/ui/ui_util.h"
+#import "ios/chrome/browser/ui/uikit_ui_util.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+
+// Desired height of the view.
+const CGFloat kHeaderDesiredHeightIPhone = 8;
+const CGFloat kHeaderDesiredHeightIPad = 48;
+const CGFloat kFooterDesiredHeight = 17;
+
+// Text color.
+const int kSeparatorColor = 0x5a5a5a;
+const CGFloat kSeparatorAlpha = 0.1;
+
+} // namespace
+
+@implementation RecentlyTabsTopSpacingHeader
+
++ (CGFloat)desiredHeightInUITableViewCell {
+ if (IsIPadIdiom()) {
+ return kHeaderDesiredHeightIPad;
+ } else {
+ return kHeaderDesiredHeightIPhone;
+ }
+}
+
+@end
+
+@implementation RecentlyClosedSectionFooter
+
+- (instancetype)initWithFrame:(CGRect)aRect {
+ self = [super initWithFrame:CGRectZero];
+ if (self) {
+ // Create and add separator.
+ UIView* separator = [[UIView alloc] init];
+ [separator setTranslatesAutoresizingMaskIntoConstraints:NO];
+ UIColor* separatorColor = UIColorFromRGB(kSeparatorColor, kSeparatorAlpha);
+ [separator setBackgroundColor:separatorColor];
+ [self addSubview:separator];
+
+ // Set constraints on separator.
+ NSDictionary* viewsDictionary = @{ @"separator" : separator };
+ // This set of constraints should match the constraints set on the
+ // RecentTabsTableViewController.
+ // clang-format off
+ NSArray* constraints = @[
+ @"V:|-(8)-[separator(==1)]",
+ @"H:|-(16)-[separator(<=516)]-(16)-|",
+ @"H:[separator(==516@500)]"
+ ];
+ // clang-format on
+ [self addConstraint:[NSLayoutConstraint
+ constraintWithItem:separator
+ attribute:NSLayoutAttributeCenterX
+ relatedBy:NSLayoutRelationEqual
+ toItem:self
+ attribute:NSLayoutAttributeCenterX
+ multiplier:1
+ constant:0]];
+ ApplyVisualConstraints(constraints, viewsDictionary, self);
+ }
+ return self;
+}
+
++ (CGFloat)desiredHeightInUITableViewCell {
+ return kFooterDesiredHeight;
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/ui/ntp/recent_tabs/views/spacers_view.h ('k') | ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698