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

Side by Side Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 644053003: [Password Manager] Add UMA stats for custom passphrase users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 6 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 (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 "chrome/browser/password_manager/password_store_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 #include "chrome/browser/password_manager/password_store_mac_internal.h" 6 #include "chrome/browser/password_manager/password_store_mac_internal.h"
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 : password_manager::PasswordStore(main_thread_runner, db_thread_runner), 868 : password_manager::PasswordStore(main_thread_runner, db_thread_runner),
869 keychain_(keychain), 869 keychain_(keychain),
870 login_metadata_db_(login_db) { 870 login_metadata_db_(login_db) {
871 DCHECK(keychain_.get()); 871 DCHECK(keychain_.get());
872 DCHECK(login_metadata_db_.get()); 872 DCHECK(login_metadata_db_.get());
873 } 873 }
874 874
875 PasswordStoreMac::~PasswordStoreMac() {} 875 PasswordStoreMac::~PasswordStoreMac() {}
876 876
877 bool PasswordStoreMac::Init( 877 bool PasswordStoreMac::Init(
878 const syncer::SyncableService::StartSyncFlare& flare, 878 const syncer::SyncableService::StartSyncFlare& flare) {
879 const std::string& sync_username) {
880 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 879 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
881 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread")); 880 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread"));
882 881
883 if (!thread_->Start()) { 882 if (!thread_->Start()) {
884 thread_.reset(NULL); 883 thread_.reset(NULL);
885 return false; 884 return false;
886 } 885 }
887 return password_manager::PasswordStore::Init(flare, sync_username); 886 return password_manager::PasswordStore::Init(flare);
888 } 887 }
889 888
890 void PasswordStoreMac::Shutdown() { 889 void PasswordStoreMac::Shutdown() {
891 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 890 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
892 password_manager::PasswordStore::Shutdown(); 891 password_manager::PasswordStore::Shutdown();
893 thread_->Stop(); 892 thread_->Stop();
894 } 893 }
895 894
896 // Mac stores passwords in the system keychain, which can block for an 895 // Mac stores passwords in the system keychain, which can block for an
897 // arbitrarily long time (most notably, it can block on user confirmation 896 // arbitrarily long time (most notably, it can block on user confirmation
898 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB 897 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB
899 // thread. 898 // thread.
900 scoped_refptr<base::SingleThreadTaskRunner> 899 scoped_refptr<base::SingleThreadTaskRunner>
901 PasswordStoreMac::GetBackgroundTaskRunner() { 900 PasswordStoreMac::GetBackgroundTaskRunner() {
902 return (thread_.get()) ? thread_->message_loop_proxy() : NULL; 901 return (thread_.get()) ? thread_->message_loop_proxy() : NULL;
903 } 902 }
904 903
905 void PasswordStoreMac::ReportMetricsImpl(const std::string& sync_username) { 904 void PasswordStoreMac::ReportMetricsImpl(const std::string& sync_username,
906 login_metadata_db_->ReportMetrics(sync_username); 905 bool custom_passphrase_sync_enabled) {
906 login_metadata_db_->ReportMetrics(sync_username,
907 custom_passphrase_sync_enabled);
907 } 908 }
908 909
909 PasswordStoreChangeList PasswordStoreMac::AddLoginImpl( 910 PasswordStoreChangeList PasswordStoreMac::AddLoginImpl(
910 const PasswordForm& form) { 911 const PasswordForm& form) {
911 DCHECK(thread_->message_loop() == base::MessageLoop::current()); 912 DCHECK(thread_->message_loop() == base::MessageLoop::current());
912 PasswordStoreChangeList changes; 913 PasswordStoreChangeList changes;
913 if (AddToKeychainIfNecessary(form)) { 914 if (AddToKeychainIfNecessary(form)) {
914 changes = login_metadata_db_->AddLogin(form); 915 changes = login_metadata_db_->AddLogin(form);
915 } 916 }
916 return changes; 917 return changes;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1151
1151 ScopedVector<PasswordForm> merged_forms; 1152 ScopedVector<PasswordForm> merged_forms;
1152 merged_forms.get() = internal_keychain_helpers::GetPasswordsForForms( 1153 merged_forms.get() = internal_keychain_helpers::GetPasswordsForForms(
1153 *keychain_, &database_forms); 1154 *keychain_, &database_forms);
1154 1155
1155 // Clean up any orphaned database entries. 1156 // Clean up any orphaned database entries.
1156 RemoveDatabaseForms(database_forms); 1157 RemoveDatabaseForms(database_forms);
1157 1158
1158 forms->insert(forms->end(), database_forms.begin(), database_forms.end()); 1159 forms->insert(forms->end(), database_forms.begin(), database_forms.end());
1159 } 1160 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_mac.h ('k') | chrome/browser/password_manager/password_store_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698