Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Side by Side Diff: chrome/browser/password_manager/password_store_factory.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 scoped_refptr<PasswordStore> ps; 168 scoped_refptr<PasswordStore> ps;
169 #if defined(OS_WIN) 169 #if defined(OS_WIN)
170 ps = new PasswordStoreWin(main_thread_runner, 170 ps = new PasswordStoreWin(main_thread_runner,
171 db_thread_runner, 171 db_thread_runner,
172 login_db.release(), 172 login_db.release(),
173 WebDataServiceFactory::GetPasswordWebDataForProfile( 173 WebDataServiceFactory::GetPasswordWebDataForProfile(
174 profile, Profile::EXPLICIT_ACCESS)); 174 profile, Profile::EXPLICIT_ACCESS));
175 #elif defined(OS_MACOSX) 175 #elif defined(OS_MACOSX)
176 crypto::AppleKeychain* keychain = 176 crypto::AppleKeychain* keychain =
177 CommandLine::ForCurrentProcess()->HasSwitch( 177 base::CommandLine::ForCurrentProcess()->HasSwitch(
178 os_crypt::switches::kUseMockKeychain) ? 178 os_crypt::switches::kUseMockKeychain)
179 new crypto::MockAppleKeychain() : new crypto::AppleKeychain(); 179 ? new crypto::MockAppleKeychain()
180 : new crypto::AppleKeychain();
180 ps = new PasswordStoreMac( 181 ps = new PasswordStoreMac(
181 main_thread_runner, db_thread_runner, keychain, login_db.release()); 182 main_thread_runner, db_thread_runner, keychain, login_db.release());
182 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) 183 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
183 // For now, we use PasswordStoreDefault. We might want to make a native 184 // For now, we use PasswordStoreDefault. We might want to make a native
184 // backend for PasswordStoreX (see below) in the future though. 185 // backend for PasswordStoreX (see below) in the future though.
185 ps = new password_manager::PasswordStoreDefault( 186 ps = new password_manager::PasswordStoreDefault(
186 main_thread_runner, db_thread_runner, login_db.release()); 187 main_thread_runner, db_thread_runner, login_db.release());
187 #elif defined(USE_X11) 188 #elif defined(USE_X11)
188 // On POSIX systems, we try to use the "native" password management system of 189 // On POSIX systems, we try to use the "native" password management system of
189 // the desktop environment currently running, allowing GNOME Keyring in XFCE. 190 // the desktop environment currently running, allowing GNOME Keyring in XFCE.
190 // (In all cases we fall back on the basic store in case of failure.) 191 // (In all cases we fall back on the basic store in case of failure.)
191 base::nix::DesktopEnvironment desktop_env; 192 base::nix::DesktopEnvironment desktop_env;
192 std::string store_type = 193 std::string store_type =
193 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 194 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
194 switches::kPasswordStore); 195 switches::kPasswordStore);
195 if (store_type == "kwallet") { 196 if (store_type == "kwallet") {
196 desktop_env = base::nix::DESKTOP_ENVIRONMENT_KDE4; 197 desktop_env = base::nix::DESKTOP_ENVIRONMENT_KDE4;
197 } else if (store_type == "gnome") { 198 } else if (store_type == "gnome") {
198 desktop_env = base::nix::DESKTOP_ENVIRONMENT_GNOME; 199 desktop_env = base::nix::DESKTOP_ENVIRONMENT_GNOME;
199 } else if (store_type == "basic") { 200 } else if (store_type == "basic") {
200 desktop_env = base::nix::DESKTOP_ENVIRONMENT_OTHER; 201 desktop_env = base::nix::DESKTOP_ENVIRONMENT_OTHER;
201 } else { 202 } else {
202 // Detect the store to use automatically. 203 // Detect the store to use automatically.
203 scoped_ptr<base::Environment> env(base::Environment::Create()); 204 scoped_ptr<base::Environment> env(base::Environment::Create());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 272 }
272 273
273 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( 274 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse(
274 content::BrowserContext* context) const { 275 content::BrowserContext* context) const {
275 return chrome::GetBrowserContextRedirectedInIncognito(context); 276 return chrome::GetBrowserContextRedirectedInIncognito(context);
276 } 277 }
277 278
278 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { 279 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const {
279 return true; 280 return true;
280 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698