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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
11 #include "chrome/browser/webdata/web_data_service.h" | 11 #include "chrome/browser/webdata/web_data_service.h" |
12 #include "chrome/browser/webdata/web_data_service_factory.h" | 12 #include "chrome/browser/webdata/web_data_service_factory.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 16 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 17 #include "components/encryptor/encryptor_switches.h" |
17 #include "components/password_manager/core/browser/login_database.h" | 18 #include "components/password_manager/core/browser/login_database.h" |
18 #include "components/password_manager/core/browser/password_store.h" | 19 #include "components/password_manager/core/browser/password_store.h" |
19 #include "components/password_manager/core/browser/password_store_default.h" | 20 #include "components/password_manager/core/browser/password_store_default.h" |
20 #include "components/user_prefs/pref_registry_syncable.h" | 21 #include "components/user_prefs/pref_registry_syncable.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 | 23 |
23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
24 #include "chrome/browser/password_manager/password_store_win.h" | 25 #include "chrome/browser/password_manager/password_store_win.h" |
25 #elif defined(OS_MACOSX) | 26 #elif defined(OS_MACOSX) |
26 #include "chrome/browser/password_manager/password_store_mac.h" | 27 #include "chrome/browser/password_manager/password_store_mac.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 content::BrowserThread::DB)); | 139 content::BrowserThread::DB)); |
139 | 140 |
140 scoped_refptr<PasswordStore> ps; | 141 scoped_refptr<PasswordStore> ps; |
141 #if defined(OS_WIN) | 142 #if defined(OS_WIN) |
142 ps = new PasswordStoreWin(main_thread_runner, | 143 ps = new PasswordStoreWin(main_thread_runner, |
143 db_thread_runner, | 144 db_thread_runner, |
144 login_db.release(), | 145 login_db.release(), |
145 WebDataService::FromBrowserContext(profile)); | 146 WebDataService::FromBrowserContext(profile)); |
146 #elif defined(OS_MACOSX) | 147 #elif defined(OS_MACOSX) |
147 crypto::AppleKeychain* keychain = | 148 crypto::AppleKeychain* keychain = |
148 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain) ? | 149 CommandLine::ForCurrentProcess()->HasSwitch( |
| 150 encryptor::switches::kUseMockKeychain) ? |
149 new crypto::MockAppleKeychain() : new crypto::AppleKeychain(); | 151 new crypto::MockAppleKeychain() : new crypto::AppleKeychain(); |
150 ps = new PasswordStoreMac( | 152 ps = new PasswordStoreMac( |
151 main_thread_runner, db_thread_runner, keychain, login_db.release()); | 153 main_thread_runner, db_thread_runner, keychain, login_db.release()); |
152 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 154 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
153 // For now, we use PasswordStoreDefault. We might want to make a native | 155 // For now, we use PasswordStoreDefault. We might want to make a native |
154 // backend for PasswordStoreX (see below) in the future though. | 156 // backend for PasswordStoreX (see below) in the future though. |
155 ps = new PasswordStoreDefault( | 157 ps = new PasswordStoreDefault( |
156 main_thread_runner, db_thread_runner, login_db.release()); | 158 main_thread_runner, db_thread_runner, login_db.release()); |
157 #elif defined(USE_X11) | 159 #elif defined(USE_X11) |
158 // On POSIX systems, we try to use the "native" password management system of | 160 // On POSIX systems, we try to use the "native" password management system of |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 243 } |
242 | 244 |
243 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( | 245 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( |
244 content::BrowserContext* context) const { | 246 content::BrowserContext* context) const { |
245 return chrome::GetBrowserContextRedirectedInIncognito(context); | 247 return chrome::GetBrowserContextRedirectedInIncognito(context); |
246 } | 248 } |
247 | 249 |
248 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { | 250 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { |
249 return true; | 251 return true; |
250 } | 252 } |
OLD | NEW |