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 "chrome/browser/password_manager/password_store_factory.h" | 5 #include "chrome/browser/password_manager/password_store_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "chrome/browser/password_manager/login_database.h" | 9 #include "chrome/browser/password_manager/login_database.h" |
10 #include "chrome/browser/password_manager/password_store.h" | 10 #include "chrome/browser/password_manager/password_store.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return id; | 92 return id; |
93 } | 93 } |
94 #endif | 94 #endif |
95 | 95 |
96 scoped_refptr<RefcountedProfileKeyedService> | 96 scoped_refptr<RefcountedProfileKeyedService> |
97 PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const { | 97 PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const { |
98 scoped_refptr<PasswordStore> ps; | 98 scoped_refptr<PasswordStore> ps; |
99 FilePath login_db_file_path = profile->GetPath(); | 99 FilePath login_db_file_path = profile->GetPath(); |
100 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); | 100 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); |
101 LoginDatabase* login_db = new LoginDatabase(); | 101 LoginDatabase* login_db = new LoginDatabase(); |
102 if (!login_db->Init(login_db_file_path)) { | 102 { |
103 LOG(ERROR) << "Could not initialize login database."; | 103 // TODO(paivanof@gmail.com): execution of login_db->Init() should go |
104 delete login_db; | 104 // to DB thread. http://crbug.com/138903 |
105 return NULL; | 105 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 106 if (!login_db->Init(login_db_file_path)) { |
| 107 LOG(ERROR) << "Could not initialize login database."; |
| 108 delete login_db; |
| 109 return NULL; |
| 110 } |
106 } | 111 } |
107 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
108 ps = new PasswordStoreWin( | 113 ps = new PasswordStoreWin( |
109 login_db, profile, | 114 login_db, profile, |
110 WebDataServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS)); | 115 WebDataServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS)); |
111 #elif defined(OS_MACOSX) | 116 #elif defined(OS_MACOSX) |
112 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { | 117 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { |
113 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db); | 118 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db); |
114 } else { | 119 } else { |
115 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db); | 120 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #endif | 205 #endif |
201 } | 206 } |
202 | 207 |
203 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { | 208 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { |
204 return true; | 209 return true; |
205 } | 210 } |
206 | 211 |
207 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { | 212 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { |
208 return true; | 213 return true; |
209 } | 214 } |
OLD | NEW |