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 // These values are written to logs. New values can be added, but existing | |
39 // values must never be reordered or deleted and reused. | |
36 enum class PromotionEntryPoint { | 40 enum class PromotionEntryPoint { |
Mark P
2017/02/17 06:15:28
optional nit: it's clear you explicitly decided to
mrefaat
2017/02/17 12:55:16
Done.
| |
37 SAVE_PASSWORD_BUBBLE = 0, | 41 SAVE_PASSWORD_BUBBLE = 1, |
38 BOOKMARKS_BUBBLE, | 42 BOOKMARKS_BUBBLE = 2, |
39 BOOKMARKS_FOOTNOTE, | 43 BOOKMARKS_FOOTNOTE = 3, |
40 HISTORY_PAGE | 44 HISTORY_PAGE = 4, |
45 // Used for histograms logging. | |
46 ENTRY_POINT_MAX_VALUE = 5 | |
41 }; | 47 }; |
42 | 48 |
43 // Entry points local prefs, each entry point has a preference for impressions | 49 // Entry points local prefs, each entry point has a preference for impressions |
44 // count and a preference for whether user dismissed it or not. | 50 // 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 | 51 // Do not change the order of this array, as it's indexed using |
46 // desktop_ios_promotion::PromotionEntryPoint. | 52 // desktop_ios_promotion::PromotionEntryPoint. |
47 const char* const kEntryPointLocalPrefs[4][2] = { | 53 const char* const kEntryPointLocalPrefs[5][2] = { |
54 {"", ""}, | |
48 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, | 55 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, |
49 prefs::kSavePasswordsBubbleIOSPromoDismissed}, | 56 prefs::kSavePasswordsBubbleIOSPromoDismissed}, |
50 {prefs::kNumberBookmarksBubbleIOSPromoShown, | 57 {prefs::kNumberBookmarksBubbleIOSPromoShown, |
51 prefs::kBookmarksBubbleIOSPromoDismissed}, | 58 prefs::kBookmarksBubbleIOSPromoDismissed}, |
52 {prefs::kNumberBookmarksFootNoteIOSPromoShown, | 59 {prefs::kNumberBookmarksFootNoteIOSPromoShown, |
53 prefs::kBookmarksFootNoteIOSPromoDismissed}, | 60 prefs::kBookmarksFootNoteIOSPromoDismissed}, |
54 {prefs::kNumberHistoryPageIOSPromoShown, | 61 {prefs::kNumberHistoryPageIOSPromoShown, |
55 prefs::kHistoryPageIOSPromoDismissed}}; | 62 prefs::kHistoryPageIOSPromoDismissed}}; |
56 | 63 |
57 bool IsEligibleForIOSPromotion(PrefService* prefs, | 64 bool IsEligibleForIOSPromotion(PrefService* prefs, |
58 const syncer::SyncService* sync_service, | 65 const syncer::SyncService* sync_service, |
59 desktop_ios_promotion::PromotionEntryPoint); | 66 PromotionEntryPoint entry_point); |
60 | 67 |
61 // Returns the Bubble text based on the promotion entry point. | 68 // Returns the Bubble text based on the promotion entry point. |
62 base::string16 GetPromoBubbleText( | 69 base::string16 GetPromoBubbleText(PromotionEntryPoint entry_point); |
63 desktop_ios_promotion::PromotionEntryPoint entry_point); | |
64 | 70 |
65 // Register all Priority Sync preferences. | 71 // Register all Priority Sync preferences. |
66 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 72 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
67 | 73 |
68 // Register all local only Preferences. | 74 // Register all local only Preferences. |
69 void RegisterLocalPrefs(PrefRegistrySimple* registry); | 75 void RegisterLocalPrefs(PrefRegistrySimple* registry); |
70 | 76 |
77 // Log promotion dismissal reason for entry points. | |
78 void LogDismissalReason(PromotionDismissalReason reason, | |
79 PromotionEntryPoint entry_point); | |
80 | |
71 } // namespace desktop_ios_promotion | 81 } // namespace desktop_ios_promotion |
72 | 82 |
73 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ | 83 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ |
OLD | NEW |