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. | |
| 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, |
| 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 |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 // Entry points local prefs, each entry point has a preference for impressions | 47 // Entry points local prefs, each entry point has a preference for impressions |
| 44 // count and a preference for whether user dismissed it or not. | 48 // 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 | 49 // Do not change the order of this array, as it's indexed using |
| 46 // desktop_ios_promotion::PromotionEntryPoint. | 50 // desktop_ios_promotion::PromotionEntryPoint. |
| 47 const char* const kEntryPointLocalPrefs[4][2] = { | 51 const char* const kEntryPointLocalPrefs[4][2] = { |
| 48 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, | 52 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, |
| 49 prefs::kSavePasswordsBubbleIOSPromoDismissed}, | 53 prefs::kSavePasswordsBubbleIOSPromoDismissed}, |
| 50 {prefs::kNumberBookmarksBubbleIOSPromoShown, | 54 {prefs::kNumberBookmarksBubbleIOSPromoShown, |
| 51 prefs::kBookmarksBubbleIOSPromoDismissed}, | 55 prefs::kBookmarksBubbleIOSPromoDismissed}, |
| 52 {prefs::kNumberBookmarksFootNoteIOSPromoShown, | 56 {prefs::kNumberBookmarksFootNoteIOSPromoShown, |
| 53 prefs::kBookmarksFootNoteIOSPromoDismissed}, | 57 prefs::kBookmarksFootNoteIOSPromoDismissed}, |
| 54 {prefs::kNumberHistoryPageIOSPromoShown, | 58 {prefs::kNumberHistoryPageIOSPromoShown, |
| 55 prefs::kHistoryPageIOSPromoDismissed}}; | 59 prefs::kHistoryPageIOSPromoDismissed}}; |
| 56 | 60 |
| 57 bool IsEligibleForIOSPromotion(PrefService* prefs, | 61 bool IsEligibleForIOSPromotion(PrefService* prefs, |
| 58 const syncer::SyncService* sync_service, | 62 const syncer::SyncService* sync_service, |
| 59 desktop_ios_promotion::PromotionEntryPoint); | 63 PromotionEntryPoint); |
|
sky
2017/02/16 00:13:36
All function arguments should be named (see style
mrefaat
2017/02/16 21:02:39
Ack, typo
| |
| 60 | 64 |
| 61 // Returns the Bubble text based on the promotion entry point. | 65 // Returns the Bubble text based on the promotion entry point. |
| 62 base::string16 GetPromoBubbleText( | 66 base::string16 GetPromoBubbleText(PromotionEntryPoint entry_point); |
| 63 desktop_ios_promotion::PromotionEntryPoint entry_point); | |
| 64 | 67 |
| 65 // Register all Priority Sync preferences. | 68 // Register all Priority Sync preferences. |
| 66 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 69 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 67 | 70 |
| 68 // Register all local only Preferences. | 71 // Register all local only Preferences. |
| 69 void RegisterLocalPrefs(PrefRegistrySimple* registry); | 72 void RegisterLocalPrefs(PrefRegistrySimple* registry); |
| 70 | 73 |
| 74 // Log promotion dismissal reason for entry points. | |
| 75 void LogDismissalReason(PromotionDismissalReason reason, | |
| 76 PromotionEntryPoint entry_point); | |
| 77 | |
| 71 } // namespace desktop_ios_promotion | 78 } // namespace desktop_ios_promotion |
| 72 | 79 |
| 73 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ | 80 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ |
| OLD | NEW |