Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ | |
| 6 #define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ | |
| 7 | |
| 8 #import <UIKit/UIKit.h> | |
| 9 | |
| 10 @class MDCFlatButton; | |
| 11 @class SigninPromoView; | |
| 12 | |
| 13 // Configures a SigninPromoView view. | |
| 14 @protocol SigninPromoViewConfigurator<NSObject> | |
| 15 | |
| 16 - (void)configureSigninPromoView:(SigninPromoView*)signinPromoView; | |
| 17 | |
| 18 @end | |
| 19 | |
| 20 typedef NS_ENUM(NSInteger, SigninPromoViewMode) { | |
| 21 // No profile is known. | |
| 22 SigninPromoViewColdStateMode, | |
|
msarda
2017/03/27 09:34:16
I think this should be SigninPromoViewModeColdStat
jlebel
2017/03/27 21:34:42
Done.
| |
| 23 // At least one profile is known and the user can sign without entering their | |
| 24 // password. | |
| 25 SigninPromoViewWarmStateMode, | |
| 26 }; | |
| 27 | |
| 28 // This class creates an image view, a label and 2 buttons. This view can be | |
| 29 // configured with 2 modes : "Cold State" and "Warm State". | |
| 30 // + "Cold State" mode displays the chrome/chomium icon in the image view, and | |
|
lpromero
2017/03/27 13:14:46
chromium
jlebel
2017/03/27 21:34:42
Done.
| |
| 31 // only displays the primary button. | |
| 32 // + "Warm State" mode displays the image view (big than the cold state mode), | |
| 33 // displays both buttons. | |
| 34 // | |
| 35 // The owner is in charge to set: | |
| 36 // - the image for |imageView|, using -[SigninPromoView setProfileImage:] | |
| 37 // (only for "Warm State") | |
| 38 // - the label for |textLabel| | |
| 39 // - the title for |primaryButton| | |
| 40 // - the title for |secondaryButton| | |
| 41 @interface SigninPromoView : UIView | |
| 42 | |
| 43 @property(nonatomic) SigninPromoViewMode mode; | |
| 44 @property(nonatomic, readonly) UIImageView* imageView; | |
| 45 @property(nonatomic, readonly) UILabel* textLabel; | |
| 46 @property(nonatomic, readonly) MDCFlatButton* primaryButton; | |
| 47 @property(nonatomic, readonly) MDCFlatButton* secondaryButton; | |
| 48 | |
| 49 // Horizontal padding used for |textLabel|, |primaryButton| and | |
| 50 // |secondaryButton|. Used to compute the preferred max layout of |textLabel|. | |
| 51 @property(nonatomic, readonly) CGFloat horizontalPadding; | |
| 52 | |
| 53 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; | |
| 54 | |
| 55 // Sets the image in |imageView|. This method will add a circular background | |
| 56 // using CircularImageFromImage() (so if the image is not squared, it will be | |
| 57 // cropped first). Should be called only with the "Warm State" mode. The image | |
| 58 // is not changed when "Cold State" mode. | |
| 59 - (void)setProfileImage:(UIImage*)image; | |
| 60 | |
| 61 @end | |
| 62 | |
| 63 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ | |
| OLD | NEW |