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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 months 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"
11 #include "chrome/browser/password_manager/password_manager_util.h" 11 #include "chrome/browser/password_manager/password_manager_util.h"
12 #include "chrome/browser/password_manager/sync_metrics.h" 12 #include "chrome/browser/password_manager/sync_metrics.h"
13 #include "chrome/browser/profiles/incognito_helpers.h" 13 #include "chrome/browser/profiles/incognito_helpers.h"
14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/glue/sync_start_util.h" 15 #include "chrome/browser/sync/glue/sync_start_util.h"
15 #include "chrome/browser/webdata/web_data_service_factory.h" 16 #include "chrome/browser/webdata/web_data_service_factory.h"
16 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
19 #include "components/keyed_service/content/browser_context_dependency_manager.h" 20 #include "components/keyed_service/content/browser_context_dependency_manager.h"
20 #include "components/os_crypt/os_crypt_switches.h" 21 #include "components/os_crypt/os_crypt_switches.h"
21 #include "components/password_manager/core/browser/login_database.h" 22 #include "components/password_manager/core/browser/login_database.h"
22 #include "components/password_manager/core/browser/password_store.h" 23 #include "components/password_manager/core/browser/password_store.h"
23 #include "components/password_manager/core/browser/password_store_default.h" 24 #include "components/password_manager/core/browser/password_store_default.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 105 }
105 106
106 void PasswordStoreService::Shutdown() { 107 void PasswordStoreService::Shutdown() {
107 if (password_store_.get()) 108 if (password_store_.get())
108 password_store_->Shutdown(); 109 password_store_->Shutdown();
109 } 110 }
110 111
111 // static 112 // static
112 scoped_refptr<PasswordStore> PasswordStoreFactory::GetForProfile( 113 scoped_refptr<PasswordStore> PasswordStoreFactory::GetForProfile(
113 Profile* profile, 114 Profile* profile,
114 Profile::ServiceAccessType sat) { 115 ServiceAccessType sat) {
115 if (sat == Profile::IMPLICIT_ACCESS && profile->IsOffTheRecord()) { 116 if (sat == ServiceAccessType::IMPLICIT_ACCESS && profile->IsOffTheRecord()) {
116 NOTREACHED() << "This profile is OffTheRecord"; 117 NOTREACHED() << "This profile is OffTheRecord";
117 return NULL; 118 return NULL;
118 } 119 }
119 120
120 PasswordStoreFactory* factory = GetInstance(); 121 PasswordStoreFactory* factory = GetInstance();
121 PasswordStoreService* service = static_cast<PasswordStoreService*>( 122 PasswordStoreService* service = static_cast<PasswordStoreService*>(
122 factory->GetServiceForBrowserContext(profile, true)); 123 factory->GetServiceForBrowserContext(profile, true));
123 if (!service) 124 if (!service)
124 return NULL; 125 return NULL;
125 return service->GetPasswordStore(); 126 return service->GetPasswordStore();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( 187 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner(
187 content::BrowserThread::GetMessageLoopProxyForThread( 188 content::BrowserThread::GetMessageLoopProxyForThread(
188 content::BrowserThread::DB)); 189 content::BrowserThread::DB));
189 190
190 scoped_refptr<PasswordStore> ps; 191 scoped_refptr<PasswordStore> ps;
191 #if defined(OS_WIN) 192 #if defined(OS_WIN)
192 ps = new PasswordStoreWin(main_thread_runner, 193 ps = new PasswordStoreWin(main_thread_runner,
193 db_thread_runner, 194 db_thread_runner,
194 login_db.release(), 195 login_db.release(),
195 WebDataServiceFactory::GetPasswordWebDataForProfile( 196 WebDataServiceFactory::GetPasswordWebDataForProfile(
196 profile, Profile::EXPLICIT_ACCESS)); 197 profile, ServiceAccessType::EXPLICIT_ACCESS));
197 #elif defined(OS_MACOSX) 198 #elif defined(OS_MACOSX)
198 crypto::AppleKeychain* keychain = 199 crypto::AppleKeychain* keychain =
199 base::CommandLine::ForCurrentProcess()->HasSwitch( 200 base::CommandLine::ForCurrentProcess()->HasSwitch(
200 os_crypt::switches::kUseMockKeychain) 201 os_crypt::switches::kUseMockKeychain)
201 ? new crypto::MockAppleKeychain() 202 ? new crypto::MockAppleKeychain()
202 : new crypto::AppleKeychain(); 203 : new crypto::AppleKeychain();
203 ps = new PasswordStoreMac( 204 ps = new PasswordStoreMac(
204 main_thread_runner, db_thread_runner, keychain, login_db.release()); 205 main_thread_runner, db_thread_runner, keychain, login_db.release());
205 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) 206 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
206 // For now, we use PasswordStoreDefault. We might want to make a native 207 // For now, we use PasswordStoreDefault. We might want to make a native
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 295 }
295 296
296 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( 297 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse(
297 content::BrowserContext* context) const { 298 content::BrowserContext* context) const {
298 return chrome::GetBrowserContextRedirectedInIncognito(context); 299 return chrome::GetBrowserContextRedirectedInIncognito(context);
299 } 300 }
300 301
301 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { 302 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const {
302 return true; 303 return true;
303 } 304 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_factory.h ('k') | chrome/browser/predictors/autocomplete_action_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698