Commit 34120ebf authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove non-span AddLocalizedStringsBulk() variant.

Convert all callers to the span variant of AddLocalizedStringsBulk().
Fix nits and lint errors along the way.

Change-Id: I5eb83e580aa7cd3659cad33fd9d931babaa9ed56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928317Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717765}
parent 46359a0a
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/certificate_manager_localized_strings_provider.h" #include "chrome/browser/ui/webui/certificate_manager_localized_strings_provider.h"
#include "base/stl_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/webui/localized_string.h" #include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -84,8 +83,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -84,8 +83,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
// For A11y. // For A11y.
{"menu", IDS_MENU}, {"menu", IDS_MENU},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
} // namespace certificate_manager } // namespace certificate_manager
...@@ -44,7 +44,7 @@ content::WebUIDataSource* GetWebUIDataSource(const std::string& host) { ...@@ -44,7 +44,7 @@ content::WebUIDataSource* GetWebUIDataSource(const std::string& host) {
{"certFields", IDS_CERT_DETAILS_CERTIFICATE_FIELDS_LABEL}, {"certFields", IDS_CERT_DETAILS_CERTIFICATE_FIELDS_LABEL},
{"certFieldVal", IDS_CERT_DETAILS_CERTIFICATE_FIELD_VALUE_LABEL}, {"certFieldVal", IDS_CERT_DETAILS_CERTIFICATE_FIELD_VALUE_LABEL},
}; };
AddLocalizedStringsBulk(html_source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html_source, kStrings);
html_source->UseStringsJs(); html_source->UseStringsJs();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/chromeos/bluetooth_dialog_localized_strings_provider.h" #include "chrome/browser/ui/webui/chromeos/bluetooth_dialog_localized_strings_provider.h"
#include "base/stl_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/webui/localized_string.h" #include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -63,8 +62,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -63,8 +62,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
{"bluetooth_connect_writeNotPermitted", {"bluetooth_connect_writeNotPermitted",
IDS_SETTINGS_BLUETOOTH_CONNECT_WRITE_NOT_PERMITTED}, IDS_SETTINGS_BLUETOOTH_CONNECT_WRITE_NOT_PERMITTED},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
} // namespace bluetooth_dialog } // namespace bluetooth_dialog
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h" #include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h"
#include "base/stl_util.h"
#include "chrome/browser/ui/webui/localized_string.h" #include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h" #include "components/login/localized_values_builder.h"
...@@ -42,8 +41,7 @@ constexpr LocalizedString kLocalizedStringsWithoutPlaceholders[] = { ...@@ -42,8 +41,7 @@ constexpr LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
} // namespace } // namespace
void AddLocalizedStrings(content::WebUIDataSource* html_source) { void AddLocalizedStrings(content::WebUIDataSource* html_source) {
AddLocalizedStringsBulk(html_source, kLocalizedStringsWithoutPlaceholders, AddLocalizedStringsBulk(html_source, kLocalizedStringsWithoutPlaceholders);
base::size(kLocalizedStringsWithoutPlaceholders));
} }
void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) { void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
......
...@@ -63,7 +63,7 @@ void AddStringResources(content::WebUIDataSource* source) { ...@@ -63,7 +63,7 @@ void AddStringResources(content::WebUIDataSource* source) {
{"mountContainerMessage", IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_MESSAGE}, {"mountContainerMessage", IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_MESSAGE},
{"cancelingMessage", IDS_CROSTINI_INSTALLER_CANCELING}, {"cancelingMessage", IDS_CROSTINI_INSTALLER_CANCELING},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
base::string16 device_name = ui::GetChromeOSDeviceName(); base::string16 device_name = ui::GetChromeOSDeviceName();
......
...@@ -126,8 +126,7 @@ ConfirmPasswordChangeUI::ConfirmPasswordChangeUI(content::WebUI* web_ui) ...@@ -126,8 +126,7 @@ ConfirmPasswordChangeUI::ConfirmPasswordChangeUI(content::WebUI* web_ui)
{"matchError", IDS_PASSWORD_CHANGE_PASSWORDS_DONT_MATCH}, {"matchError", IDS_PASSWORD_CHANGE_PASSWORDS_DONT_MATCH},
{"save", IDS_PASSWORD_CHANGE_CONFIRM_SAVE_BUTTON}}; {"save", IDS_PASSWORD_CHANGE_CONFIRM_SAVE_BUTTON}};
AddLocalizedStringsBulk(source, kLocalizedStrings, AddLocalizedStringsBulk(source, kLocalizedStrings);
base::size(kLocalizedStrings));
AddSize(source, "", ConfirmPasswordChangeDialog::GetSize(false, false)); AddSize(source, "", ConfirmPasswordChangeDialog::GetSize(false, false));
AddSize(source, "Old", ConfirmPasswordChangeDialog::GetSize(true, false)); AddSize(source, "Old", ConfirmPasswordChangeDialog::GetSize(true, false));
...@@ -169,8 +168,7 @@ UrgentPasswordExpiryNotificationUI::UrgentPasswordExpiryNotificationUI( ...@@ -169,8 +168,7 @@ UrgentPasswordExpiryNotificationUI::UrgentPasswordExpiryNotificationUI(
static constexpr LocalizedString kLocalizedStrings[] = { static constexpr LocalizedString kLocalizedStrings[] = {
{"body", IDS_PASSWORD_EXPIRY_CALL_TO_ACTION_CRITICAL}, {"body", IDS_PASSWORD_EXPIRY_CALL_TO_ACTION_CRITICAL},
{"button", IDS_OK}}; {"button", IDS_OK}};
AddLocalizedStringsBulk(source, kLocalizedStrings, AddLocalizedStringsBulk(source, kLocalizedStrings);
base::size(kLocalizedStrings));
source->UseStringsJs(); source->UseStringsJs();
source->SetDefaultResource(IDR_URGENT_PASSWORD_EXPIRY_NOTIFICATION_HTML); source->SetDefaultResource(IDR_URGENT_PASSWORD_EXPIRY_NOTIFICATION_HTML);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.h" #include "chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h" #include "base/system/sys_info.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -122,8 +121,7 @@ GetLocalizedStringsWithPlaceholders() { ...@@ -122,8 +121,7 @@ GetLocalizedStringsWithPlaceholders() {
} // namespace } // namespace
void AddLocalizedStrings(content::WebUIDataSource* html_source) { void AddLocalizedStrings(content::WebUIDataSource* html_source) {
AddLocalizedStringsBulk(html_source, kLocalizedStringsWithoutPlaceholders, AddLocalizedStringsBulk(html_source, kLocalizedStringsWithoutPlaceholders);
base::size(kLocalizedStringsWithoutPlaceholders));
for (const auto& entry : GetLocalizedStringsWithPlaceholders()) for (const auto& entry : GetLocalizedStringsWithPlaceholders())
html_source->AddString(entry.name, entry.localized_string); html_source->AddString(entry.name, entry.localized_string);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h" #include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chromeos/net/shill_error.h" #include "chrome/browser/chromeos/net/shill_error.h"
...@@ -48,8 +47,7 @@ constexpr LocalizedString kElementLocalizedStrings[] = { ...@@ -48,8 +47,7 @@ constexpr LocalizedString kElementLocalizedStrings[] = {
} // namespace } // namespace
void AddLocalizedStrings(content::WebUIDataSource* html_source) { void AddLocalizedStrings(content::WebUIDataSource* html_source) {
AddLocalizedStringsBulk(html_source, kElementLocalizedStrings, AddLocalizedStringsBulk(html_source, kElementLocalizedStrings);
base::size(kElementLocalizedStrings));
} }
void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) { void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
...@@ -167,8 +165,7 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -167,8 +165,7 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
{"Oncipv4-RoutingPrefix", IDS_ONC_IPV4_ROUTING_PREFIX}, {"Oncipv4-RoutingPrefix", IDS_ONC_IPV4_ROUTING_PREFIX},
{"Oncipv6-IPAddress", IDS_ONC_IPV6_ADDRESS}, {"Oncipv6-IPAddress", IDS_ONC_IPV6_ADDRESS},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) { void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) {
...@@ -273,8 +270,7 @@ void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -273,8 +270,7 @@ void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) {
{"networkProxyWpadNone", IDS_SETTINGS_INTERNET_NETWORK_PROXY_WPAD_NONE}, {"networkProxyWpadNone", IDS_SETTINGS_INTERNET_NETWORK_PROXY_WPAD_NONE},
{"remove", IDS_REMOVE}, {"remove", IDS_REMOVE},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
void AddConfigLocalizedStrings(content::WebUIDataSource* html_source) { void AddConfigLocalizedStrings(content::WebUIDataSource* html_source) {
...@@ -296,8 +292,7 @@ void AddConfigLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -296,8 +292,7 @@ void AddConfigLocalizedStrings(content::WebUIDataSource* html_source) {
{"hidePassword", IDS_SETTINGS_PASSWORD_HIDE}, {"hidePassword", IDS_SETTINGS_PASSWORD_HIDE},
{"showPassword", IDS_SETTINGS_PASSWORD_SHOW}, {"showPassword", IDS_SETTINGS_PASSWORD_SHOW},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
html_source->AddBoolean( html_source->AddBoolean(
"showHiddenNetworkWarning", "showHiddenNetworkWarning",
...@@ -326,8 +321,7 @@ void AddErrorLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -326,8 +321,7 @@ void AddErrorLocalizedStrings(content::WebUIDataSource* html_source) {
{"networkErrorNotHardwareBacked", {"networkErrorNotHardwareBacked",
IDS_SETTINGS_INTERNET_NETWORK_REQUIRE_HARDWARE_BACKED}, IDS_SETTINGS_INTERNET_NETWORK_REQUIRE_HARDWARE_BACKED},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
// Include Shill errors. // Include Shill errors.
const char* const shill_errors[] = { const char* const shill_errors[] = {
......
...@@ -256,7 +256,7 @@ PowerUI::PowerUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { ...@@ -256,7 +256,7 @@ PowerUI::PowerUI(content::WebUI* web_ui) : content::WebUIController(web_ui) {
{"frequencyStateOccupancyPercentageHeader", {"frequencyStateOccupancyPercentageHeader",
IDS_ABOUT_POWER_CPU_FREQ_STATE_OCCUPANCY_PERCENTAGE}, IDS_ABOUT_POWER_CPU_FREQ_STATE_OCCUPANCY_PERCENTAGE},
}; };
AddLocalizedStringsBulk(html, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html, kStrings);
html->UseStringsJs(); html->UseStringsJs();
......
...@@ -183,7 +183,7 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) { ...@@ -183,7 +183,7 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
{"timeLabel", IDS_SET_TIME_TIME_LABEL}, {"timeLabel", IDS_SET_TIME_TIME_LABEL},
{"doneButton", IDS_DONE}, {"doneButton", IDS_DONE},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
base::DictionaryValue values; base::DictionaryValue values;
// List of list of strings: [[ID, name], [ID, name], ...] // List of list of strings: [[ID, name], [ID, name], ...]
......
...@@ -51,7 +51,7 @@ content::WebUIDataSource* CreateSlowUIHTMLSource() { ...@@ -51,7 +51,7 @@ content::WebUIDataSource* CreateSlowUIHTMLSource() {
{"slowDescription", IDS_SLOW_DESCRIPTION}, {"slowDescription", IDS_SLOW_DESCRIPTION},
{"slowWarning", IDS_SLOW_WARNING}, {"slowWarning", IDS_SLOW_WARNING},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->AddResourcePath("slow.js", IDR_SLOW_JS); source->AddResourcePath("slow.js", IDR_SLOW_JS);
source->AddResourcePath("slow.css", IDR_SLOW_CSS); source->AddResourcePath("slow.css", IDR_SLOW_CSS);
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.h" #include "chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.h"
#include "base/stl_util.h"
#include "chrome/browser/ui/webui/localized_string.h" #include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
...@@ -47,8 +46,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -47,8 +46,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
{"smbShareDiscoveryMessage", {"smbShareDiscoveryMessage",
IDS_SETTINGS_DOWNLOADS_ADD_SHARE_DISCOVERY_MESSAGE}, IDS_SETTINGS_DOWNLOADS_ADD_SHARE_DISCOVERY_MESSAGE},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
} // namespace smb_dialog } // namespace smb_dialog
......
...@@ -56,7 +56,7 @@ content::WebUIDataSource* CreateComponentsUIHTMLSource(Profile* profile) { ...@@ -56,7 +56,7 @@ content::WebUIDataSource* CreateComponentsUIHTMLSource(Profile* profile) {
{"statusLabel", IDS_COMPONENTS_STATUS_LABEL}, {"statusLabel", IDS_COMPONENTS_STATUS_LABEL},
{"checkingLabel", IDS_COMPONENTS_CHECKING_LABEL}, {"checkingLabel", IDS_COMPONENTS_CHECKING_LABEL},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->AddBoolean( source->AddBoolean(
"isGuest", "isGuest",
......
...@@ -89,7 +89,7 @@ DeviceLogUI::DeviceLogUI(content::WebUI* web_ui) ...@@ -89,7 +89,7 @@ DeviceLogUI::DeviceLogUI(content::WebUI* web_ui)
{"logTypeFidoText", IDS_DEVICE_LOG_TYPE_FIDO}, {"logTypeFidoText", IDS_DEVICE_LOG_TYPE_FIDO},
{"logEntryFormat", IDS_DEVICE_LOG_ENTRY}, {"logEntryFormat", IDS_DEVICE_LOG_ENTRY},
}; };
AddLocalizedStringsBulk(html, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html, kStrings);
html->UseStringsJs(); html->UseStringsJs();
html->AddResourcePath("device_log_ui.css", IDR_DEVICE_LOG_UI_CSS); html->AddResourcePath("device_log_ui.css", IDR_DEVICE_LOG_UI_CSS);
......
...@@ -267,8 +267,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile, ...@@ -267,8 +267,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
IDS_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE}, IDS_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE},
#endif #endif
}; };
AddLocalizedStringsBulk(source, kLocalizedStrings, AddLocalizedStringsBulk(source, kLocalizedStrings);
base::size(kLocalizedStrings));
source->AddString("errorLinesNotShownSingular", source->AddString("errorLinesNotShownSingular",
l10n_util::GetPluralStringFUTF16( l10n_util::GetPluralStringFUTF16(
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/stl_util.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
......
...@@ -79,7 +79,7 @@ content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() { ...@@ -79,7 +79,7 @@ content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() {
{"titleConnector", IDS_LOCAL_DISCOVERY_CONNECTOR_SECTION}, {"titleConnector", IDS_LOCAL_DISCOVERY_CONNECTOR_SECTION},
#endif #endif
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->UseStringsJs(); source->UseStringsJs();
......
...@@ -11,9 +11,3 @@ void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, ...@@ -11,9 +11,3 @@ void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,
for (const auto& str : strings) for (const auto& str : strings)
html_source->AddLocalizedString(str.name, str.id); html_source->AddLocalizedString(str.name, str.id);
} }
void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,
const LocalizedString* strings,
size_t num_strings) {
AddLocalizedStringsBulk(html_source, base::make_span(strings, num_strings));
}
...@@ -20,14 +20,7 @@ struct LocalizedString { ...@@ -20,14 +20,7 @@ struct LocalizedString {
// Calls content::WebUIDataSource::AddLocalizedString() in a for-loop for // Calls content::WebUIDataSource::AddLocalizedString() in a for-loop for
// |strings|. Reduces code size vs. reimplementing the same for-loop. // |strings|. Reduces code size vs. reimplementing the same for-loop.
// Prefer this base::span version when possible. The 3 parameter version below
// will likely be deprecated in the future if all the callers can be easily
// converted to this version.
void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,
base::span<const LocalizedString> strings); base::span<const LocalizedString> strings);
void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,
const LocalizedString* strings,
size_t num_strings);
#endif // CHROME_BROWSER_UI_WEBUI_LOCALIZED_STRING_H_ #endif // CHROME_BROWSER_UI_WEBUI_LOCALIZED_STRING_H_
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
......
...@@ -73,7 +73,7 @@ content::WebUIDataSource* CreateWebRtcLogsUIHTMLSource() { ...@@ -73,7 +73,7 @@ content::WebUIDataSource* CreateWebRtcLogsUIHTMLSource() {
{"noTextLogsMessage", IDS_WEBRTC_LOGS_NO_TEXT_LOGS_MESSAGE}, {"noTextLogsMessage", IDS_WEBRTC_LOGS_NO_TEXT_LOGS_MESSAGE},
{"noEventLogsMessage", IDS_WEBRTC_LOGS_NO_EVENT_LOGS_MESSAGE}, {"noEventLogsMessage", IDS_WEBRTC_LOGS_NO_EVENT_LOGS_MESSAGE},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->UseStringsJs(); source->UseStringsJs();
source->AddResourcePath("webrtc_logs.js", IDR_WEBRTC_LOGS_JS); source->AddResourcePath("webrtc_logs.js", IDR_WEBRTC_LOGS_JS);
......
...@@ -27,7 +27,7 @@ content::WebUIDataSource* CreateNewTabPageUiHtmlSource() { ...@@ -27,7 +27,7 @@ content::WebUIDataSource* CreateNewTabPageUiHtmlSource() {
static constexpr LocalizedString kStrings[] = { static constexpr LocalizedString kStrings[] = {
{"title", IDS_NEW_TAB_TITLE}, {"title", IDS_NEW_TAB_TITLE},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->AddResourcePath("new_tab_page.mojom-lite.js", source->AddResourcePath("new_tab_page.mojom-lite.js",
IDR_NEW_TAB_PAGE_MOJO_LITE_JS); IDR_NEW_TAB_PAGE_MOJO_LITE_JS);
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h" #include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h"
#include "base/stl_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/webui/localized_string.h" #include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -39,8 +38,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) { ...@@ -39,8 +38,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
IDS_CONTROLLED_SETTING_CHILD_RESTRICTION}, IDS_CONTROLLED_SETTING_CHILD_RESTRICTION},
#endif #endif
}; };
AddLocalizedStringsBulk(html_source, localized_strings, AddLocalizedStringsBulk(html_source, localized_strings);
base::size(localized_strings));
} }
} // namespace policy_indicator } // namespace policy_indicator
...@@ -211,8 +211,10 @@ void GetUserAffiliationStatus(base::DictionaryValue* dict, Profile* profile) { ...@@ -211,8 +211,10 @@ void GetUserAffiliationStatus(base::DictionaryValue* dict, Profile* profile) {
void GetOffHoursStatus(base::DictionaryValue* dict) { void GetOffHoursStatus(base::DictionaryValue* dict) {
policy::off_hours::DeviceOffHoursController* off_hours_controller = policy::off_hours::DeviceOffHoursController* off_hours_controller =
chromeos::DeviceSettingsService::Get()->device_off_hours_controller(); chromeos::DeviceSettingsService::Get()->device_off_hours_controller();
if (off_hours_controller) if (off_hours_controller) {
dict->SetBoolean("isOffHoursActive", off_hours_controller->is_off_hours_mode()); dict->SetBoolean("isOffHoursActive",
off_hours_controller->is_off_hours_mode());
}
} }
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
...@@ -712,8 +714,7 @@ PolicyUIHandler::~PolicyUIHandler() { ...@@ -712,8 +714,7 @@ PolicyUIHandler::~PolicyUIHandler() {
void PolicyUIHandler::AddCommonLocalizedStringsToSource( void PolicyUIHandler::AddCommonLocalizedStringsToSource(
content::WebUIDataSource* source) { content::WebUIDataSource* source) {
AddLocalizedStringsBulk(source, policy::kPolicySources, AddLocalizedStringsBulk(source, policy::kPolicySources);
policy::POLICY_SOURCE_COUNT);
static constexpr LocalizedString kStrings[] = { static constexpr LocalizedString kStrings[] = {
{"conflict", IDS_POLICY_LABEL_CONFLICT}, {"conflict", IDS_POLICY_LABEL_CONFLICT},
...@@ -737,7 +738,7 @@ void PolicyUIHandler::AddCommonLocalizedStringsToSource( ...@@ -737,7 +738,7 @@ void PolicyUIHandler::AddCommonLocalizedStringsToSource(
{"unset", IDS_POLICY_UNSET}, {"unset", IDS_POLICY_UNSET},
{"value", IDS_POLICY_LABEL_VALUE}, {"value", IDS_POLICY_LABEL_VALUE},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
source->UseStringsJs(); source->UseStringsJs();
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -301,8 +300,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) { ...@@ -301,8 +300,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
{"openingPDFInPreview", IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW_APP}, {"openingPDFInPreview", IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW_APP},
#endif #endif
}; };
AddLocalizedStringsBulk(source, kLocalizedStrings, AddLocalizedStringsBulk(source, kLocalizedStrings);
base::size(kLocalizedStrings));
source->AddString("gcpCertificateErrorLearnMoreURL", source->AddString("gcpCertificateErrorLearnMoreURL",
chrome::kCloudPrintCertificateErrorLearnMoreURL); chrome::kCloudPrintCertificateErrorLearnMoreURL);
......
...@@ -45,7 +45,7 @@ SigninEmailConfirmationUI::SigninEmailConfirmationUI(content::WebUI* web_ui) ...@@ -45,7 +45,7 @@ SigninEmailConfirmationUI::SigninEmailConfirmationUI(content::WebUI* web_ui)
{"signinEmailConfirmationCloseLabel", {"signinEmailConfirmationCloseLabel",
IDS_SIGNIN_EMAIL_CONFIRMATION_CLOSE_BUTTON_LABEL}, IDS_SIGNIN_EMAIL_CONFIRMATION_CLOSE_BUTTON_LABEL},
}; };
AddLocalizedStringsBulk(source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(source, kStrings);
base::DictionaryValue strings; base::DictionaryValue strings;
webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(), webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(),
......
...@@ -61,7 +61,7 @@ content::WebUIDataSource* CreateSystemInfoUIDataSource() { ...@@ -61,7 +61,7 @@ content::WebUIDataSource* CreateSystemInfoUIDataSource() {
{"collapseBtn", IDS_ABOUT_SYS_COLLAPSE}, {"collapseBtn", IDS_ABOUT_SYS_COLLAPSE},
{"parseError", IDS_ABOUT_SYS_PARSE_ERROR}, {"parseError", IDS_ABOUT_SYS_PARSE_ERROR},
}; };
AddLocalizedStringsBulk(html_source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html_source, kStrings);
html_source->AddResourcePath("about_sys.js", IDR_ABOUT_SYS_JS); html_source->AddResourcePath("about_sys.js", IDR_ABOUT_SYS_JS);
html_source->AddResourcePath("about_sys.css", IDR_ABOUT_SYS_CSS); html_source->AddResourcePath("about_sys.css", IDR_ABOUT_SYS_CSS);
......
...@@ -491,7 +491,7 @@ TabStripUI::TabStripUI(content::WebUI* web_ui) ...@@ -491,7 +491,7 @@ TabStripUI::TabStripUI(content::WebUI* web_ui)
{"desktopCapturing", IDS_TAB_AX_LABEL_DESKTOP_CAPTURING_FORMAT}, {"desktopCapturing", IDS_TAB_AX_LABEL_DESKTOP_CAPTURING_FORMAT},
{"vrPresenting", IDS_TAB_AX_LABEL_VR_PRESENTING}, {"vrPresenting", IDS_TAB_AX_LABEL_VR_PRESENTING},
}; };
AddLocalizedStringsBulk(html_source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html_source, kStrings);
html_source->UseStringsJs(); html_source->UseStringsJs();
content::WebUIDataSource::Add(profile, html_source); content::WebUIDataSource::Add(profile, html_source);
......
...@@ -79,7 +79,7 @@ WebUIDataSource* CreateVersionUIDataSource() { ...@@ -79,7 +79,7 @@ WebUIDataSource* CreateVersionUIDataSource() {
{version_ui::kGmsName, IDS_VERSION_UI_GMS}, {version_ui::kGmsName, IDS_VERSION_UI_GMS},
#endif // OS_ANDROID #endif // OS_ANDROID
}; };
AddLocalizedStringsBulk(html_source, kStrings, base::size(kStrings)); AddLocalizedStringsBulk(html_source, kStrings);
VersionUI::AddVersionDetailStrings(html_source); VersionUI::AddVersionDetailStrings(html_source);
...@@ -184,5 +184,6 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) { ...@@ -184,5 +184,6 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
version_utils::win::GetCohortVersionInfo()); version_utils::win::GetCohortVersionInfo());
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
html_source->AddString(version_ui::kSanitizer, version_info::GetSanitizerList()); html_source->AddString(version_ui::kSanitizer,
version_info::GetSanitizerList());
} }
...@@ -52,7 +52,7 @@ bool ShouldHandleRequestCallback(base::WeakPtr<WelcomeUI> weak_ptr, ...@@ -52,7 +52,7 @@ bool ShouldHandleRequestCallback(base::WeakPtr<WelcomeUI> weak_ptr,
return false; return false;
} }
return !weak_ptr ? false : true; return !!weak_ptr;
} }
void HandleRequestCallback( void HandleRequestCallback(
...@@ -109,8 +109,7 @@ void AddStrings(content::WebUIDataSource* html_source) { ...@@ -109,8 +109,7 @@ void AddStrings(content::WebUIDataSource* html_source) {
{"landingNewUser", IDS_WELCOME_LANDING_NEW_USER}, {"landingNewUser", IDS_WELCOME_LANDING_NEW_USER},
{"landingExistingUser", IDS_WELCOME_LANDING_EXISTING_USER}, {"landingExistingUser", IDS_WELCOME_LANDING_EXISTING_USER},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings);
base::size(kLocalizedStrings));
} }
} // namespace } // namespace
......
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