Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h" | 5 #import "ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" | 7 #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" |
| 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 9 #include "ios/chrome/grit/ios_chromium_strings.h" | 9 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 + (BOOL)requiresConstraintBasedLayout { | 26 + (BOOL)requiresConstraintBasedLayout { |
| 27 return YES; | 27 return YES; |
| 28 } | 28 } |
| 29 | 29 |
| 30 - (instancetype)initWithFrame:(CGRect)frame { | 30 - (instancetype)initWithFrame:(CGRect)frame { |
| 31 self = [super initWithFrame:frame]; | 31 self = [super initWithFrame:frame]; |
| 32 if (self) { | 32 if (self) { |
| 33 UIView* contentView = self.contentView; | 33 UIView* contentView = self.contentView; |
| 34 _signinPromoView = [[SigninPromoView alloc] initWithFrame:self.bounds]; | 34 _signinPromoView = [[SigninPromoView alloc] initWithFrame:self.bounds]; |
| 35 _signinPromoView.translatesAutoresizingMaskIntoConstraints = NO; | 35 _signinPromoView.translatesAutoresizingMaskIntoConstraints = NO; |
| 36 _signinPromoView.dismissButton.hidden = NO; | |
|
msarda
2017/04/28 16:08:16
It looks like the button is only used by the Bookm
lpromero
2017/05/02 16:46:04
Good idea.
jlebel
2017/05/03 12:41:14
I would hope for the user, we will use the same ki
| |
| 36 [contentView addSubview:_signinPromoView]; | 37 [contentView addSubview:_signinPromoView]; |
| 37 AddSameConstraints(_signinPromoView, contentView); | 38 AddSameConstraints(_signinPromoView, contentView); |
| 38 _signinPromoView.backgroundColor = [UIColor whiteColor]; | 39 _signinPromoView.backgroundColor = [UIColor whiteColor]; |
| 39 _signinPromoView.textLabel.text = | 40 _signinPromoView.textLabel.text = |
| 40 l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS); | 41 l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS); |
| 41 } | 42 } |
| 42 return self; | 43 return self; |
| 43 } | 44 } |
| 44 | 45 |
| 45 - (void)layoutSubviews { | 46 - (void)layoutSubviews { |
| 46 // Adjust the text label preferredMaxLayoutWidth according self.frame.width, | 47 // Adjust the text label preferredMaxLayoutWidth according self.frame.width, |
| 47 // so the text will adjust its height and not its width. | 48 // so the text will adjust its height and not its width. |
| 48 CGFloat parentWidth = CGRectGetWidth(self.bounds); | 49 CGFloat parentWidth = CGRectGetWidth(self.bounds); |
| 49 _signinPromoView.textLabel.preferredMaxLayoutWidth = | 50 _signinPromoView.textLabel.preferredMaxLayoutWidth = |
| 50 parentWidth - 2 * _signinPromoView.horizontalPadding; | 51 parentWidth - 2 * _signinPromoView.horizontalPadding; |
| 51 | 52 |
| 52 // Re-layout with the new preferred width to allow the label to adjust its | 53 // Re-layout with the new preferred width to allow the label to adjust its |
| 53 // height. | 54 // height. |
| 54 [super layoutSubviews]; | 55 [super layoutSubviews]; |
| 55 } | 56 } |
| 56 | 57 |
| 57 @end | 58 @end |
| OLD | NEW |