Chromium Code Reviews| 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..f2d6fdfc2f00e0c92f88698de497a0de9d77753f |
| --- /dev/null |
| +++ b/ios/chrome/browser/ui/authentication/signin_promo_view.h |
| @@ -0,0 +1,63 @@ |
| +// 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 profile is known. |
| + SigninPromoViewModeColdState, |
| + // At least one profile is known and the user can sign without entering their |
| + // password. |
|
msarda
2017/03/28 08:12:51
The user will need to enter more than his/her pass
jlebel
2017/03/28 12:27:21
Done.
|
| + 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. |
| +// |
| +// The owner is in charge to set: |
|
msarda
2017/03/28 08:12:51
This comment is now only available for the warm st
jlebel
2017/03/28 12:27:21
Done.
|
| +// - the image for |imageView|, using -[SigninPromoView setProfileImage:] |
| +// (only for "Warm State") |
|
msarda
2017/03/28 08:12:51
Remove "(only for "Warm State")"
jlebel
2017/03/28 12:27:21
Done.
|
| +// - 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 of |textLabel|. |
|
msarda
2017/03/28 08:12:51
Is this the max "layout" or "width"?
lpromero
2017/03/28 09:43:15
Both: the preferred max layout width :)
jlebel
2017/03/28 12:27:21
Done.
|
| +@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). Should be called only with the "Warm State" mode. The image |
| +// is not changed when "Cold State" mode. |
| +- (void)setProfileImage:(UIImage*)image; |
| + |
| +@end |
| + |
| +#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ |