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 identity available on the device. | |
22 SigninPromoViewModeColdState, | |
23 // At least one identity is available on the device and the user can sign | |
24 // without entering theircredentials. | |
msarda
2017/03/28 12:49:17
s/theircredentials/their credentials
jlebel
2017/03/28 13:00:42
Done.
| |
25 SigninPromoViewModeWarmState, | |
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 chomium icon in the image view, and only | |
31 // displays the primary button. | |
32 // + "Warm State" mode displays the image view (big than the cold state mode), | |
33 // displays both buttons. | |
34 // | |
35 // For the warm state, the owner is in charge to set: | |
msarda
2017/03/28 12:49:16
s/is in charge to set/ should set
jlebel
2017/03/28 13:00:42
Done.
| |
36 // - the image for |imageView|, using -[SigninPromoView setProfileImage:] | |
37 // - the label for |textLabel| | |
38 // - the title for |primaryButton| | |
39 // - the title for |secondaryButton| | |
40 @interface SigninPromoView : UIView | |
41 | |
42 @property(nonatomic) SigninPromoViewMode mode; | |
43 @property(nonatomic, readonly) UIImageView* imageView; | |
44 @property(nonatomic, readonly) UILabel* textLabel; | |
45 @property(nonatomic, readonly) MDCFlatButton* primaryButton; | |
46 @property(nonatomic, readonly) MDCFlatButton* secondaryButton; | |
47 | |
48 // Horizontal padding used for |textLabel|, |primaryButton| and | |
49 // |secondaryButton|. Used to compute the preferred max layout width of | |
50 // |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 | |
msarda
2017/03/28 12:49:17
This comment needs to be fixed as the implementati
jlebel
2017/03/28 13:00:42
Done.
| |
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 |