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

Unified Diff: ios/chrome/browser/ui/authentication/signin_promo_view.h

Issue 2749703003: Adding mediator for Sign-in promo (Closed)
Patch Set: Update tests Created 3 years, 9 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
Index: ios/chrome/browser/ui/authentication/signin_promo_view.h
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view.h b/ios/chrome/browser/ui/authentication/signin_promo_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..a645205b3933cf647f3555d49726c383e5bfb4de
--- /dev/null
+++ b/ios/chrome/browser/ui/authentication/signin_promo_view.h
@@ -0,0 +1,62 @@
+// Copyright 2017 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.
+
+#ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_
+#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_
+
+#import <UIKit/UIKit.h>
+
+@class MDCFlatButton;
+@class SigninPromoView;
+
+// Configures a SigninPromoView view.
+@protocol SigninPromoViewConfigurator<NSObject>
+
+- (void)configureSigninPromoView:(SigninPromoView*)signinPromoView;
+
+@end
+
+typedef NS_ENUM(NSInteger, SigninPromoViewMode) {
+ // No identity available on the device.
+ SigninPromoViewModeColdState,
+ // At least one identity is available on the device and the user can sign
+ // without entering their credentials.
+ SigninPromoViewModeWarmState,
+};
+
+// This class creates an image view, a label and 2 buttons. This view can be
+// configured with 2 modes : "Cold State" and "Warm State".
+// + "Cold State" mode displays the chomium icon in the image view, and only
+// displays the primary button.
+// + "Warm State" mode displays the image view (big than the cold state mode),
+// displays both buttons.
+//
+// For the warm state, the owner should set:
+// - the image for |imageView|, using -[SigninPromoView setProfileImage:]
+// - the label for |textLabel|
+// - the title for |primaryButton|
+// - the title for |secondaryButton|
+@interface SigninPromoView : UIView
+
+@property(nonatomic) SigninPromoViewMode mode;
+@property(nonatomic, readonly) UIImageView* imageView;
+@property(nonatomic, readonly) UILabel* textLabel;
+@property(nonatomic, readonly) MDCFlatButton* primaryButton;
+@property(nonatomic, readonly) MDCFlatButton* secondaryButton;
+
+// Horizontal padding used for |textLabel|, |primaryButton| and
+// |secondaryButton|. Used to compute the preferred max layout width of
+// |textLabel|.
+@property(nonatomic, readonly) CGFloat horizontalPadding;
+
+- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
+
+// Sets the image in |imageView|. This method will add a circular background
+// using CircularImageFromImage() (so if the image is not squared, it will be
+// cropped first). Must only be called in the "Warm State" mode.
+- (void)setProfileImage:(UIImage*)image;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698