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..837dc6201bab74052df0a9dc7c06304179995167 |
--- /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_ |
lpromero
2017/03/24 10:36:20
Since this view has quite some logic, can you add
jlebel
2017/03/24 20:59:08
Done.
|
+ |
+#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. |
+ SigninPromoViewColdStartMode, |
+ // At least one profile is known and the user can sign without entering their |
+ // password. |
+ SigninPromoViewWarmStartMode, |
msarda
2017/03/22 12:18:38
I think the only difference between warm and cold
jlebel
2017/03/24 20:59:08
Since I would like to keep the chrome icon inside
|
+}; |
+ |
+// This class creates an image view, a label and 2 buttons. This view can be |
+// configured with 2 modes : "Cold Start" and "Warm Start". |
+// + "Cold Start" mode displays the chrome/chomium icon in the image view, and |
msarda
2017/03/22 12:18:39
I think the imageView should be configured by the
jlebel
2017/03/24 20:59:08
As Louis mention it, it is nicer to keep it in the
|
+// only displays the primary button. |
+// + "Warm Start" mode displays the image view (big than the cold start mode), |
+// displays both buttons. |
+// |
+// The owner is in charge to set: |
+// - the image for |imageView|, using -[SigninPromoView setProfileImage:] |
msarda
2017/03/22 12:18:38
I think the mediator should always set the image t
jlebel
2017/03/24 20:59:08
Acknowledged.
|
+// (only for "Warm Start") |
+// - 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 the text |
+// label. |
msarda
2017/03/22 12:18:38
s/of the text label./of |textLabel|
jlebel
2017/03/24 20:59:08
Done.
|
+@property(nonatomic, readonly) CGFloat horizontalPadding; |
+ |
+- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
+ |
+// Changes the image in |imageView| with a circular image. Should be called |
lpromero
2017/03/24 10:36:19
Can you be more explicit with the "circular"? The
jlebel
2017/03/24 20:59:08
Done.
|
+// only with the "Warm Start" mode. The image is not changed when "Cold Start" |
+// mode. |
+- (void)setProfileImage:(UIImage*)image; |
msarda
2017/03/22 12:18:39
I think the owner should always set the image (not
lpromero
2017/03/24 10:36:20
The Chrome logo can stay inside this class, to me.
jlebel
2017/03/24 20:59:08
Yes, I have the asset with all colors. I will add
|
+ |
+@end |
+ |
+#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ |