blob: 8e189e8e370a450b6cb24f35a77a5dc3dc6da1a6 (
plain)
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
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SIGNIN_SIGNIN_PROFILE_ATTRIBUTES_UPDATER_H_
#define CHROME_BROWSER_SIGNIN_SIGNIN_PROFILE_ATTRIBUTES_UPDATER_H_
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
class ProfileAttributesStorage;
// This class listens to various signin events and updates the signin-related
// fields of ProfileAttributes.
class SigninProfileAttributesUpdater
: public KeyedService,
public signin::IdentityManager::Observer {
public:
SigninProfileAttributesUpdater(
signin::IdentityManager* identity_manager,
ProfileAttributesStorage* profile_attributes_storage,
const base::FilePath& profile_path,
PrefService* prefs);
SigninProfileAttributesUpdater(const SigninProfileAttributesUpdater&) =
delete;
SigninProfileAttributesUpdater& operator=(
const SigninProfileAttributesUpdater&) = delete;
~SigninProfileAttributesUpdater() override;
private:
// KeyedService:
void Shutdown() override;
// Updates the profile attributes on signin and signout events.
void UpdateProfileAttributes();
// IdentityManager::Observer:
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override;
raw_ptr<signin::IdentityManager> identity_manager_;
raw_ptr<ProfileAttributesStorage> profile_attributes_storage_;
const base::FilePath profile_path_;
raw_ptr<PrefService> prefs_;
base::ScopedObservation<signin::IdentityManager,
signin::IdentityManager::Observer>
identity_manager_observation_{this};
};
#endif // CHROME_BROWSER_SIGNIN_SIGNIN_PROFILE_ATTRIBUTES_UPDATER_H_
|