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

Side by Side Diff: chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.cc

Issue 2715823004: Add FingerprintUnlock KeyedService for each profile (Closed)
Patch Set: rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/chromeos/login/quick_unlock/pin_storage_factory.h" 5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
6 6
7 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h" 8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "components/user_manager/user.h" 11 #include "components/user_manager/user.h"
12 #include "components/user_manager/user_manager.h" 12 #include "components/user_manager/user_manager.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 namespace quick_unlock { 15 namespace quick_unlock {
16 16
17 // static 17 // static
18 PinStorage* PinStorageFactory::GetForProfile(Profile* profile) { 18 QuickUnlockStorage* QuickUnlockFactory::GetForProfile(Profile* profile) {
19 return static_cast<PinStorage*>( 19 return static_cast<QuickUnlockStorage*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true)); 20 GetInstance()->GetServiceForBrowserContext(profile, true));
21 } 21 }
22 22
23 // static 23 // static
24 PinStorage* PinStorageFactory::GetForUser(const user_manager::User* user) { 24 QuickUnlockStorage* QuickUnlockFactory::GetForUser(
25 const user_manager::User* user) {
25 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); 26 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
26 if (!profile) 27 if (!profile)
27 return nullptr; 28 return nullptr;
28 29
29 return GetForProfile(profile); 30 return GetForProfile(profile);
30 } 31 }
31 32
32 // static 33 // static
33 PinStorage* PinStorageFactory::GetForAccountId(const AccountId& account_id) { 34 QuickUnlockStorage* QuickUnlockFactory::GetForAccountId(
35 const AccountId& account_id) {
34 const user_manager::User* user = 36 const user_manager::User* user =
35 user_manager::UserManager::Get()->FindUser(account_id); 37 user_manager::UserManager::Get()->FindUser(account_id);
36 if (!user) 38 if (!user)
37 return nullptr; 39 return nullptr;
38 40
39 return GetForUser(user); 41 return GetForUser(user);
40 } 42 }
41 43
42 // static 44 // static
43 PinStorageFactory* PinStorageFactory::GetInstance() { 45 QuickUnlockFactory* QuickUnlockFactory::GetInstance() {
44 return base::Singleton<PinStorageFactory>::get(); 46 return base::Singleton<QuickUnlockFactory>::get();
45 } 47 }
46 48
47 PinStorageFactory::PinStorageFactory() 49 QuickUnlockFactory::QuickUnlockFactory()
48 : BrowserContextKeyedServiceFactory( 50 : BrowserContextKeyedServiceFactory(
49 "PinStorageFactory", 51 "QuickUnlockFactory",
50 BrowserContextDependencyManager::GetInstance()) {} 52 BrowserContextDependencyManager::GetInstance()) {}
51 53
52 PinStorageFactory::~PinStorageFactory() {} 54 QuickUnlockFactory::~QuickUnlockFactory() {}
53 55
54 KeyedService* PinStorageFactory::BuildServiceInstanceFor( 56 KeyedService* QuickUnlockFactory::BuildServiceInstanceFor(
55 content::BrowserContext* context) const { 57 content::BrowserContext* context) const {
56 return new PinStorage(Profile::FromBrowserContext(context)->GetPrefs()); 58 return new QuickUnlockStorage(
59 Profile::FromBrowserContext(context)->GetPrefs());
57 } 60 }
58 61
59 } // namespace quick_unlock 62 } // namespace quick_unlock
60 } // namespace chromeos 63 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698