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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
// Copyright 2020 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_UI_WEBUI_ASH_SETTINGS_PAGES_PEOPLE_PEOPLE_SECTION_H_
#define CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_PAGES_PEOPLE_PEOPLE_SECTION_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/values.h"
#include "chrome/browser/ash/auth/legacy_fingerprint_engine.h"
#include "chrome/browser/ui/webui/ash/settings/pages/os_settings_section.h"
#include "chromeos/ash/components/login/auth/auth_performer.h"
#include "components/account_manager_core/account.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "components/account_manager_core/chromeos/account_manager.h"
#include "components/prefs/pref_change_registrar.h"
class PrefService;
class Profile;
namespace content {
class WebUIDataSource;
} // namespace content
namespace signin {
class IdentityManager;
} // namespace signin
namespace ash {
class AccountAppsAvailability;
namespace settings {
class SearchTagRegistry;
// Provides UI strings and search tags for People settings. Search tags are only
// added for non-guest sessions.
//
// Fingerprint and Parental Controls search tags are only shown if they are
// allowed by policy/flags. Different sets of Sync tags are shown depending on
// whether the feature is enabed or disabled.
class PeopleSection : public OsSettingsSection,
public account_manager::AccountManagerFacade::Observer {
public:
PeopleSection(Profile* profile,
SearchTagRegistry* search_tag_registry,
signin::IdentityManager* identity_manager,
PrefService* pref_service);
~PeopleSection() override;
// OsSettingsSection:
void AddLoadTimeData(content::WebUIDataSource* html_source) override;
void AddHandlers(content::WebUI* web_ui) override;
int GetSectionNameMessageId() const override;
chromeos::settings::mojom::Section GetSection() const override;
mojom::SearchResultIcon GetSectionIcon() const override;
const char* GetSectionPath() const override;
bool LogMetric(chromeos::settings::mojom::Setting setting,
base::Value& value) const override;
void RegisterHierarchy(HierarchyGenerator* generator) const override;
private:
// AccountManagerFacade::Observer:
void OnAccountUpserted(const ::account_manager::Account& account) override;
void OnAccountRemoved(const ::account_manager::Account& account) override;
void OnAuthErrorChanged(const account_manager::AccountKey& account,
const GoogleServiceAuthError& error) override;
bool AreFingerprintSettingsAllowed();
void FetchAccounts();
void UpdateAccountManagerSearchTags(
const std::vector<::account_manager::Account>& accounts);
raw_ptr<account_manager::AccountManager> account_manager_ = nullptr;
raw_ptr<account_manager::AccountManagerFacade> account_manager_facade_ =
nullptr;
raw_ptr<AccountAppsAvailability> account_apps_availability_ = nullptr;
raw_ptr<signin::IdentityManager> identity_manager_;
raw_ptr<PrefService> pref_service_;
// An observer for `AccountManagerFacade`. Automatically deregisters when
// `this` is destructed.
base::ScopedObservation<account_manager::AccountManagerFacade,
account_manager::AccountManagerFacade::Observer>
account_manager_facade_observation_{this};
AuthPerformer auth_performer_;
LegacyFingerprintEngine fp_engine_;
base::WeakPtrFactory<PeopleSection> weak_factory_{this};
};
} // namespace settings
} // namespace ash
#endif // CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_PAGES_PEOPLE_PEOPLE_SECTION_H_
|