Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h

Issue 2694893002: Integrate SMS service with Desktop iOS promotion (Closed)
Patch Set: nits Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
29 // Focus lost is the default reason and represents no interaction.
27 FOCUS_LOST = 0, 30 FOCUS_LOST = 0,
28 TAB_SWITCHED, 31 NO_THANKS = 1,
29 NO_THANKS, 32 CLOSE_BUTTON = 2,
30 CLOSE_BUTTON, 33 SEND_SMS = 3,
31 SEND_SMS, 34 // Used for histograms logging.
32 LEARN_MORE_CLICKED, 35 DISMISSAL_REASON_MAX_VALUE = 4
33 }; 36 };
34 37
38 enum class EntryPointLocalPrefType { IMPRESSIONS = 0, DISMISSED = 1 };
39
35 // The place where the promotion appeared. 40 // The place where the promotion appeared.
41 // Intentionally skipped the = 0 value, as it represents the defaults on the
42 // prefs (eg. User didn't recieve SMS).
43 // These values are written to logs. New values can be added, but existing
44 // values must never be reordered or deleted and reused.
36 enum class PromotionEntryPoint { 45 enum class PromotionEntryPoint {
37 SAVE_PASSWORD_BUBBLE = 0, 46 SAVE_PASSWORD_BUBBLE = 1,
38 BOOKMARKS_BUBBLE, 47 BOOKMARKS_BUBBLE = 2,
39 BOOKMARKS_FOOTNOTE, 48 BOOKMARKS_FOOTNOTE = 3,
40 HISTORY_PAGE 49 HISTORY_PAGE = 4,
50 // Used for histograms logging.
51 ENTRY_POINT_MAX_VALUE = 5
41 }; 52 };
42 53
43 // Entry points local prefs, each entry point has a preference for impressions 54 // Entry points local prefs, each entry point has a preference for impressions
44 // count and a preference for whether user dismissed it or not. 55 // 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 56 // Do not change the order of this array, as it's indexed using
46 // desktop_ios_promotion::PromotionEntryPoint. 57 // desktop_ios_promotion::PromotionEntryPoint.
47 const char* const kEntryPointLocalPrefs[4][2] = { 58 const char* const kEntryPointLocalPrefs[5][2] = {
59 // The first emtpy value is for padding as PromotionEntryPoints enum starts
60 // from 1.
61 {"", ""},
48 {prefs::kNumberSavePasswordsBubbleIOSPromoShown, 62 {prefs::kNumberSavePasswordsBubbleIOSPromoShown,
49 prefs::kSavePasswordsBubbleIOSPromoDismissed}, 63 prefs::kSavePasswordsBubbleIOSPromoDismissed},
50 {prefs::kNumberBookmarksBubbleIOSPromoShown, 64 {prefs::kNumberBookmarksBubbleIOSPromoShown,
51 prefs::kBookmarksBubbleIOSPromoDismissed}, 65 prefs::kBookmarksBubbleIOSPromoDismissed},
52 {prefs::kNumberBookmarksFootNoteIOSPromoShown, 66 {prefs::kNumberBookmarksFootNoteIOSPromoShown,
53 prefs::kBookmarksFootNoteIOSPromoDismissed}, 67 prefs::kBookmarksFootNoteIOSPromoDismissed},
54 {prefs::kNumberHistoryPageIOSPromoShown, 68 {prefs::kNumberHistoryPageIOSPromoShown,
55 prefs::kHistoryPageIOSPromoDismissed}}; 69 prefs::kHistoryPageIOSPromoDismissed}};
56 70
57 bool IsEligibleForIOSPromotion(PrefService* prefs, 71 bool IsEligibleForIOSPromotion(PrefService* prefs,
58 const syncer::SyncService* sync_service, 72 const syncer::SyncService* sync_service,
59 desktop_ios_promotion::PromotionEntryPoint); 73 PromotionEntryPoint entry_point);
60 74
61 // Returns the Bubble text based on the promotion entry point. 75 // Returns the Bubble text based on the promotion entry point.
62 base::string16 GetPromoBubbleText( 76 base::string16 GetPromoBubbleText(PromotionEntryPoint entry_point);
63 desktop_ios_promotion::PromotionEntryPoint entry_point);
64 77
65 // Register all Priority Sync preferences. 78 // Register all Priority Sync preferences.
66 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 79 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
67 80
68 // Register all local only Preferences. 81 // Register all local only Preferences.
69 void RegisterLocalPrefs(PrefRegistrySimple* registry); 82 void RegisterLocalPrefs(PrefRegistrySimple* registry);
70 83
84 // Log promotion dismissal reason for entry points.
85 void LogDismissalReason(PromotionDismissalReason reason,
86 PromotionEntryPoint entry_point);
87
71 } // namespace desktop_ios_promotion 88 } // namespace desktop_ios_promotion
72 89
73 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_ 90 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698