-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
quick_unlock_factory.h
63 lines (46 loc) · 2.13 KB
/
quick_unlock_factory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_LOGIN_QUICK_UNLOCK_QUICK_UNLOCK_FACTORY_H_
#define CHROME_BROWSER_ASH_LOGIN_QUICK_UNLOCK_QUICK_UNLOCK_FACTORY_H_
#include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile_keyed_service_factory.h"
#include "chromeos/ash/services/auth_factor_config/chrome_browser_delegates.h"
#include "components/account_id/account_id.h"
class Profile;
namespace user_manager {
class User;
}
namespace ash {
namespace quick_unlock {
class QuickUnlockStorage;
// Singleton that owns all QuickUnlockStorage instances and associates them with
// Profiles. Listens for the Profile's destruction notification and cleans up
// the associated QuickUnlockStorage.
class QuickUnlockFactory : public ProfileKeyedServiceFactory {
public:
// Returns the QuickUnlockStorage instance for `profile`.
static QuickUnlockStorage* GetForProfile(Profile* profile);
// Helper method that finds the QuickUnlockStorage instance for `user`. This
// returns GetForProfile with the profile associated with `user`.
static QuickUnlockStorage* GetForUser(const user_manager::User* user);
// Helper method that returns the QuickUnlockStorage instance for
// `account_id`. This returns GetForProfile with the profile associated with
// `account_id`.
static QuickUnlockStorage* GetForAccountId(const AccountId& account_id);
static QuickUnlockFactory* GetInstance();
// Returns a delegate to QuickUnlockStorage.
static ash::auth::QuickUnlockStorageDelegate& GetDelegate();
QuickUnlockFactory(const QuickUnlockFactory&) = delete;
QuickUnlockFactory& operator=(const QuickUnlockFactory&) = delete;
private:
friend struct base::DefaultSingletonTraits<QuickUnlockFactory>;
QuickUnlockFactory();
~QuickUnlockFactory() override;
// BrowserContextKeyedServiceFactory:
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
};
} // namespace quick_unlock
} // namespace ash
#endif // CHROME_BROWSER_ASH_LOGIN_QUICK_UNLOCK_QUICK_UNLOCK_FACTORY_H_