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_CROSTINI_SECTION_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CROSTINI_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 namespace content { 13 class WebUIDataSource; 14 } // namespace content 15 16 namespace chromeos { 17 namespace settings { 18 19 class SearchTagRegistry; 20 21 // Provides UI strings and search tags for Crostini settings. Search tags are 22 // only added if Crostini is available, and subpage search tags are added only 23 // when those subpages are available. 24 class CrostiniSection : public OsSettingsSection { 25 public: 26 CrostiniSection(Profile* profile, 27 SearchTagRegistry* search_tag_registry, 28 PrefService* pref_service); 29 ~CrostiniSection() override; 30 31 private: 32 // OsSettingsSection: 33 void AddLoadTimeData(content::WebUIDataSource* html_source) override; 34 void AddHandlers(content::WebUI* web_ui) override; 35 int GetSectionNameMessageId() const override; 36 mojom::Section GetSection() const override; 37 mojom::SearchResultIcon GetSectionIcon() const override; 38 std::string GetSectionPath() const override; 39 bool LogMetric(mojom::Setting setting, base::Value& value) const override; 40 void RegisterHierarchy(HierarchyGenerator* generator) const override; 41 42 bool IsCrostiniAllowed(); 43 bool IsExportImportAllowed(); 44 bool IsContainerUpgradeAllowed(); 45 bool IsPortForwardingAllowed(); 46 void UpdateSearchTags(); 47 48 PrefService* pref_service_; 49 PrefChangeRegistrar pref_change_registrar_; 50 }; 51 52 } // namespace settings 53 } // namespace chromeos 54 55 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CROSTINI_SECTION_H_ 56