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 @property(nonatomic, readonly) BOOL coldStart; | |
msarda
2017/03/16 22:15:31
Avoid using bool and prefer using the enum SigninP
jlebel
2017/03/21 17:22:28
Done.
| |
17 | |
18 - (void)configureSigninPromoView:(SigninPromoView*)signinPromoView; | |
19 | |
20 @end | |
21 | |
22 typedef NS_ENUM(NSInteger, SigninPromoViewMode) { | |
23 // No profile is known. | |
24 SigninPromoViewColdStartMode, | |
msarda
2017/03/16 22:15:31
I think we should drop this enum entirely and pass
jlebel
2017/03/21 17:22:29
The view should not know anything related to the p
msarda
2017/03/22 12:18:38
For completeness sake: ChromeIdentity and ChromeId
| |
25 // At least one profile is known and the user can sign without entering their | |
26 // password. | |
27 SigninPromoViewWarmStartMode, | |
msarda
2017/03/16 22:15:31
I would not name this |coldStart| or |warmStart| a
jlebel
2017/03/21 17:22:29
I'm not sure what could be a better name. Do you p
| |
28 }; | |
29 | |
30 // This class creates an image view, a label and 2 buttons. This view can be | |
31 // configured with 2 modes : "Cold Start" and "Warm Start". | |
32 // + "Cold Start" mode displays the chrome/chomium icon in the image view, and | |
33 // only displays the primary button. | |
34 // + "Warm Start" mode displays the image view (big than the cold start mode), | |
35 // displays both buttons. | |
36 // | |
37 // The owner is in charge to set: | |
38 // - the image for |imageView|, using -[SigninPromoView setProfileImage:] | |
39 // (only for "Warm Start") | |
40 // - the label for |textLabel| | |
41 // - the title for |primaryButton| | |
42 // - the title for |secondaryButton| | |
43 @interface SigninPromoView : UIView | |
44 | |
45 @property(nonatomic) SigninPromoViewMode mode; | |
46 @property(nonatomic, readonly) UIImageView* imageView; | |
47 @property(nonatomic, readonly) UILabel* textLabel; | |
48 @property(nonatomic, readonly) MDCFlatButton* primaryButton; | |
49 @property(nonatomic, readonly) MDCFlatButton* secondaryButton; | |
msarda
2017/03/16 22:15:31
Nit: Blank line to ease code review in the code re
jlebel
2017/03/21 17:22:28
Done.
| |
50 // Horizontal padding used for |textLabel|, |primaryButton| and | |
51 // |secondaryButton|. Available to be able to compute | |
msarda
2017/03/16 22:15:31
Nit: s/Available to be able to compute.../Used to
jlebel
2017/03/21 17:22:28
Done.
| |
52 // |_signinPromoView.textLabel.preferredMaxLayoutWidth| | |
53 @property(nonatomic, readonly) CGFloat horizontalPadding; | |
54 | |
55 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; | |
56 | |
57 // Changes the image in |imageView| with a circular image. Should be called | |
58 // only with the "Warm Start" mode. The image is not changed when "Cold Start" | |
59 // mode. | |
60 - (void)setProfileImage:(UIImage*)image; | |
61 | |
62 @end | |
63 | |
64 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ | |
OLD | NEW |