1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_PERSONALIZATION_SECTION_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_PERSONALIZATION_SECTION_H_
7 
8 #include "base/values.h"
9 #include "chrome/browser/ui/webui/settings/chromeos/os_settings_section.h"
10 #include "components/prefs/pref_change_registrar.h"
11 
12 class PrefService;
13 
14 namespace content {
15 class WebUIDataSource;
16 }  // namespace content
17 
18 namespace chromeos {
19 namespace settings {
20 
21 class SearchTagRegistry;
22 
23 // Provides UI strings and search tags for Personalization settings. Search tags
24 // are only added when not in guest mode, and Ambient mode settings are added
25 // depending on whether the feature is allowed and enabled.
26 class PersonalizationSection : public OsSettingsSection {
27  public:
28   PersonalizationSection(Profile* profile,
29                          SearchTagRegistry* search_tag_registry,
30                          PrefService* pref_service);
31   ~PersonalizationSection() override;
32 
33  private:
34   // OsSettingsSection:
35   void AddLoadTimeData(content::WebUIDataSource* html_source) override;
36   void AddHandlers(content::WebUI* web_ui) override;
37   int GetSectionNameMessageId() const override;
38   mojom::Section GetSection() const override;
39   mojom::SearchResultIcon GetSectionIcon() const override;
40   std::string GetSectionPath() const override;
41   bool LogMetric(mojom::Setting setting, base::Value& value) const override;
42   void RegisterHierarchy(HierarchyGenerator* generator) const override;
43 
44   // ash::AmbientModeService::Observer:
45   void OnAmbientModeEnabledStateChanged();
46 
47   PrefService* pref_service_;
48   PrefChangeRegistrar pref_change_registrar_;
49 };
50 
51 }  // namespace settings
52 }  // namespace chromeos
53 
54 #endif  // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_PERSONALIZATION_SECTION_H_
55