Chromium Code Reviews| 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. | |
|
Mark P
2017/02/16 23:18:57
Can you confirm that nothing caused these values t
mrefaat
2017/02/17 00:20:59
Yes, these values have not been written to logs be
| |
| 26 enum class PromotionDismissalReason { | 28 enum class PromotionDismissalReason { |
| 27 FOCUS_LOST = 0, | 29 FOCUS_LOST = 0, |
| 28 TAB_SWITCHED, | |
| 29 NO_THANKS, | 30 NO_THANKS, |
|
Mark P
2017/02/16 23:18:57
Following histogram enum best practices, please ex
mrefaat
2017/02/17 00:20:59
Done.
| |
| 30 CLOSE_BUTTON, | 31 CLOSE_BUTTON, |
| 31 SEND_SMS, | 32 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 { |
| 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 |
| 49 // Used with PromotionEntryPoint values as an index on kEntryPointLocalPrefs. | |
| 50 constexpr int kPromotionEntrypointIndexOffset = -1; | |
|
Mark P
2017/02/16 23:18:57
Rather than do this hack, why don't you just put a
mrefaat
2017/02/17 00:20:59
I was going to do that but was afraid of confusion
| |
| 51 | |
| 43 // Entry points local prefs, each entry point has a preference for impressions | 52 // Entry points local prefs, each entry point has a preference for impressions |
| 44 // count and a preference for whether user dismissed it or not. | 53 // 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 | 54 // Do not change the order of this array, as it's indexed using |
| 46 // desktop_ios_promotion::PromotionEntryPoint. | 55 // desktop_ios_promotion::PromotionEntryPoint. |
| 47 const char* const kEntryPointLocalPrefs[4][2] = { | 56 const char* const kEntryPointLocalPrefs[4][2] = { |
| 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 |