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..c9366ce8c4ebc8e76ef4f5c14bdc0328f00b9d21 |
| --- /dev/null |
| +++ b/ios/chrome/browser/ui/authentication/signin_promo_view.h |
| @@ -0,0 +1,64 @@ |
| +// 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> |
| + |
| +@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.
|
| + |
| +- (void)configureSigninPromoView:(SigninPromoView*)signinPromoView; |
| + |
| +@end |
| + |
| +typedef NS_ENUM(NSInteger, SigninPromoViewMode) { |
| + // No profile is known. |
| + 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
|
| + // At least one profile is known and the user can sign without entering their |
| + // password. |
| + 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
|
| +}; |
| + |
| +// 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 |
| +// 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:] |
| +// (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; |
|
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.
|
| +// Horizontal padding used for |textLabel|, |primaryButton| and |
| +// |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.
|
| +// |_signinPromoView.textLabel.preferredMaxLayoutWidth| |
| +@property(nonatomic, readonly) CGFloat horizontalPadding; |
| + |
| +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| + |
| +// Changes the image in |imageView| with a circular image. Should be called |
| +// only with the "Warm Start" mode. The image is not changed when "Cold Start" |
| +// mode. |
| +- (void)setProfileImage:(UIImage*)image; |
| + |
| +@end |
| + |
| +#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGN_PROMO_VIEW_H_ |