| 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/browser/webdata/web_data_service.h" | 14 #include "chrome/browser/webdata/web_data_service.h" |
| 15 #include "chrome/browser/webdata/web_data_service_factory.h" | 15 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 | 19 |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include "chrome/browser/password_manager/password_store_win.h" | 21 #include "chrome/browser/password_manager/password_store_win.h" |
| 22 #elif defined(OS_MACOSX) | 22 #elif defined(OS_MACOSX) |
| 23 #include "chrome/browser/password_manager/password_store_mac.h" | 23 #include "chrome/browser/password_manager/password_store_mac.h" |
| 24 #include "crypto/keychain_mac.h" | 24 #include "crypto/apple_keychain.h" |
| 25 #include "crypto/mock_keychain_mac.h" | 25 #include "crypto/mock_apple_keychain.h" |
| 26 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 26 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 27 // Don't do anything. We're going to use the default store. | 27 // Don't do anything. We're going to use the default store. |
| 28 #elif defined(OS_POSIX) | 28 #elif defined(OS_POSIX) |
| 29 #include "base/nix/xdg_util.h" | 29 #include "base/nix/xdg_util.h" |
| 30 #if defined(USE_GNOME_KEYRING) | 30 #if defined(USE_GNOME_KEYRING) |
| 31 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 31 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 32 #endif | 32 #endif |
| 33 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" | 33 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
| 34 #include "chrome/browser/password_manager/password_store_x.h" | 34 #include "chrome/browser/password_manager/password_store_x.h" |
| 35 #endif | 35 #endif |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 delete login_db; | 108 delete login_db; |
| 109 return NULL; | 109 return NULL; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
| 113 ps = new PasswordStoreWin( | 113 ps = new PasswordStoreWin( |
| 114 login_db, profile, | 114 login_db, profile, |
| 115 WebDataServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS)); | 115 WebDataServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS)); |
| 116 #elif defined(OS_MACOSX) | 116 #elif defined(OS_MACOSX) |
| 117 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { | 117 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { |
| 118 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db); | 118 ps = new PasswordStoreMac(new crypto::MockAppleKeychain(), login_db); |
| 119 } else { | 119 } else { |
| 120 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db); | 120 ps = new PasswordStoreMac(new crypto::AppleKeychain(), login_db); |
| 121 } | 121 } |
| 122 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 122 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 123 // For now, we use PasswordStoreDefault. We might want to make a native | 123 // For now, we use PasswordStoreDefault. We might want to make a native |
| 124 // backend for PasswordStoreX (see below) in the future though. | 124 // backend for PasswordStoreX (see below) in the future though. |
| 125 ps = new PasswordStoreDefault(login_db, profile); | 125 ps = new PasswordStoreDefault(login_db, profile); |
| 126 #elif defined(OS_POSIX) | 126 #elif defined(OS_POSIX) |
| 127 // On POSIX systems, we try to use the "native" password management system of | 127 // On POSIX systems, we try to use the "native" password management system of |
| 128 // the desktop environment currently running, allowing GNOME Keyring in XFCE. | 128 // the desktop environment currently running, allowing GNOME Keyring in XFCE. |
| 129 // (In all cases we fall back on the basic store in case of failure.) | 129 // (In all cases we fall back on the basic store in case of failure.) |
| 130 base::nix::DesktopEnvironment desktop_env; | 130 base::nix::DesktopEnvironment desktop_env; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 #endif | 205 #endif |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { | 208 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { | 212 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { |
| 213 return true; | 213 return true; |
| 214 } | 214 } |
| OLD | NEW |