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 |
| 20 // Enums to choose which histograms is used to record the user actions. |
| 21 enum class SigninPromoViewHistograms { |
| 22 // No histograms. |
| 23 None, |
| 24 // Histograms: MobileSignInPromo.BookmarkManager.*. |
| 25 Bookmarks, |
| 26 }; |
| 27 } // namespace ios |
| 28 |
17 // Class that monitors the available identities and creates | 29 // Class that monitors the available identities and creates |
18 // SigninPromoViewConfigurator. This class makes the link between the model and | 30 // SigninPromoViewConfigurator. This class makes the link between the model and |
19 // the view. The consumer will receive notification if default identity is | 31 // the view. The consumer will receive notification if default identity is |
20 // changed or updated. | 32 // changed or updated. |
21 @interface SigninPromoViewMediator : NSObject<SigninPromoViewDelegate> | 33 @interface SigninPromoViewMediator : NSObject<SigninPromoViewDelegate> |
22 | 34 |
23 // Consumer to handle identity update notifications. | 35 // Consumer to handle identity update notifications. |
24 @property(nonatomic, weak) id<SigninPromoViewConsumer> consumer; | 36 @property(nonatomic, weak) id<SigninPromoViewConsumer> consumer; |
25 | 37 |
26 // Chrome identity used to configure the view in a warm state mode. Otherwise | 38 // Chrome identity used to configure the view in a warm state mode. Otherwise |
27 // contains nil. | 39 // contains nil. |
28 @property(nonatomic, readonly, strong) ChromeIdentity* defaultIdentity; | 40 @property(nonatomic, readonly, strong) ChromeIdentity* defaultIdentity; |
29 | 41 |
30 // Access point used to send user action metrics. | 42 // Access point used to send user action metrics. |
31 @property(nonatomic) signin_metrics::AccessPoint accessPoint; | 43 @property(nonatomic) signin_metrics::AccessPoint accessPoint; |
32 | 44 |
| 45 // Preference key to count how many time the sign-in promo view is seen. The |
| 46 // value should point to static storage. |
| 47 @property(nonatomic) const char* displayedCountPreferenceKey; |
| 48 // Preference key, set to true when the sign-in promo view is seen too much. The |
| 49 // value should point to static storage. |
| 50 @property(nonatomic) const char* alreadySeenSigninViewPreferenceKey; |
| 51 // Histograms to use for the user actions. |
| 52 @property(nonatomic) ios::SigninPromoViewHistograms histograms; |
| 53 |
| 54 // See -[SigninPromoViewMediator initWithBrowserState:]. |
| 55 - (instancetype)init NS_UNAVAILABLE; |
| 56 |
| 57 // Initialises with browser state. |
| 58 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 59 NS_DESIGNATED_INITIALIZER; |
| 60 |
33 - (SigninPromoViewConfigurator*)createConfigurator; | 61 - (SigninPromoViewConfigurator*)createConfigurator; |
34 | 62 |
| 63 // Increments the "shown" counter used for histograms. Called when the signin |
| 64 // promo view is visible |
| 65 - (void)signinPromoViewVisible; |
| 66 |
| 67 // Called when the sign-in promo view is hidden. |
| 68 - (void)signinPromoViewHidden; |
| 69 |
| 70 // Called when the sign-in promo view is dismissed. |
| 71 - (void)signinPromoViewDismissed; |
| 72 |
35 @end | 73 @end |
36 | 74 |
37 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ | 75 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_PROMO_VIEW_MEDIATOR_H_ |
OLD | NEW |