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" |
11 #include "chrome/browser/password_manager/password_store_default.h" | 11 #include "chrome/browser/password_manager/password_store_default.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile_dependency_manager.h" | 13 #include "chrome/browser/profiles/profile_dependency_manager.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 "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #include "chrome/browser/password_manager/password_store_win.h" | 19 #include "chrome/browser/password_manager/password_store_win.h" |
20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
21 #include "chrome/browser/keychain_mac.h" | |
22 #include "chrome/browser/mock_keychain_mac.h" | |
23 #include "chrome/browser/password_manager/password_store_mac.h" | 21 #include "chrome/browser/password_manager/password_store_mac.h" |
| 22 #include "crypto/keychain_mac.h" |
| 23 #include "crypto/mock_keychain_mac.h" |
24 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 24 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
25 // Don't do anything. We're going to use the default store. | 25 // Don't do anything. We're going to use the default store. |
26 #elif defined(OS_POSIX) | 26 #elif defined(OS_POSIX) |
27 #include "base/nix/xdg_util.h" | 27 #include "base/nix/xdg_util.h" |
28 #if defined(USE_GNOME_KEYRING) | 28 #if defined(USE_GNOME_KEYRING) |
29 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 29 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
30 #endif | 30 #endif |
31 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" | 31 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
32 #include "chrome/browser/password_manager/password_store_x.h" | 32 #include "chrome/browser/password_manager/password_store_x.h" |
33 #endif | 33 #endif |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 LOG(ERROR) << "Could not initialize login database."; | 104 LOG(ERROR) << "Could not initialize login database."; |
105 delete login_db; | 105 delete login_db; |
106 return NULL; | 106 return NULL; |
107 } | 107 } |
108 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
109 ps = new PasswordStoreWin( | 109 ps = new PasswordStoreWin( |
110 login_db, profile, | 110 login_db, profile, |
111 profile->GetWebDataService(Profile::IMPLICIT_ACCESS)); | 111 profile->GetWebDataService(Profile::IMPLICIT_ACCESS)); |
112 #elif defined(OS_MACOSX) | 112 #elif defined(OS_MACOSX) |
113 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { | 113 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { |
114 ps = new PasswordStoreMac(new MockKeychain(), login_db); | 114 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db); |
115 } else { | 115 } else { |
116 ps = new PasswordStoreMac(new MacKeychain(), login_db); | 116 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db); |
117 } | 117 } |
118 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 118 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
119 // For now, we use PasswordStoreDefault. We might want to make a native | 119 // For now, we use PasswordStoreDefault. We might want to make a native |
120 // backend for PasswordStoreX (see below) in the future though. | 120 // backend for PasswordStoreX (see below) in the future though. |
121 ps = new PasswordStoreDefault( | 121 ps = new PasswordStoreDefault( |
122 login_db, profile, profile->GetWebDataService(Profile::IMPLICIT_ACCESS)); | 122 login_db, profile, profile->GetWebDataService(Profile::IMPLICIT_ACCESS)); |
123 #elif defined(OS_POSIX) | 123 #elif defined(OS_POSIX) |
124 // On POSIX systems, we try to use the "native" password management system of | 124 // On POSIX systems, we try to use the "native" password management system of |
125 // the desktop environment currently running, allowing GNOME Keyring in XFCE. | 125 // the desktop environment currently running, allowing GNOME Keyring in XFCE. |
126 // (In all cases we fall back on the basic store in case of failure.) | 126 // (In all cases we fall back on the basic store in case of failure.) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 #endif | 203 #endif |
204 } | 204 } |
205 | 205 |
206 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { | 206 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { |
207 return true; | 207 return true; |
208 } | 208 } |
209 | 209 |
210 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { | 210 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { |
211 return true; | 211 return true; |
212 } | 212 } |
OLD | NEW |