OLD | NEW |
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 "chrome/browser/ui/passwords/password_bubble_experiment.h" | 5 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/password_manager/password_manager_util.h" | 9 #include "chrome/browser/password_manager/password_manager_util.h" |
9 #include "chrome/browser/signin/signin_manager_factory.h" | |
10 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
11 | 10 |
12 namespace password_bubble_experiment { | 11 namespace password_bubble_experiment { |
13 namespace { | 12 namespace { |
14 | 13 |
15 const char kBrandingExperimentName[] = "PasswordBranding"; | 14 const char kBrandingExperimentName[] = "PasswordBranding"; |
16 const char kSmartLockBrandingGroupName[] = "SmartLockBranding"; | 15 const char kSmartLockBrandingGroupName[] = "SmartLockBranding"; |
17 | 16 |
18 } // namespace | 17 } // namespace |
19 | 18 |
20 void RecordBubbleClosed( | 19 void RecordBubbleClosed( |
21 PrefService* prefs, | 20 PrefService* prefs, |
22 password_manager::metrics_util::UIDismissalReason reason) { | 21 password_manager::metrics_util::UIDismissalReason reason) { |
23 // TODO(vasilii): store the statistics. | 22 // TODO(vasilii): store the statistics. |
24 } | 23 } |
25 | 24 |
26 bool IsSmartLockBrandingEnabled(Profile* profile) { | 25 bool IsSmartLockBrandingEnabled(const sync_driver::SyncService* sync_service) { |
27 const ProfileSyncService* sync_service = | |
28 ProfileSyncServiceFactory::GetForProfile(profile); | |
29 return password_manager_util::GetPasswordSyncState(sync_service) == | 26 return password_manager_util::GetPasswordSyncState(sync_service) == |
30 password_manager::SYNCING_NORMAL_ENCRYPTION && | 27 password_manager::SYNCING_NORMAL_ENCRYPTION && |
31 base::FieldTrialList::FindFullName(kBrandingExperimentName) == | 28 base::FieldTrialList::FindFullName(kBrandingExperimentName) == |
32 kSmartLockBrandingGroupName; | 29 kSmartLockBrandingGroupName; |
33 } | 30 } |
34 | 31 |
35 } // namespace password_bubble_experiment | 32 } // namespace password_bubble_experiment |
OLD | NEW |