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" | |
13 #include "chrome/browser/webdata/web_data_service_factory.h" | 12 #include "chrome/browser/webdata/web_data_service_factory.h" |
14 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
17 #include "components/os_crypt/os_crypt_switches.h" | 16 #include "components/os_crypt/os_crypt_switches.h" |
18 #include "components/password_manager/core/browser/login_database.h" | 17 #include "components/password_manager/core/browser/login_database.h" |
19 #include "components/password_manager/core/browser/password_store.h" | 18 #include "components/password_manager/core/browser/password_store.h" |
20 #include "components/password_manager/core/browser/password_store_default.h" | 19 #include "components/password_manager/core/browser/password_store_default.h" |
21 #include "components/password_manager/core/common/password_manager_pref_names.h" | 20 #include "components/password_manager/core/common/password_manager_pref_names.h" |
22 #include "components/pref_registry/pref_registry_syncable.h" | 21 #include "components/pref_registry/pref_registry_syncable.h" |
23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
24 | 23 |
25 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
26 #include "chrome/browser/password_manager/password_store_win.h" | 25 #include "chrome/browser/password_manager/password_store_win.h" |
| 26 #include "chrome/browser/webdata/password_web_data_service_win.h" |
27 #elif defined(OS_MACOSX) | 27 #elif defined(OS_MACOSX) |
28 #include "chrome/browser/password_manager/password_store_mac.h" | 28 #include "chrome/browser/password_manager/password_store_mac.h" |
29 #include "crypto/apple_keychain.h" | 29 #include "crypto/apple_keychain.h" |
30 #include "crypto/mock_apple_keychain.h" | 30 #include "crypto/mock_apple_keychain.h" |
31 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 31 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
32 // Don't do anything. We're going to use the default store. | 32 // Don't do anything. We're going to use the default store. |
33 #elif defined(USE_X11) | 33 #elif defined(USE_X11) |
34 #include "base/nix/xdg_util.h" | 34 #include "base/nix/xdg_util.h" |
35 #if defined(USE_GNOME_KEYRING) | 35 #if defined(USE_GNOME_KEYRING) |
36 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 36 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 base::MessageLoopProxy::current()); | 141 base::MessageLoopProxy::current()); |
142 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( | 142 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( |
143 content::BrowserThread::GetMessageLoopProxyForThread( | 143 content::BrowserThread::GetMessageLoopProxyForThread( |
144 content::BrowserThread::DB)); | 144 content::BrowserThread::DB)); |
145 | 145 |
146 scoped_refptr<PasswordStore> ps; | 146 scoped_refptr<PasswordStore> ps; |
147 #if defined(OS_WIN) | 147 #if defined(OS_WIN) |
148 ps = new PasswordStoreWin(main_thread_runner, | 148 ps = new PasswordStoreWin(main_thread_runner, |
149 db_thread_runner, | 149 db_thread_runner, |
150 login_db.release(), | 150 login_db.release(), |
151 WebDataService::FromBrowserContext(profile)); | 151 WebDataServiceFactory::GetPasswordWebDataForProfile( |
| 152 profile, Profile::EXPLICIT_ACCESS)); |
152 #elif defined(OS_MACOSX) | 153 #elif defined(OS_MACOSX) |
153 crypto::AppleKeychain* keychain = | 154 crypto::AppleKeychain* keychain = |
154 CommandLine::ForCurrentProcess()->HasSwitch( | 155 CommandLine::ForCurrentProcess()->HasSwitch( |
155 os_crypt::switches::kUseMockKeychain) ? | 156 os_crypt::switches::kUseMockKeychain) ? |
156 new crypto::MockAppleKeychain() : new crypto::AppleKeychain(); | 157 new crypto::MockAppleKeychain() : new crypto::AppleKeychain(); |
157 ps = new PasswordStoreMac( | 158 ps = new PasswordStoreMac( |
158 main_thread_runner, db_thread_runner, keychain, login_db.release()); | 159 main_thread_runner, db_thread_runner, keychain, login_db.release()); |
159 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 160 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
160 // For now, we use PasswordStoreDefault. We might want to make a native | 161 // For now, we use PasswordStoreDefault. We might want to make a native |
161 // backend for PasswordStoreX (see below) in the future though. | 162 // backend for PasswordStoreX (see below) in the future though. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 248 } |
248 | 249 |
249 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( | 250 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( |
250 content::BrowserContext* context) const { | 251 content::BrowserContext* context) const { |
251 return chrome::GetBrowserContextRedirectedInIncognito(context); | 252 return chrome::GetBrowserContextRedirectedInIncognito(context); |
252 } | 253 } |
253 | 254 |
254 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { | 255 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { |
255 return true; | 256 return true; |
256 } | 257 } |
OLD | NEW |