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

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

Issue 152683002: Passwords: Remove references to BrowserThread from PasswordStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 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 | Annotate | Revision Log
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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 &attrList, 0, NULL); 819 &attrList, 0, NULL);
820 return result == noErr; 820 return result == noErr;
821 } 821 }
822 822
823 OSType MacKeychainPasswordFormAdapter::CreatorCodeForSearch() { 823 OSType MacKeychainPasswordFormAdapter::CreatorCodeForSearch() {
824 return finds_only_owned_ ? base::mac::CreatorCodeForApplication() : 0; 824 return finds_only_owned_ ? base::mac::CreatorCodeForApplication() : 0;
825 } 825 }
826 826
827 #pragma mark - 827 #pragma mark -
828 828
829 PasswordStoreMac::PasswordStoreMac(AppleKeychain* keychain, 829 PasswordStoreMac::PasswordStoreMac(
830 LoginDatabase* login_db) 830 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
831 : keychain_(keychain), login_metadata_db_(login_db) { 831 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
832 AppleKeychain* keychain,
833 LoginDatabase* login_db)
834 : PasswordStore(main_thread_runner, db_thread_runner),
835 keychain_(keychain),
836 login_metadata_db_(login_db) {
832 DCHECK(keychain_.get()); 837 DCHECK(keychain_.get());
833 DCHECK(login_metadata_db_.get()); 838 DCHECK(login_metadata_db_.get());
834 } 839 }
835 840
836 PasswordStoreMac::~PasswordStoreMac() { 841 PasswordStoreMac::~PasswordStoreMac() {
837 if (thread_.get()) { 842 if (thread_.get()) {
838 thread_->message_loop()->DeleteSoon(FROM_HERE, 843 thread_->message_loop()->DeleteSoon(FROM_HERE,
839 notification_service_.release()); 844 notification_service_.release());
840 } 845 }
841 } 846 }
842 847
843 bool PasswordStoreMac::Init() { 848 bool PasswordStoreMac::Init() {
844 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread")); 849 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread"));
845 850
846 if (!thread_->Start()) { 851 if (!thread_->Start()) {
847 thread_.reset(NULL); 852 thread_.reset(NULL);
848 return false; 853 return false;
849 } 854 }
850 ScheduleTask(base::Bind(&PasswordStoreMac::CreateNotificationService, this)); 855 ScheduleTask(base::Bind(&PasswordStoreMac::CreateNotificationService, this));
851 return PasswordStore::Init(); 856 return PasswordStore::Init();
852 } 857 }
853 858
854 void PasswordStoreMac::ShutdownOnUIThread() { 859 void PasswordStoreMac::ShutdownOnUIThread() {
855 } 860 }
856 861
857 // Mac stores passwords in the system keychain, which can block for an 862 // Mac stores passwords in the system keychain, which can block for an
858 // arbitrarily long time (most notably, it can block on user confirmation 863 // arbitrarily long time (most notably, it can block on user confirmation
859 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB 864 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB
860 // thread. 865 // thread.
861 scoped_refptr<base::SequencedTaskRunner> PasswordStoreMac::GetTaskRunner() { 866 scoped_refptr<base::SequencedTaskRunner>
867 PasswordStoreMac::GetBackgroundTaskRunner() {
862 return (thread_.get()) ? thread_->message_loop_proxy() : NULL; 868 return (thread_.get()) ? thread_->message_loop_proxy() : NULL;
863 } 869 }
864 870
865 void PasswordStoreMac::ReportMetricsImpl() { 871 void PasswordStoreMac::ReportMetricsImpl() {
866 login_metadata_db_->ReportMetrics(); 872 login_metadata_db_->ReportMetrics();
867 } 873 }
868 874
869 void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) { 875 void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) {
870 if (AddToKeychainIfNecessary(form)) { 876 if (AddToKeychainIfNecessary(form)) {
871 if (login_metadata_db_->AddLogin(form)) { 877 if (login_metadata_db_->AddLogin(form)) {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); 1144 owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
1139 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); 1145 for (std::vector<PasswordForm*>::const_iterator i = forms.begin();
1140 i != forms.end(); ++i) { 1146 i != forms.end(); ++i) {
1141 owned_keychain_adapter.RemovePassword(**i); 1147 owned_keychain_adapter.RemovePassword(**i);
1142 } 1148 }
1143 } 1149 }
1144 1150
1145 void PasswordStoreMac::CreateNotificationService() { 1151 void PasswordStoreMac::CreateNotificationService() {
1146 notification_service_.reset(content::NotificationService::Create()); 1152 notification_service_.reset(content::NotificationService::Create());
1147 } 1153 }
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