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

Side by Side Diff: components/password_manager/core/browser/password_bubble_experiment.cc

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/password_manager/core/browser/password_bubble_experiment.h" 5 #include "components/password_manager/core/browser/password_bubble_experiment.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 int GetSmartBubbleDismissalThreshold() { 45 int GetSmartBubbleDismissalThreshold() {
46 std::string param = variations::GetVariationParamValue( 46 std::string param = variations::GetVariationParamValue(
47 kSmartBubbleExperimentName, kSmartBubbleThresholdParam); 47 kSmartBubbleExperimentName, kSmartBubbleThresholdParam);
48 int threshold = 0; 48 int threshold = 0;
49 // 3 is the default magic number that proved to show the best result. 49 // 3 is the default magic number that proved to show the best result.
50 return base::StringToInt(param, &threshold) ? threshold : 3; 50 return base::StringToInt(param, &threshold) ? threshold : 3;
51 } 51 }
52 52
53 bool IsSmartLockUser(const syncer::SyncService* sync_service) { 53 bool IsSmartLockUser(const sync_driver::SyncService* sync_service) {
54 return password_manager_util::GetPasswordSyncState(sync_service) == 54 return password_manager_util::GetPasswordSyncState(sync_service) ==
55 password_manager::SYNCING_NORMAL_ENCRYPTION; 55 password_manager::SYNCING_NORMAL_ENCRYPTION;
56 } 56 }
57 57
58 SmartLockBranding GetSmartLockBrandingState( 58 SmartLockBranding GetSmartLockBrandingState(
59 const syncer::SyncService* sync_service) { 59 const sync_driver::SyncService* sync_service) {
60 // Query the group first for correct UMA reporting. 60 // Query the group first for correct UMA reporting.
61 std::string group_name = 61 std::string group_name =
62 base::FieldTrialList::FindFullName(kBrandingExperimentName); 62 base::FieldTrialList::FindFullName(kBrandingExperimentName);
63 if (!IsSmartLockUser(sync_service)) 63 if (!IsSmartLockUser(sync_service))
64 return SmartLockBranding::NONE; 64 return SmartLockBranding::NONE;
65 if (group_name == kSmartLockBrandingGroupName) 65 if (group_name == kSmartLockBrandingGroupName)
66 return SmartLockBranding::FULL; 66 return SmartLockBranding::FULL;
67 if (group_name == kSmartLockBrandingSavePromptOnlyGroupName) 67 if (group_name == kSmartLockBrandingSavePromptOnlyGroupName)
68 return SmartLockBranding::SAVE_PROMPT_ONLY; 68 return SmartLockBranding::SAVE_PROMPT_ONLY;
69 return SmartLockBranding::NONE; 69 return SmartLockBranding::NONE;
70 } 70 }
71 71
72 bool IsSmartLockBrandingEnabled(const syncer::SyncService* sync_service) { 72 bool IsSmartLockBrandingEnabled(const sync_driver::SyncService* sync_service) {
73 return GetSmartLockBrandingState(sync_service) == SmartLockBranding::FULL; 73 return GetSmartLockBrandingState(sync_service) == SmartLockBranding::FULL;
74 } 74 }
75 75
76 bool IsSmartLockBrandingSavePromptEnabled( 76 bool IsSmartLockBrandingSavePromptEnabled(
77 const syncer::SyncService* sync_service) { 77 const sync_driver::SyncService* sync_service) {
78 return GetSmartLockBrandingState(sync_service) != SmartLockBranding::NONE; 78 return GetSmartLockBrandingState(sync_service) != SmartLockBranding::NONE;
79 } 79 }
80 80
81 bool ShouldShowSavePromptFirstRunExperience( 81 bool ShouldShowSavePromptFirstRunExperience(
82 const syncer::SyncService* sync_service, 82 const sync_driver::SyncService* sync_service,
83 PrefService* prefs) { 83 PrefService* prefs) {
84 return false; 84 return false;
85 } 85 }
86 86
87 void RecordSavePromptFirstRunExperienceWasShown(PrefService* prefs) { 87 void RecordSavePromptFirstRunExperienceWasShown(PrefService* prefs) {
88 prefs->SetBoolean( 88 prefs->SetBoolean(
89 password_manager::prefs::kWasSavePrompFirstRunExperienceShown, true); 89 password_manager::prefs::kWasSavePrompFirstRunExperienceShown, true);
90 } 90 }
91 91
92 bool ShouldShowAutoSignInPromptFirstRunExperience(PrefService* prefs) { 92 bool ShouldShowAutoSignInPromptFirstRunExperience(PrefService* prefs) {
93 return !prefs->GetBoolean( 93 return !prefs->GetBoolean(
94 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown); 94 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown);
95 } 95 }
96 96
97 void RecordAutoSignInPromptFirstRunExperienceWasShown(PrefService* prefs) { 97 void RecordAutoSignInPromptFirstRunExperienceWasShown(PrefService* prefs) {
98 prefs->SetBoolean( 98 prefs->SetBoolean(
99 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, true); 99 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, true);
100 } 100 }
101 101
102 void TurnOffAutoSignin(PrefService* prefs) { 102 void TurnOffAutoSignin(PrefService* prefs) {
103 prefs->SetBoolean(password_manager::prefs::kCredentialsEnableAutosignin, 103 prefs->SetBoolean(password_manager::prefs::kCredentialsEnableAutosignin,
104 false); 104 false);
105 } 105 }
106 106
107 bool ShouldShowChromeSignInPasswordPromo( 107 bool ShouldShowChromeSignInPasswordPromo(
108 PrefService* prefs, 108 PrefService* prefs,
109 const syncer::SyncService* sync_service) { 109 const sync_driver::SyncService* sync_service) {
110 // Query the group first for correct UMA reporting. 110 // Query the group first for correct UMA reporting.
111 std::string param = variations::GetVariationParamValue( 111 std::string param = variations::GetVariationParamValue(
112 kChromeSignInPasswordPromoExperimentName, 112 kChromeSignInPasswordPromoExperimentName,
113 kChromeSignInPasswordPromoThresholdParam); 113 kChromeSignInPasswordPromoThresholdParam);
114 if (!sync_service || !sync_service->IsSyncAllowed() || 114 if (!sync_service || !sync_service->IsSyncAllowed() ||
115 sync_service->IsFirstSetupComplete()) 115 sync_service->IsFirstSetupComplete())
116 return false; 116 return false;
117 int threshold = 0; 117 int threshold = 0;
118 return base::StringToInt(param, &threshold) && 118 return base::StringToInt(param, &threshold) &&
119 !prefs->GetBoolean( 119 !prefs->GetBoolean(
120 password_manager::prefs::kWasSignInPasswordPromoClicked) && 120 password_manager::prefs::kWasSignInPasswordPromoClicked) &&
121 prefs->GetInteger( 121 prefs->GetInteger(
122 password_manager::prefs::kNumberSignInPasswordPromoShown) < 122 password_manager::prefs::kNumberSignInPasswordPromoShown) <
123 threshold; 123 threshold;
124 } 124 }
125 125
126 } // namespace password_bubble_experiment 126 } // namespace password_bubble_experiment
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698