Commit 5f279cea authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS Settings] Add AboutSection search tags

Generated by running a script to parse go/cros-settings-search-tags.

This CL also migrates AboutHandler to this section and eliminates the
static Create() function which creates the handler as well as adding
loadTimeData. The loadTimeData is moved to AboutSection as well as
settings_localized_strings_provider.cc, and several strings which were
unused by browser settings are now only added to OS settings instead of
to both.

Bug: 1076268
Change-Id: I6ea6ce914533166851a51c3d2771f3f9d72d3a07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2185850
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766540}
parent fb4287fa
...@@ -832,5 +832,19 @@ ...@@ -832,5 +832,19 @@
</message> </message>
<!-- About Chrome OS section. --> <!-- About Chrome OS section. -->
<message name="IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS" desc="Text for search result item which, when clicked, navigates the user to about Chrome OS settings, which gives information about the current Chrome OS version.">
About Chrome OS
</message>
<message name="IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_VERSION" desc="Text for search result item which, when clicked, navigates the user to about Chrome OS settings, which gives information about the current Chrome OS version.">
Chrome OS version
</message>
<message name="IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_DETAILED_BUILD" desc="Text for search result item which, when clicked, navigates the user to detailed build information settings. Alternate phrase for: 'Device version'">
Detailed build information
</message>
<message name="IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_DETAILED_BUILD_ALT1" desc="Text for search result item which, when clicked, navigates the user to detailed build information settings. Alternate phrase for: 'Detailed build information'">
Device version
</message>
<message name="IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_CHANNEL" desc="Text for search result item which, when clicked, navigates the user to detailed build information settings, with a button to change to another channel (stable vs. beta vs. dev).">
Change channel
</message>
</grit-part> </grit-part>
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/i18n/message_formatter.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
...@@ -21,8 +20,6 @@ ...@@ -21,8 +20,6 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -32,13 +29,11 @@ ...@@ -32,13 +29,11 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h" #include "chrome/browser/upgrade_detector/upgrade_detector.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
...@@ -46,9 +41,7 @@ ...@@ -46,9 +41,7 @@
#include "components/google/core/common/google_util.h" #include "components/google/core/common/google_util.h"
#include "components/policy/core/common/policy_namespace.h" #include "components/policy/core/common/policy_namespace.h"
#include "components/policy/policy_constants.h" #include "components/policy/policy_constants.h"
#include "components/strings/grit/components_chromium_strings.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
...@@ -105,21 +98,6 @@ struct RegulatoryLabel { ...@@ -105,21 +98,6 @@ struct RegulatoryLabel {
const std::string image_url; const std::string image_url;
}; };
// Returns the link to the safety info for the device (if it exists).
std::string GetSafetyInfoLink() {
const std::vector<std::string> board =
base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (board[0] == "nocturne") {
return chrome::kChromeUISafetyPixelSlateURL;
}
if (board[0] == "eve" || board[0] == "atlas") {
return chrome::kChromeUISafetyPixelbookURL;
}
return std::string();
}
// Returns message that informs user that for update it's better to // Returns message that informs user that for update it's better to
// connect to a network of one of the allowed types. // connect to a network of one of the allowed types.
base::string16 GetAllowedConnectionTypesMessage() { base::string16 GetAllowedConnectionTypesMessage() {
...@@ -292,86 +270,6 @@ AboutHandler::~AboutHandler() { ...@@ -292,86 +270,6 @@ AboutHandler::~AboutHandler() {
UpgradeDetector::GetInstance()->RemoveObserver(this); UpgradeDetector::GetInstance()->RemoveObserver(this);
} }
AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source,
Profile* profile) {
html_source->AddString(
"aboutBrowserVersion",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_ABOUT_PAGE_BROWSER_VERSION,
base::UTF8ToUTF16(version_info::GetVersionNumber()),
l10n_util::GetStringUTF16(version_info::IsOfficialBuild()
? IDS_VERSION_UI_OFFICIAL
: IDS_VERSION_UI_UNOFFICIAL),
base::UTF8ToUTF16(chrome::GetChannelName()),
l10n_util::GetStringUTF16(sizeof(void*) == 8
? IDS_VERSION_UI_64BIT
: IDS_VERSION_UI_32BIT)));
html_source->AddString(
"aboutProductCopyright",
base::i18n::MessageFormatter::FormatWithNumberedArgs(
l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT),
base::Time::Now()));
base::string16 license = l10n_util::GetStringFUTF16(
IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL),
base::ASCIIToUTF16(chrome::kChromeUICreditsURL));
html_source->AddString("aboutProductLicense", license);
html_source->AddBoolean("aboutObsoleteNowOrSoon",
ObsoleteSystem::IsObsoleteNowOrSoon());
html_source->AddBoolean("aboutObsoleteEndOfTheLine",
ObsoleteSystem::IsObsoleteNowOrSoon() &&
ObsoleteSystem::IsEndOfTheLine());
html_source->AddString("aboutObsoleteSystem",
ObsoleteSystem::LocalizedObsoleteString());
html_source->AddString("aboutObsoleteSystemURL",
ObsoleteSystem::GetLinkURL());
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddString("aboutTermsURL", chrome::kChromeUITermsURL);
html_source->AddLocalizedString("aboutProductTos",
IDS_ABOUT_TERMS_OF_SERVICE);
#endif
#if defined(OS_CHROMEOS)
std::string safetyInfoLink = GetSafetyInfoLink();
html_source->AddBoolean("shouldShowSafetyInfo", !safetyInfoLink.empty());
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddString(
"aboutProductSafety",
l10n_util::GetStringUTF16(IDS_ABOUT_SAFETY_INFORMATION));
html_source->AddString("aboutProductSafetyURL",
base::UTF8ToUTF16(safetyInfoLink));
#endif
base::string16 os_license = l10n_util::GetStringFUTF16(
IDS_ABOUT_CROS_VERSION_LICENSE,
base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL));
html_source->AddString("aboutProductOsLicense", os_license);
base::string16 os_with_linux_license = l10n_util::GetStringFUTF16(
IDS_ABOUT_CROS_WITH_LINUX_VERSION_LICENSE,
base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL),
base::ASCIIToUTF16(chrome::kChromeUICrostiniCreditsURL));
html_source->AddString("aboutProductOsWithLinuxLicense",
os_with_linux_license);
html_source->AddBoolean("aboutEnterpriseManaged", IsEnterpriseManaged());
html_source->AddBoolean("aboutIsArcEnabled",
arc::IsArcPlayStoreEnabledForProfile(profile));
html_source->AddBoolean("aboutIsDeveloperMode",
base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kSystemDevMode));
html_source->AddString("endOfLifeMessage",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_ABOUT_PAGE_LAST_UPDATE_MESSAGE,
ui::GetChromeOSDeviceName(),
base::ASCIIToUTF16(chrome::kEolNotificationURL)));
#endif
return new AboutHandler();
}
void AboutHandler::RegisterMessages() { void AboutHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback( web_ui()->RegisterMessageCallback(
"aboutPageReady", base::BindRepeating(&AboutHandler::HandlePageReady, "aboutPageReady", base::BindRepeating(&AboutHandler::HandlePageReady,
......
...@@ -28,13 +28,7 @@ namespace base { ...@@ -28,13 +28,7 @@ namespace base {
class DictionaryValue; class DictionaryValue;
class FilePath; class FilePath;
class ListValue; class ListValue;
} } // namespace base
namespace content {
class WebUIDataSource;
}
class Profile;
namespace settings { namespace settings {
...@@ -45,9 +39,6 @@ class AboutHandler : public settings::SettingsPageUIHandler, ...@@ -45,9 +39,6 @@ class AboutHandler : public settings::SettingsPageUIHandler,
AboutHandler(); AboutHandler();
~AboutHandler() override; ~AboutHandler() override;
static AboutHandler* Create(content::WebUIDataSource* html_source,
Profile* profile);
// WebUIMessageHandler implementation. // WebUIMessageHandler implementation.
void RegisterMessages() override; void RegisterMessages() override;
void OnJavascriptAllowed() override; void OnJavascriptAllowed() override;
......
...@@ -4,18 +4,28 @@ ...@@ -4,18 +4,28 @@
#include "chrome/browser/ui/webui/settings/chromeos/about_section.h" #include "chrome/browser/ui/webui/settings/chromeos/about_section.h"
#include "base/i18n/message_formatter.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "build/branding_buildflags.h" #include "build/branding_buildflags.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/ui/webui/management_ui.h" #include "chrome/browser/ui/webui/management_ui.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"
#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/constants/dbus_switches.h"
#include "components/strings/grit/components_chromium_strings.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/user_manager/user_manager.h" #include "components/user_manager/user_manager.h"
#include "components/version_info/version_info.h"
#include "components/version_ui/version_ui_constants.h" #include "components/version_ui/version_ui_constants.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -28,11 +38,58 @@ namespace { ...@@ -28,11 +38,58 @@ namespace {
const std::vector<SearchConcept>& GetAboutSearchConcepts() { const std::vector<SearchConcept>& GetAboutSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({ static const base::NoDestructor<std::vector<SearchConcept>> tags({
// TODO(khorimoto): Add "About" search concepts. {IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_DETAILED_BUILD,
mojom::kDetailedBuildInfoSubpagePath,
mojom::SearchResultIcon::kChrome,
mojom::SearchResultDefaultRank::kMedium,
mojom::SearchResultType::kSubpage,
{.subpage = mojom::Subpage::kDetailedBuildInfo},
{IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_DETAILED_BUILD_ALT1,
SearchConcept::kAltTagEnd}},
{IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS,
mojom::kAboutChromeOsDetailsSubpagePath,
mojom::SearchResultIcon::kChrome,
mojom::SearchResultDefaultRank::kHigh,
mojom::SearchResultType::kSubpage,
{.subpage = mojom::Subpage::kAboutChromeOsDetails}},
{IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_VERSION,
mojom::kAboutChromeOsDetailsSubpagePath,
mojom::SearchResultIcon::kChrome,
mojom::SearchResultDefaultRank::kMedium,
mojom::SearchResultType::kSubpage,
{.subpage = mojom::Subpage::kAboutChromeOsDetails}},
{IDS_OS_SETTINGS_TAG_ABOUT_CHROME_OS_CHANNEL,
mojom::kDetailedBuildInfoSubpagePath,
mojom::SearchResultIcon::kChrome,
mojom::SearchResultDefaultRank::kHigh,
mojom::SearchResultType::kSetting,
{.setting = mojom::Setting::kChangeChromeChannel}},
}); });
return *tags; return *tags;
} }
// Returns the link to the safety info for the device (if it exists).
std::string GetSafetyInfoLink() {
const std::vector<std::string> board =
base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (board[0] == "nocturne") {
return chrome::kChromeUISafetyPixelSlateURL;
}
if (board[0] == "eve" || board[0] == "atlas") {
return chrome::kChromeUISafetyPixelbookURL;
}
return std::string();
}
// Returns true if the device is enterprise managed, false otherwise.
bool IsEnterpriseManaged() {
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
return connector->IsEnterpriseManaged();
}
bool IsDeviceManaged() { bool IsDeviceManaged() {
policy::BrowserPolicyConnectorChromeOS* connector = policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos(); g_browser_process->platform_part()->browser_policy_connector_chromeos();
...@@ -145,6 +202,70 @@ void AboutSection::AddLoadTimeData(content::WebUIDataSource* html_source) { ...@@ -145,6 +202,70 @@ void AboutSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
user_manager->GetOwnerAccountId().GetUserEmail()); user_manager->GetOwnerAccountId().GetUserEmail());
} }
} }
html_source->AddString(
"aboutBrowserVersion",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_ABOUT_PAGE_BROWSER_VERSION,
base::UTF8ToUTF16(version_info::GetVersionNumber()),
l10n_util::GetStringUTF16(version_info::IsOfficialBuild()
? IDS_VERSION_UI_OFFICIAL
: IDS_VERSION_UI_UNOFFICIAL),
base::UTF8ToUTF16(chrome::GetChannelName()),
l10n_util::GetStringUTF16(sizeof(void*) == 8
? IDS_VERSION_UI_64BIT
: IDS_VERSION_UI_32BIT)));
html_source->AddString(
"aboutProductCopyright",
base::i18n::MessageFormatter::FormatWithNumberedArgs(
l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT),
base::Time::Now()));
base::string16 license = l10n_util::GetStringFUTF16(
IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL),
base::ASCIIToUTF16(chrome::kChromeUICreditsURL));
html_source->AddString("aboutProductLicense", license);
base::string16 os_license = l10n_util::GetStringFUTF16(
IDS_ABOUT_CROS_VERSION_LICENSE,
base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL));
html_source->AddString("aboutProductOsLicense", os_license);
base::string16 os_with_linux_license = l10n_util::GetStringFUTF16(
IDS_ABOUT_CROS_WITH_LINUX_VERSION_LICENSE,
base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL),
base::ASCIIToUTF16(chrome::kChromeUICrostiniCreditsURL));
html_source->AddString("aboutProductOsWithLinuxLicense",
os_with_linux_license);
html_source->AddBoolean("aboutEnterpriseManaged", IsEnterpriseManaged());
html_source->AddBoolean("aboutIsArcEnabled",
arc::IsArcPlayStoreEnabledForProfile(profile()));
html_source->AddBoolean("aboutIsDeveloperMode",
base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kSystemDevMode));
html_source->AddString("endOfLifeMessage",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_ABOUT_PAGE_LAST_UPDATE_MESSAGE,
ui::GetChromeOSDeviceName(),
base::ASCIIToUTF16(chrome::kEolNotificationURL)));
std::string safetyInfoLink = GetSafetyInfoLink();
html_source->AddBoolean("shouldShowSafetyInfo", !safetyInfoLink.empty());
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddString("aboutTermsURL", chrome::kChromeUITermsURL);
html_source->AddLocalizedString("aboutProductTos",
IDS_ABOUT_TERMS_OF_SERVICE);
html_source->AddString(
"aboutProductSafety",
l10n_util::GetStringUTF16(IDS_ABOUT_SAFETY_INFORMATION));
html_source->AddString("aboutProductSafetyURL",
base::UTF8ToUTF16(safetyInfoLink));
#endif
}
void AboutSection::AddHandlers(content::WebUI* web_ui) {
web_ui->AddMessageHandler(std::make_unique<::settings::AboutHandler>());
} }
} // namespace settings } // namespace settings
......
...@@ -23,6 +23,7 @@ class AboutSection : public OsSettingsSection { ...@@ -23,6 +23,7 @@ class AboutSection : public OsSettingsSection {
private: private:
// OsSettingsSection: // OsSettingsSection:
void AddLoadTimeData(content::WebUIDataSource* html_source) override; void AddLoadTimeData(content::WebUIDataSource* html_source) override;
void AddHandlers(content::WebUI* web_ui) override;
}; };
} // namespace settings } // namespace settings
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "chrome/browser/ui/webui/managed_ui_handler.h" #include "chrome/browser/ui/webui/managed_ui_handler.h"
#include "chrome/browser/ui/webui/metrics_handler.h" #include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/plural_string_handler.h" #include "chrome/browser/ui/webui/plural_string_handler.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"
#include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h" #include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h"
...@@ -127,8 +126,6 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) ...@@ -127,8 +126,6 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
std::make_unique<::settings::ProfileInfoHandler>(profile)); std::make_unique<::settings::ProfileInfoHandler>(profile));
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<::settings::ProtocolHandlersHandler>()); std::make_unique<::settings::ProtocolHandlersHandler>());
AddSettingsPageUIHandler(
base::WrapUnique(::settings::AboutHandler::Create(html_source, profile)));
// Add the metrics handler to write uma stats. // Add the metrics handler to write uma stats.
web_ui->AddMessageHandler(std::make_unique<MetricsHandler>()); web_ui->AddMessageHandler(std::make_unique<MetricsHandler>());
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/i18n/message_formatter.h"
#include "base/i18n/number_formatting.h" #include "base/i18n/number_formatting.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h" #include "chrome/browser/profiles/profile_shortcut_manager.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/signin/account_consistency_mode_manager.h"
...@@ -30,6 +32,7 @@ ...@@ -30,6 +32,7 @@
#include "chrome/browser/ui/webui/settings/reset_settings_handler.h" #include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
#include "chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.h" #include "chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.h"
#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -58,11 +61,13 @@ ...@@ -58,11 +61,13 @@
#include "components/password_manager/core/common/password_manager_features.h" #include "components/password_manager/core/common/password_manager_features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/signin/public/base/signin_buildflags.h" #include "components/signin/public/base/signin_buildflags.h"
#include "components/strings/grit/components_chromium_strings.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/subresource_filter/core/browser/subresource_filter_features.h" #include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_utils.h" #include "components/sync/driver/sync_service_utils.h"
#include "components/sync/driver/sync_user_settings.h" #include "components/sync/driver/sync_user_settings.h"
#include "components/version_info/version_info.h"
#include "components/zoom/page_zoom_constants.h" #include "components/zoom/page_zoom_constants.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
...@@ -247,6 +252,45 @@ void AddAboutStrings(content::WebUIDataSource* html_source, Profile* profile) { ...@@ -247,6 +252,45 @@ void AddAboutStrings(content::WebUIDataSource* html_source, Profile* profile) {
#else #else
l10n_util::GetStringUTF16(IDS_SETTINGS_UPGRADE_UP_TO_DATE)); l10n_util::GetStringUTF16(IDS_SETTINGS_UPGRADE_UP_TO_DATE));
#endif #endif
html_source->AddString(
"aboutBrowserVersion",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_ABOUT_PAGE_BROWSER_VERSION,
base::UTF8ToUTF16(version_info::GetVersionNumber()),
l10n_util::GetStringUTF16(version_info::IsOfficialBuild()
? IDS_VERSION_UI_OFFICIAL
: IDS_VERSION_UI_UNOFFICIAL),
base::UTF8ToUTF16(chrome::GetChannelName()),
l10n_util::GetStringUTF16(sizeof(void*) == 8
? IDS_VERSION_UI_64BIT
: IDS_VERSION_UI_32BIT)));
html_source->AddString(
"aboutProductCopyright",
base::i18n::MessageFormatter::FormatWithNumberedArgs(
l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT),
base::Time::Now()));
base::string16 license = l10n_util::GetStringFUTF16(
IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL),
base::ASCIIToUTF16(chrome::kChromeUICreditsURL));
html_source->AddString("aboutProductLicense", license);
html_source->AddBoolean("aboutObsoleteNowOrSoon",
ObsoleteSystem::IsObsoleteNowOrSoon());
html_source->AddBoolean("aboutObsoleteEndOfTheLine",
ObsoleteSystem::IsObsoleteNowOrSoon() &&
ObsoleteSystem::IsEndOfTheLine());
html_source->AddString("aboutObsoleteSystem",
ObsoleteSystem::LocalizedObsoleteString());
html_source->AddString("aboutObsoleteSystemURL",
ObsoleteSystem::GetLinkURL());
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddString("aboutTermsURL", chrome::kChromeUITermsURL);
html_source->AddLocalizedString("aboutProductTos",
IDS_ABOUT_TERMS_OF_SERVICE);
#endif
} }
void AddAppearanceStrings(content::WebUIDataSource* html_source, void AddAppearanceStrings(content::WebUIDataSource* html_source,
......
...@@ -300,8 +300,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -300,8 +300,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
// TODO(crbug.com/1026455): Delete this as part of the SplitSettings cleanup. // TODO(crbug.com/1026455): Delete this as part of the SplitSettings cleanup.
html_source->AddBoolean("showOSSettings", false); html_source->AddBoolean("showOSSettings", false);
AddSettingsPageUIHandler( AddSettingsPageUIHandler(std::make_unique<AboutHandler>());
base::WrapUnique(AboutHandler::Create(html_source, profile)));
AddSettingsPageUIHandler(std::make_unique<ResetSettingsHandler>(profile)); AddSettingsPageUIHandler(std::make_unique<ResetSettingsHandler>(profile));
// Add a handler to provide pluralized strings. // Add a handler to provide pluralized strings.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment