| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ | 6 #define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" | 10 #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" |
| 11 #import "ios/chrome/browser/ui/authentication/signin_promo_view_delegate.h" | 11 #import "ios/chrome/browser/ui/authentication/signin_promo_view_delegate.h" |
| 12 | 12 |
| 13 @class ChromeIdentity; | 13 @class ChromeIdentity; |
| 14 @class SigninPromoViewConfigurator; | 14 @class SigninPromoViewConfigurator; |
| 15 @protocol SigninPromoViewConsumer; | 15 @protocol SigninPromoViewConsumer; |
| 16 | 16 |
| 17 namespace ios { |
| 18 class ChromeBrowserState; |
| 19 } // namespace ios |
| 20 |
| 17 // Class that monitors the available identities and creates | 21 // Class that monitors the available identities and creates |
| 18 // SigninPromoViewConfigurator. This class makes the link between the model and | 22 // SigninPromoViewConfigurator. This class makes the link between the model and |
| 19 // the view. The consumer will receive notification if default identity is | 23 // the view. The consumer will receive notification if default identity is |
| 20 // changed or updated. | 24 // changed or updated. |
| 21 @interface SigninPromoViewMediator : NSObject<SigninPromoViewDelegate> | 25 @interface SigninPromoViewMediator : NSObject<SigninPromoViewDelegate> |
| 22 | 26 |
| 23 // Consumer to handle identity update notifications. | 27 // Consumer to handle identity update notifications. |
| 24 @property(nonatomic, weak) id<SigninPromoViewConsumer> consumer; | 28 @property(nonatomic, weak) id<SigninPromoViewConsumer> consumer; |
| 25 | 29 |
| 26 // Chrome identity used to configure the view in a warm state mode. Otherwise | 30 // Chrome identity used to configure the view in a warm state mode. Otherwise |
| 27 // contains nil. | 31 // contains nil. |
| 28 @property(nonatomic, readonly, strong) ChromeIdentity* defaultIdentity; | 32 @property(nonatomic, readonly, strong) ChromeIdentity* defaultIdentity; |
| 29 | 33 |
| 30 // Access point used to send user action metrics. | 34 // Access point used to send user action metrics. |
| 31 @property(nonatomic) signin_metrics::AccessPoint accessPoint; | 35 @property(nonatomic) signin_metrics::AccessPoint accessPoint; |
| 32 | 36 |
| 37 // Preference key to count how many time the sign-in promo view is seen. The |
| 38 // value should point to static storage. |
| 39 @property(nonatomic) const char* displayedCountPreferenceKey; |
| 40 // Preference key, set to true when the sign-in promo view is seen too much. The |
| 41 // value should point to static storage. |
| 42 @property(nonatomic) const char* alreadySeenSigninViewPreferenceKey; |
| 43 // Histogram name to count how many times the signin promo is implicitly |
| 44 // dismissed per impression. The value should point to static storage. |
| 45 @property(nonatomic) const char* dismissalCountHistogramName; |
| 46 // Histogram name to count how many times one of the "sign in" buttons is |
| 47 // clicked per impression. The value should point to static storage. |
| 48 @property(nonatomic) const char* countTilSigninHistogramName; |
| 49 // Histogram name to counts how many times the explicit "X"-to-close button is |
| 50 // clicked per impression. The value should point to static storage. |
| 51 @property(nonatomic) const char* countTilXHistogramName; |
| 52 |
| 53 // See -[SigninPromoViewMediator initWithBrowserState:]. |
| 54 - (instancetype)init NS_UNAVAILABLE; |
| 55 |
| 56 // Initialises with browser state. |
| 57 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 58 NS_DESIGNATED_INITIALIZER; |
| 59 |
| 33 - (SigninPromoViewConfigurator*)createConfigurator; | 60 - (SigninPromoViewConfigurator*)createConfigurator; |
| 34 | 61 |
| 62 // Increments the "shown" counter used for histograms. Called when the signin |
| 63 // promo view is visible |
| 64 - (void)signinPromoViewVisible; |
| 65 |
| 66 // Called when the sign-in promo view is hidden. |
| 67 - (void)signinPromoViewHidden; |
| 68 |
| 69 // Called when the sign-in promo view is dismissed. |
| 70 - (void)signinPromoViewDismissed; |
| 71 |
| 35 @end | 72 @end |
| 36 | 73 |
| 37 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ | 74 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ |
| OLD | NEW |