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 CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ |
6 #define CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ | 6 #define CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
11 | 11 |
12 namespace syncer { | 12 namespace syncer { |
13 class SyncService; | 13 class SyncService; |
14 } | 14 } |
15 | 15 |
16 namespace user_prefs { | 16 namespace user_prefs { |
17 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
18 } | 18 } |
19 | 19 |
20 class PrefRegistrySimple; | 20 class PrefRegistrySimple; |
21 class PrefService; | 21 class PrefService; |
22 | 22 |
23 namespace desktop_ios_promotion { | 23 namespace desktop_ios_promotion { |
24 | 24 |
25 // Represents the reason that the Desktop to iOS promotion was dismissed for. | 25 // Represents the reason that the Desktop to iOS promotion was dismissed for. |
| 26 // These values are written to logs. New values can be added, but existing |
| 27 // values must never be reordered or deleted and reused. |
26 enum class PromotionDismissalReason { | 28 enum class PromotionDismissalReason { |
27 FOCUS_LOST = 0, | 29 FOCUS_LOST = 0, |
28 TAB_SWITCHED, | 30 NO_THANKS = 1, |
29 NO_THANKS, | 31 CLOSE_BUTTON = 2, |
30 CLOSE_BUTTON, | 32 SEND_SMS = 3, |
31 SEND_SMS, | |
32 LEARN_MORE_CLICKED, | |
33 }; | 33 }; |
34 | 34 |
| 35 enum class EntryPointLocalPrefType { IMPRESSIONS = 0, DISMISSED = 1 }; |
| 36 |
35 // The place where the promotion appeared. | 37 // The place where the promotion appeared. |
| 38 // Intentionally skipped the = 0 value, as it represents the defaults on the |
| 39 // prefs (eg. User didn't recieve SMS). |
| 40 // These values are written to logs. New values can be added, but existing |
| 41 // values must never be reordered or deleted and reused. |
36 enum class PromotionEntryPoint { | 42 enum class PromotionEntryPoint { |
37 SAVE_PASSWORD_BUBBLE = 0, | 43 SAVE_PASSWORD_BUBBLE = 1, |
38 BOOKMARKS_BUBBLE, | 44 BOOKMARKS_BUBBLE = 2, |
39 BOOKMARKS_FOOTNOTE, | 45 BOOKMARKS_FOOTNOTE = 3, |
40 HISTORY_PAGE | 46 HISTORY_PAGE = 4, |
| 47 // Used for histograms logging. |
| 48 ENTRY_POINT_MAX_VALUE = 5 |
41 }; | 49 }; |
42 | 50 |
43 // Entry points local prefs, each entry point has a preference for impressions | 51 // Entry points local prefs, each entry point has a preference for impressions |
44 // count and a preference for whether user dismissed it or not. | 52 // count and a preference for whether user dismissed it or not. |
45 // Do not change the order of this array, as it's indexed using | 53 // Do not change the order of this array, as it's indexed using |
46 // desktop_ios_promotion::PromotionEntryPoint. | 54 // desktop_ios_promotion::PromotionEntryPoint. |
47 const char* const kEntryPointLocalPrefs[4][2] = { | 55 const char* const kEntryPointLocalPrefs[5][2] = { |
| 56 {"", ""}, |
48 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, | 57 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, |
49 prefs::kSavePasswordsBubbleIOSPromoDismissed}, | 58 prefs::kSavePasswordsBubbleIOSPromoDismissed}, |
50 {prefs::kNumberBookmarksBubbleIOSPromoShown, | 59 {prefs::kNumberBookmarksBubbleIOSPromoShown, |
51 prefs::kBookmarksBubbleIOSPromoDismissed}, | 60 prefs::kBookmarksBubbleIOSPromoDismissed}, |
52 {prefs::kNumberBookmarksFootNoteIOSPromoShown, | 61 {prefs::kNumberBookmarksFootNoteIOSPromoShown, |
53 prefs::kBookmarksFootNoteIOSPromoDismissed}, | 62 prefs::kBookmarksFootNoteIOSPromoDismissed}, |
54 {prefs::kNumberHistoryPageIOSPromoShown, | 63 {prefs::kNumberHistoryPageIOSPromoShown, |
55 prefs::kHistoryPageIOSPromoDismissed}}; | 64 prefs::kHistoryPageIOSPromoDismissed}}; |
56 | 65 |
57 bool IsEligibleForIOSPromotion(PrefService* prefs, | 66 bool IsEligibleForIOSPromotion(PrefService* prefs, |
58 const syncer::SyncService* sync_service, | 67 const syncer::SyncService* sync_service, |
59 desktop_ios_promotion::PromotionEntryPoint); | 68 PromotionEntryPoint entry_point); |
60 | 69 |
61 // Returns the Bubble text based on the promotion entry point. | 70 // Returns the Bubble text based on the promotion entry point. |
62 base::string16 GetPromoBubbleText( | 71 base::string16 GetPromoBubbleText(PromotionEntryPoint entry_point); |
63 desktop_ios_promotion::PromotionEntryPoint entry_point); | |
64 | 72 |
65 // Register all Priority Sync preferences. | 73 // Register all Priority Sync preferences. |
66 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 74 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
67 | 75 |
68 // Register all local only Preferences. | 76 // Register all local only Preferences. |
69 void RegisterLocalPrefs(PrefRegistrySimple* registry); | 77 void RegisterLocalPrefs(PrefRegistrySimple* registry); |
70 | 78 |
| 79 // Log promotion dismissal reason for entry points. |
| 80 void LogDismissalReason(PromotionDismissalReason reason, |
| 81 PromotionEntryPoint entry_point); |
| 82 |
71 } // namespace desktop_ios_promotion | 83 } // namespace desktop_ios_promotion |
72 | 84 |
73 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ | 85 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ |
OLD | NEW |