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