OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager.h" | 5 #include "components/password_manager/core/browser/password_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static base::PlatformThreadId initial_thread_id = | 50 static base::PlatformThreadId initial_thread_id = |
51 base::PlatformThread::CurrentId(); | 51 base::PlatformThread::CurrentId(); |
52 DCHECK(initial_thread_id == base::PlatformThread::CurrentId()); | 52 DCHECK(initial_thread_id == base::PlatformThread::CurrentId()); |
53 | 53 |
54 static bool ran_once = false; | 54 static bool ran_once = false; |
55 if (ran_once) | 55 if (ran_once) |
56 return; | 56 return; |
57 ran_once = true; | 57 ran_once = true; |
58 | 58 |
59 PasswordStore* store = client->GetPasswordStore(); | 59 PasswordStore* store = client->GetPasswordStore(); |
60 // May be NULL in tests. | 60 // May be null in tests. |
61 if (store) { | 61 if (store) { |
62 store->ReportMetrics(client->GetSyncUsername(), | 62 store->ReportMetrics(client->GetSyncUsername(), |
63 client->IsPasswordSyncEnabled( | 63 client->IsPasswordSyncEnabled( |
64 password_manager::ONLY_CUSTOM_PASSPHRASE)); | 64 password_manager::ONLY_CUSTOM_PASSPHRASE)); |
65 } | 65 } |
66 UMA_HISTOGRAM_BOOLEAN("PasswordManager.Enabled", password_manager_enabled); | 66 UMA_HISTOGRAM_BOOLEAN("PasswordManager.Enabled", password_manager_enabled); |
67 } | 67 } |
68 | 68 |
69 bool ShouldDropSyncCredential() { | 69 bool ShouldDropSyncCredential() { |
70 std::string group_name = | 70 std::string group_name = |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return; | 640 return; |
641 | 641 |
642 const base::FieldTrial::Probability kDivisor = 100; | 642 const base::FieldTrial::Probability kDivisor = 100; |
643 scoped_refptr<base::FieldTrial> trial( | 643 scoped_refptr<base::FieldTrial> trial( |
644 base::FieldTrialList::FactoryGetFieldTrial( | 644 base::FieldTrialList::FactoryGetFieldTrial( |
645 kOtherPossibleUsernamesExperiment, | 645 kOtherPossibleUsernamesExperiment, |
646 kDivisor, | 646 kDivisor, |
647 "Disabled", | 647 "Disabled", |
648 2013, 12, 31, | 648 2013, 12, 31, |
649 base::FieldTrial::ONE_TIME_RANDOMIZED, | 649 base::FieldTrial::ONE_TIME_RANDOMIZED, |
650 NULL)); | 650 nullptr)); |
651 base::FieldTrial::Probability enabled_probability = | 651 base::FieldTrial::Probability enabled_probability = |
652 client_->GetProbabilityForExperiment(kOtherPossibleUsernamesExperiment); | 652 client_->GetProbabilityForExperiment(kOtherPossibleUsernamesExperiment); |
653 trial->AppendGroup("Enabled", enabled_probability); | 653 trial->AppendGroup("Enabled", enabled_probability); |
654 } | 654 } |
655 | 655 |
656 bool PasswordManager::OtherPossibleUsernamesEnabled() const { | 656 bool PasswordManager::OtherPossibleUsernamesEnabled() const { |
657 return base::FieldTrialList::FindFullName( | 657 return base::FieldTrialList::FindFullName( |
658 kOtherPossibleUsernamesExperiment) == "Enabled"; | 658 kOtherPossibleUsernamesExperiment) == "Enabled"; |
659 } | 659 } |
660 | 660 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 observers_, | 696 observers_, |
697 OnAutofillDataAvailable(preferred_match.username_value, | 697 OnAutofillDataAvailable(preferred_match.username_value, |
698 preferred_match.password_value)); | 698 preferred_match.password_value)); |
699 break; | 699 break; |
700 } | 700 } |
701 | 701 |
702 client_->PasswordWasAutofilled(best_matches); | 702 client_->PasswordWasAutofilled(best_matches); |
703 } | 703 } |
704 | 704 |
705 } // namespace password_manager | 705 } // namespace password_manager |
OLD | NEW |