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

Unified Diff: ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm

Issue 2844253003: Adding close button in SigninPromoView (Closed)
Patch Set: Changing dismiss to close, and moving the button to the cell Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm
index 14bbbf0deb0817dd97185432e8df641d57a86198..e3163814b52bbe1e64fb5ff70928f7bdec88d0a6 100644
--- a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm
+++ b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm
@@ -13,11 +13,18 @@
#error "This file requires ARC support."
#endif
+namespace {
+// Close button size.
+const CGFloat kCloseButtonSize = 24;
+}
+
@implementation BookmarkSigninPromoCell {
SigninPromoView* _signinPromoView;
+ UIButton* _closeButton;
}
@synthesize signinPromoView = _signinPromoView;
+@synthesize closeButtonAction = _closeButtonAction;
+ (NSString*)reuseIdentifier {
return @"BookmarkSigninPromoCell";
@@ -35,6 +42,21 @@
_signinPromoView.translatesAutoresizingMaskIntoConstraints = NO;
[contentView addSubview:_signinPromoView];
AddSameConstraints(_signinPromoView, contentView);
+
+ _closeButton = [[UIButton alloc]
+ initWithFrame:CGRectMake(0, 0, kCloseButtonSize, kCloseButtonSize)];
+ [_closeButton addTarget:self
+ action:@selector(closeButtonAction:)
+ forControlEvents:UIControlEventTouchUpInside];
+ _closeButton.translatesAutoresizingMaskIntoConstraints = NO;
+ [contentView addSubview:_closeButton];
+ [_closeButton setImage:[UIImage imageNamed:@"signin_promo_close_gray"]
+ forState:UIControlStateNormal];
+ NSArray* buttonVisualConstraints =
+ @[ @"H:[closeButton]-|", @"V:|-[closeButton]" ];
+ NSDictionary* views = @{ @"closeButton" : _closeButton };
+ ApplyVisualConstraints(buttonVisualConstraints, views);
+
_signinPromoView.backgroundColor = [UIColor whiteColor];
_signinPromoView.textLabel.text =
l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS);
@@ -54,4 +76,14 @@
[super layoutSubviews];
}
+- (void)prepareForReuse {
+ _closeButtonAction = nil;
+}
+
+- (void)closeButtonAction:(id)sender {
+ if (_closeButtonAction) {
+ _closeButtonAction();
msarda 2017/05/04 11:48:08 I think it would be better to set the closeButtonA
jlebel 2017/05/04 13:20:38 I don't believe it is relevant. This should be don
+ }
+}
+
@end
« no previous file with comments | « ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698