0

Avoid constexpr std::string, which is C++20-specific.

`constexpr base::StringPiece` works in C++17 and may be more
performant anyway.

Bug: 1444563
Change-Id: I03d895bb431e837c945d1f554a1a2f33a939459b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4521911
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1144397}
This commit is contained in:
Peter Kasting
2023-05-15 21:43:56 +00:00
committed by Chromium LUCI CQ
parent 21fbba0b02
commit 4928fbb26b
72 changed files with 224 additions and 170 deletions
android_webview/nonembedded/component_updater
chrome
chromeos/ash
components
cryptohome
services
components
autofill
component_updater
embedder_support
enterprise
fuchsia_component_support
gcm_driver
metrics
minidump_uploader
policy
safe_browsing
security_interstitials
update_client
version_info
webapps
browser
extensions/shell/browser
fuchsia_web
ios
services/network/sct_auditing
weblayer/browser

@ -92,7 +92,8 @@ base::Version AwComponentUpdaterConfigurator::GetBrowserVersion() const {
} }
std::string AwComponentUpdaterConfigurator::GetChannel() const { std::string AwComponentUpdaterConfigurator::GetChannel() const {
return version_info::GetChannelString(version_info::android::GetChannel()); return std::string(
version_info::GetChannelString(version_info::android::GetChannel()));
} }
std::string AwComponentUpdaterConfigurator::GetLang() const { std::string AwComponentUpdaterConfigurator::GetLang() const {

@ -396,14 +396,14 @@ bool HandleCreditsSwitch(const base::CommandLine& command_line) {
bool HandleVersionSwitches(const base::CommandLine& command_line) { bool HandleVersionSwitches(const base::CommandLine& command_line) {
#if !BUILDFLAG(IS_MAC) #if !BUILDFLAG(IS_MAC)
if (command_line.HasSwitch(switches::kProductVersion)) { if (command_line.HasSwitch(switches::kProductVersion)) {
printf("%s\n", version_info::GetVersionNumber().c_str()); printf("%s\n", version_info::GetVersionNumber().data());
return true; return true;
} }
#endif #endif
if (command_line.HasSwitch(switches::kVersion)) { if (command_line.HasSwitch(switches::kVersion)) {
printf("%s %s %s\n", version_info::GetProductName().c_str(), printf("%s %s %s\n", version_info::GetProductName().data(),
version_info::GetVersionNumber().c_str(), version_info::GetVersionNumber().data(),
chrome::GetChannelName(chrome::WithExtendedStable(true)).c_str()); chrome::GetChannelName(chrome::WithExtendedStable(true)).c_str());
return true; return true;
} }

@ -294,7 +294,8 @@ void WebApkInstallTask::Start(ResultCallback callback) {
std::unique_ptr<webapk::WebApk> webapk = std::make_unique<webapk::WebApk>(); std::unique_ptr<webapk::WebApk> webapk = std::make_unique<webapk::WebApk>();
webapk->set_manifest_url(registrar.GetAppManifestUrl(app_id_).spec()); webapk->set_manifest_url(registrar.GetAppManifestUrl(app_id_).spec());
webapk->set_requester_application_package(kRequesterPackageName); webapk->set_requester_application_package(kRequesterPackageName);
webapk->set_requester_application_version(version_info::GetVersionNumber()); webapk->set_requester_application_version(
std::string(version_info::GetVersionNumber()));
LoadWebApkInfo(std::move(webapk)); LoadWebApkInfo(std::move(webapk));
} }
@ -563,7 +564,8 @@ void WebApkInstallTask::OnWebApkInfoFetchedFromCrosapi(
} }
webapk->set_requester_application_package(kRequesterPackageName); webapk->set_requester_application_package(kRequesterPackageName);
webapk->set_requester_application_version(version_info::GetVersionNumber()); webapk->set_requester_application_version(
std::string(version_info::GetVersionNumber()));
LoadWebApkInfo(std::move(webapk)); LoadWebApkInfo(std::move(webapk));
} }

@ -350,8 +350,9 @@ bool KioskExternalUpdater::ShouldDoExternalUpdate(
// Check minimum browser version. // Check minimum browser version.
if (!min_browser_version.empty() && if (!min_browser_version.empty() &&
!ShouldUpdateForHigherVersion(min_browser_version, !ShouldUpdateForHigherVersion(
version_info::GetVersionNumber(), true)) { min_browser_version, std::string(version_info::GetVersionNumber()),
true)) {
external_updates_[app_id].error = l10n_util::GetStringFUTF16( external_updates_[app_id].error = l10n_util::GetStringFUTF16(
IDS_KIOSK_EXTERNAL_UPDATE_REQUIRE_HIGHER_BROWSER_VERSION, IDS_KIOSK_EXTERNAL_UPDATE_REQUIRE_HIGHER_BROWSER_VERSION,
base::UTF8ToUTF16(min_browser_version)); base::UTF8ToUTF16(min_browser_version));

@ -332,8 +332,8 @@ void ClientAppMetadataProviderService::OnInstanceIdTokenFetched(
metadata.set_locale(ChromeContentBrowserClient().GetApplicationLocale()); metadata.set_locale(ChromeContentBrowserClient().GetApplicationLocale());
metadata.set_device_os_version(base::GetLinuxDistro()); metadata.set_device_os_version(base::GetLinuxDistro());
metadata.set_device_os_version_code(SoftwareVersionCodeAsInt64()); metadata.set_device_os_version_code(SoftwareVersionCodeAsInt64());
metadata.set_device_os_release(version_info::GetVersionNumber()); metadata.set_device_os_release(std::string(version_info::GetVersionNumber()));
metadata.set_device_os_codename(version_info::GetProductName()); metadata.set_device_os_codename(std::string(version_info::GetProductName()));
// device_display_diagonal_mils is unused because it only applies to // device_display_diagonal_mils is unused because it only applies to
// phones/tablets. // phones/tablets.
@ -423,7 +423,7 @@ instance_id::InstanceID* ClientAppMetadataProviderService::GetInstanceId() {
int64_t ClientAppMetadataProviderService::SoftwareVersionCodeAsInt64() { int64_t ClientAppMetadataProviderService::SoftwareVersionCodeAsInt64() {
static const int64_t version_code = static const int64_t version_code =
ConvertVersionCodeToInt64(version_info::GetVersionNumber()); ConvertVersionCodeToInt64(std::string(version_info::GetVersionNumber()));
return version_code; return version_code;
} }

@ -53,7 +53,7 @@ const cryptauth::GcmDeviceInfo& GcmDeviceInfoProviderImpl::GetGcmDeviceInfo()
const { const {
static const base::NoDestructor<cryptauth::GcmDeviceInfo> gcm_device_info([] { static const base::NoDestructor<cryptauth::GcmDeviceInfo> gcm_device_info([] {
static const google::protobuf::int64 kSoftwareVersionCode = static const google::protobuf::int64 kSoftwareVersionCode =
HashStringToInt64(version_info::GetLastChange()); HashStringToInt64(std::string(version_info::GetLastChange()));
cryptauth::GcmDeviceInfo gcm_device_info; cryptauth::GcmDeviceInfo gcm_device_info;
@ -61,7 +61,7 @@ const cryptauth::GcmDeviceInfo& GcmDeviceInfoProviderImpl::GetGcmDeviceInfo()
CryptAuthDeviceIdProviderImpl::GetInstance()->GetDeviceId()); CryptAuthDeviceIdProviderImpl::GetInstance()->GetDeviceId());
gcm_device_info.set_device_type(cryptauth::CHROME); gcm_device_info.set_device_type(cryptauth::CHROME);
gcm_device_info.set_device_software_version( gcm_device_info.set_device_software_version(
version_info::GetVersionNumber()); std::string(version_info::GetVersionNumber()));
gcm_device_info.set_device_software_version_code(kSoftwareVersionCode); gcm_device_info.set_device_software_version_code(kSoftwareVersionCode);
gcm_device_info.set_locale( gcm_device_info.set_locale(
ChromeContentBrowserClient().GetApplicationLocale()); ChromeContentBrowserClient().GetApplicationLocale());

@ -87,7 +87,7 @@ void OsUpdatesReporter::MaybeReportEvent(
record.set_current_os_version(os_version.value_or("0.0.0.0")); record.set_current_os_version(os_version.value_or("0.0.0.0"));
record.set_current_channel( record.set_current_channel(
version_info::GetChannelString(chrome::GetChannel())); std::string(version_info::GetChannelString(chrome::GetChannel())));
record.set_event_timestamp_sec(base::Time::Now().ToTimeT()); record.set_event_timestamp_sec(base::Time::Now().ToTimeT());

@ -2266,7 +2266,7 @@ bool DeviceStatusCollector::GetActivityTimes(
bool DeviceStatusCollector::GetVersionInfo( bool DeviceStatusCollector::GetVersionInfo(
em::DeviceStatusReportRequest* status) { em::DeviceStatusReportRequest* status) {
status->set_os_version(os_version_); status->set_os_version(os_version_);
status->set_browser_version(version_info::GetVersionNumber()); status->set_browser_version(std::string(version_info::GetVersionNumber()));
status->set_is_lacros_primary_browser( status->set_is_lacros_primary_browser(
crosapi::browser_util::IsLacrosPrimaryBrowser()); crosapi::browser_util::IsLacrosPrimaryBrowser());
status->set_channel(ConvertToProtoChannel(chrome::GetChannel())); status->set_channel(ConvertToProtoChannel(chrome::GetChannel()));

@ -56,15 +56,15 @@ class HelpAppNotificationControllerTest : public BrowserWithTestWindowTest {
builder.SetProfileName("user@gmail.com"); builder.SetProfileName("user@gmail.com");
std::unique_ptr<TestingProfile> profile = builder.Build(); std::unique_ptr<TestingProfile> profile = builder.Build();
// Set profile creation version, otherwise it defaults to 1.0.0.0. // Set profile creation version, otherwise it defaults to 1.0.0.0.
ChromeVersionService::SetVersion(profile->GetPrefs(), ChromeVersionService::SetVersion(
version_info::GetVersionNumber()); profile->GetPrefs(), std::string(version_info::GetVersionNumber()));
return profile; return profile;
} }
std::unique_ptr<TestingProfile> CreateChildProfile() { std::unique_ptr<TestingProfile> CreateChildProfile() {
std::unique_ptr<TestingProfile> profile = CreateRegularProfile(); std::unique_ptr<TestingProfile> profile = CreateRegularProfile();
ChromeVersionService::SetVersion(profile->GetPrefs(), ChromeVersionService::SetVersion(
version_info::GetVersionNumber()); profile->GetPrefs(), std::string(version_info::GetVersionNumber()));
profile->SetIsSupervisedProfile(); profile->SetIsSupervisedProfile();
return profile; return profile;
} }

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <string>
#include "base/base64url.h" #include "base/base64url.h"
#include "base/base_switches.h" #include "base/base_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
@ -225,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(AutofillServerTest,
"</script>"; "</script>";
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
auto* query_form = query.add_forms(); auto* query_form = query.add_forms();
query_form->set_signature(15916856893790176210U); query_form->set_signature(15916856893790176210U);
@ -249,7 +251,8 @@ IN_PROC_BROWSER_TEST_F(AutofillServerTest,
AutofillUploadRequest request; AutofillUploadRequest request;
AutofillUploadContents* upload = request.mutable_upload(); AutofillUploadContents* upload = request.mutable_upload();
upload->set_submission(true); upload->set_submission(true);
upload->set_client_version(GetProductNameAndVersionForUserAgent()); upload->set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload->set_form_signature(15916856893790176210U); upload->set_form_signature(15916856893790176210U);
upload->set_autofill_used(false); upload->set_autofill_used(false);
@ -319,7 +322,7 @@ IN_PROC_BROWSER_TEST_F(AutofillServerTest, AlwaysQueryForPasswordFields) {
"</form>"; "</form>";
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
auto* query_form = query.add_forms(); auto* query_form = query.add_forms();
query_form->set_signature(8900697631820480876U); query_form->set_signature(8900697631820480876U);

@ -391,9 +391,10 @@ void MigratePinnedTaskBarShortcutsIfNeeded() {
local_state->GetString(prefs::kShortcutMigrationVersion)); local_state->GetString(prefs::kShortcutMigrationVersion));
if (!last_version_migrated.IsValid() || if (!last_version_migrated.IsValid() ||
last_version_migrated < kLastVersionNeedingMigration) { last_version_migrated < kLastVersionNeedingMigration) {
shell_integration::win::MigrateTaskbarPins(base::BindOnce( shell_integration::win::MigrateTaskbarPins(
&PrefService::SetString, base::Unretained(local_state), base::BindOnce(&PrefService::SetString, base::Unretained(local_state),
prefs::kShortcutMigrationVersion, version_info::GetVersionNumber())); prefs::kShortcutMigrationVersion,
std::string(version_info::GetVersionNumber())));
} }
} }
} }

@ -6765,7 +6765,7 @@ void ChromeContentBrowserClient::LogWebFeatureForCurrentPage(
} }
std::string ChromeContentBrowserClient::GetProduct() { std::string ChromeContentBrowserClient::GetProduct() {
return version_info::GetProductNameAndVersionForUserAgent(); return std::string(version_info::GetProductNameAndVersionForUserAgent());
} }
std::string ChromeContentBrowserClient::GetUserAgent() { std::string ChromeContentBrowserClient::GetUserAgent() {

@ -297,7 +297,7 @@ class VersionTest : public DiagnosticsTest {
VersionTest& operator=(const VersionTest&) = delete; VersionTest& operator=(const VersionTest&) = delete;
bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { bool ExecuteImpl(DiagnosticsModel::Observer* observer) override {
std::string current_version = version_info::GetVersionNumber(); std::string current_version(version_info::GetVersionNumber());
if (current_version.empty()) { if (current_version.empty()) {
RecordFailure(DIAG_RECON_EMPTY_VERSION, "Empty Version"); RecordFailure(DIAG_RECON_EMPTY_VERSION, "Empty Version");
return true; return true;

@ -75,7 +75,8 @@ void PopulateBrowserMetadata(bool include_device_info,
base::FilePath browser_id; base::FilePath browser_id;
if (base::PathService::Get(base::DIR_EXE, &browser_id)) if (base::PathService::Get(base::DIR_EXE, &browser_id))
browser_proto->set_browser_id(browser_id.AsUTF8Unsafe()); browser_proto->set_browser_id(browser_id.AsUTF8Unsafe());
browser_proto->set_chrome_version(version_info::GetVersionNumber()); browser_proto->set_chrome_version(
std::string(version_info::GetVersionNumber()));
if (include_device_info) if (include_device_info)
browser_proto->set_machine_user(policy::GetOSUsername()); browser_proto->set_machine_user(policy::GetOSUsername());
} }

@ -159,10 +159,10 @@ void UploadToReportingServer(
} }
absl::optional<ReportingSettings> settings = absl::optional<ReportingSettings> settings =
reporting_client->GetReportingSettings(); reporting_client->GetReportingSettings();
const std::string version = version_info::GetVersionNumber(); const std::string version(version_info::GetVersionNumber());
const std::string channel = const std::string channel(
version_info::GetChannelString(chrome::GetChannel()); version_info::GetChannelString(chrome::GetChannel()));
const std::string platform = version_info::GetOSType(); const std::string platform(version_info::GetOSType());
int64_t latest_creation_time = -1; int64_t latest_creation_time = -1;

@ -60,11 +60,11 @@ bool IsBrowserSigninAllowed(Profile* profile) {
} }
std::string GetOAuth2MintTokenFlowVersion() { std::string GetOAuth2MintTokenFlowVersion() {
return version_info::GetVersionNumber(); return std::string(version_info::GetVersionNumber());
} }
std::string GetOAuth2MintTokenFlowChannel() { std::string GetOAuth2MintTokenFlowChannel() {
return version_info::GetChannelString(chrome::GetChannel()); return std::string(version_info::GetChannelString(chrome::GetChannel()));
} }
void RecordFunctionResult(const IdentityGetAuthTokenError& error, void RecordFunctionResult(const IdentityGetAuthTokenError& error,

@ -403,7 +403,7 @@ bool ChromeExtensionsBrowserClient::DidVersionUpdate(
last_version = base::Version(last_version_str); last_version = base::Version(last_version_str);
} }
std::string current_version_str = version_info::GetVersionNumber(); std::string current_version_str(version_info::GetVersionNumber());
const base::Version& current_version = version_info::GetVersion(); const base::Version& current_version = version_info::GetVersion();
pref_service->SetString(pref_names::kLastChromeVersion, current_version_str); pref_service->SetString(pref_names::kLastChromeVersion, current_version_str);

@ -89,7 +89,7 @@ void Provider::InitProfileState() {
// Pre-installed apps are only installed on profile creation or a new // Pre-installed apps are only installed on profile creation or a new
// chrome download. // chrome download.
bool is_new_profile = profile_->WasCreatedByVersionOrLater( bool is_new_profile = profile_->WasCreatedByVersionOrLater(
version_info::GetVersionNumber()); std::string(version_info::GetVersionNumber()));
if (is_new_profile && preinstalled_apps_enabled_) { if (is_new_profile && preinstalled_apps_enabled_) {
new_install_state = kAlreadyInstalledPreinstalledApps; new_install_state = kAlreadyInstalledPreinstalledApps;
perform_new_installation_ = true; perform_new_installation_ = true;

@ -8,6 +8,7 @@
#include <algorithm> #include <algorithm>
#include <set> #include <set>
#include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -125,9 +126,9 @@ std::string BuildRequest() {
"USER-AGENT: %s/%s %s\r\n" "USER-AGENT: %s/%s %s\r\n"
"\r\n", "\r\n",
kDialRequestAddress, kDialRequestPort, kDialMaxResponseDelaySecs, kDialRequestAddress, kDialRequestPort, kDialMaxResponseDelaySecs,
kDialSearchType, version_info::GetProductName().c_str(), kDialSearchType, version_info::GetProductName().data(),
version_info::GetVersionNumber().c_str(), version_info::GetVersionNumber().data(),
version_info::GetOSType().c_str())); version_info::GetOSType().data()));
// 1500 is a good MTU value for most Ethernet LANs. // 1500 is a good MTU value for most Ethernet LANs.
DCHECK_LE(request.size(), 1500U); DCHECK_LE(request.size(), 1500U);
return request; return request;

@ -36,7 +36,8 @@ cast_channel::CastMessageHandler* GetCastMessageHandler() {
new cast_channel::CastMessageHandler( new cast_channel::CastMessageHandler(
cast_channel::CastSocketService::GetInstance(), cast_channel::CastSocketService::GetInstance(),
base::BindRepeating(&ParseJsonFromIoThread), base::BindRepeating(&ParseJsonFromIoThread),
embedder_support::GetUserAgent(), version_info::GetVersionNumber(), embedder_support::GetUserAgent(),
std::string(version_info::GetVersionNumber()),
g_browser_process->GetApplicationLocale()); g_browser_process->GetApplicationLocale());
return instance; return instance;
} }

@ -275,7 +275,8 @@ void ChromePermissionsClient::TriggerPromptHatsSurveyIfEnabled(
auto prompt_parameters = auto prompt_parameters =
permissions::PermissionHatsTriggerHelper::PromptParametersForHaTS( permissions::PermissionHatsTriggerHelper::PromptParametersForHaTS(
request_type, action, prompt_disposition, prompt_disposition_reason, request_type, action, prompt_disposition, prompt_disposition_reason,
gesture_type, version_info::GetChannelString(chrome::GetChannel()), gesture_type,
std::string(version_info::GetChannelString(chrome::GetChannel())),
is_post_prompt ? permissions::kOnPromptResolved is_post_prompt ? permissions::kOnPromptResolved
: permissions::kOnPromptAppearing, : permissions::kOnPromptAppearing,
prompt_display_duration, prompt_display_duration,

@ -244,7 +244,7 @@ base::Value::List GetReadableFeedbackForSnapshot(
g_browser_process->GetApplicationLocale()); g_browser_process->GetApplicationLocale());
AddPair(list, l10n_util::GetStringUTF16(IDS_VERSION_UI_USER_AGENT), AddPair(list, l10n_util::GetStringUTF16(IDS_VERSION_UI_USER_AGENT),
embedder_support::GetUserAgent()); embedder_support::GetUserAgent());
std::string version = version_info::GetVersionNumber(); std::string version(version_info::GetVersionNumber());
version += chrome::GetChannelName(chrome::WithExtendedStable(true)); version += chrome::GetChannelName(chrome::WithExtendedStable(true));
AddPair(list, AddPair(list,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),

@ -33,7 +33,7 @@ void ChromeVersionService::OnProfileLoaded(PrefService* prefs,
// If this is a new profile set version to current version, otherwise // If this is a new profile set version to current version, otherwise
// (pre-existing profile), leave pref at default value (1.0.0.0) to // (pre-existing profile), leave pref at default value (1.0.0.0) to
// avoid any first-run behavior. // avoid any first-run behavior.
std::string version = version_info::GetVersionNumber(); std::string version(version_info::GetVersionNumber());
if (prefs->FindPreference(prefs::kProfileCreatedByVersion)-> if (prefs->FindPreference(prefs::kProfileCreatedByVersion)->
IsDefaultValue() && is_new_profile) { IsDefaultValue() && is_new_profile) {
SetVersion(prefs, version); SetVersion(prefs, version);

@ -413,7 +413,7 @@ void ChromeShellDelegate::ForceSkipWarningUserOnClose(
} }
std::string ChromeShellDelegate::GetVersionString() { std::string ChromeShellDelegate::GetVersionString() {
return version_info::GetVersionNumber(); return std::string(version_info::GetVersionNumber());
} }
void ChromeShellDelegate::ShouldExitFullscreenBeforeLock( void ChromeShellDelegate::ShouldExitFullscreenBeforeLock(

@ -5,6 +5,7 @@
#include "chrome/browser/ui/autofill/risk_util.h" #include "chrome/browser/ui/autofill/risk_util.h"
#include <memory> #include <memory>
#include <string>
#include "base/base64.h" #include "base/base64.h"
#include "base/functional/bind.h" #include "base/functional/bind.h"
@ -101,7 +102,7 @@ void LoadRiskDataHelper(uint64_t obfuscated_gaia_id,
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
risk::GetFingerprint(obfuscated_gaia_id, window_bounds, web_contents, risk::GetFingerprint(obfuscated_gaia_id, window_bounds, web_contents,
version_info::GetVersionNumber(), charset, std::string(version_info::GetVersionNumber()), charset,
accept_languages, install_time, accept_languages, install_time,
g_browser_process->GetApplicationLocale(), g_browser_process->GetApplicationLocale(),
embedder_support::GetUserAgent(), embedder_support::GetUserAgent(),

@ -224,7 +224,7 @@ INSTANTIATE_TEST_SUITE_P(
[](const ::testing::TestParamInfo<FirstRunFieldTrialTestParams>& params) { [](const ::testing::TestParamInfo<FirstRunFieldTrialTestParams>& params) {
return base::StringPrintf( return base::StringPrintf(
"%02.0fpctEntropy%s", params.param.entropy_value * 100, "%02.0fpctEntropy%s", params.param.entropy_value * 100,
version_info::GetChannelString(params.param.channel).c_str()); version_info::GetChannelString(params.param.channel).data());
}); });
// Tests to verify the logic for synthetic trial registration that we use to // Tests to verify the logic for synthetic trial registration that we use to

@ -210,5 +210,5 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
} }
std::string ChromeViewsDelegate::GetApplicationName() { std::string ChromeViewsDelegate::GetApplicationName() {
return version_info::GetProductName(); return std::string(version_info::GetProductName());
} }

@ -37,13 +37,15 @@ void CreateAndAddInternalsHTMLSource(Profile* profile,
IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS); IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS);
source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML); source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML);
// Data strings: // Data strings:
source->AddString(version_ui::kVersion, version_info::GetVersionNumber()); source->AddString(version_ui::kVersion,
std::string(version_info::GetVersionNumber()));
source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild() source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild()
? "official" ? "official"
: "Developer build"); : "Developer build");
source->AddString(version_ui::kVersionModifier, source->AddString(version_ui::kVersionModifier,
chrome::GetChannelName(chrome::WithExtendedStable(true))); chrome::GetChannelName(chrome::WithExtendedStable(true)));
source->AddString(version_ui::kCL, version_info::GetLastChange()); source->AddString(version_ui::kCL,
std::string(version_info::GetLastChange()));
source->AddString(version_ui::kUserAgent, embedder_support::GetUserAgent()); source->AddString(version_ui::kUserAgent, embedder_support::GetUserAgent());
source->AddString("app_locale", g_browser_process->GetApplicationLocale()); source->AddString("app_locale", g_browser_process->GetApplicationLocale());
} }

@ -70,7 +70,8 @@ content::WebUIDataSource* CreateAndAddFlagsUIHTMLSource(Profile* profile) {
source->OverrideContentSecurityPolicy( source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::TrustedTypes, network::mojom::CSPDirectiveName::TrustedTypes,
"trusted-types jstemplate;"); "trusted-types jstemplate;");
source->AddString(flags_ui::kVersion, version_info::GetVersionNumber()); source->AddString(flags_ui::kVersion,
std::string(version_info::GetVersionNumber()));
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (!user_manager::UserManager::Get()->IsCurrentUserOwner() && if (!user_manager::UserManager::Get()->IsCurrentUserOwner() &&

@ -197,7 +197,7 @@ void NaClDomHandler::AddOperatingSystemInfo(base::Value::List* list) {
// OS version information. // OS version information.
// TODO(jvoung): refactor this to share the extra windows labeling // TODO(jvoung): refactor this to share the extra windows labeling
// with about:flash, or something. // with about:flash, or something.
std::string os_label = version_info::GetOSType(); std::string os_label(version_info::GetOSType());
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
base::win::OSInfo* os = base::win::OSInfo::GetInstance(); base::win::OSInfo* os = base::win::OSInfo::GetInstance();
switch (os->version()) { switch (os->version()) {

@ -223,7 +223,7 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
// Data strings. // Data strings.
html_source->AddString(version_ui::kVersion, html_source->AddString(version_ui::kVersion,
version_info::GetVersionNumber()); std::string(version_info::GetVersionNumber()));
html_source->AddString(version_ui::kVersionModifier, GetProductModifier()); html_source->AddString(version_ui::kVersionModifier, GetProductModifier());
@ -239,7 +239,8 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
base::i18n::MessageFormatter::FormatWithNumberedArgs( base::i18n::MessageFormatter::FormatWithNumberedArgs(
l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT), l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT),
base::Time::Now())); base::Time::Now()));
html_source->AddString(version_ui::kCL, version_info::GetLastChange()); html_source->AddString(version_ui::kCL,
std::string(version_info::GetLastChange()));
html_source->AddString(version_ui::kUserAgent, html_source->AddString(version_ui::kUserAgent,
embedder_support::GetUserAgent()); embedder_support::GetUserAgent());
// Note that the executable path and profile path are retrieved asynchronously // Note that the executable path and profile path are retrieved asynchronously
@ -251,7 +252,8 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName()); html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName());
#elif !BUILDFLAG(IS_CHROMEOS_ASH) #elif !BUILDFLAG(IS_CHROMEOS_ASH)
html_source->AddString(version_ui::kOSType, version_info::GetOSType()); html_source->AddString(version_ui::kOSType,
std::string(version_info::GetOSType()));
#endif // BUILDFLAG(IS_MAC) #endif // BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_ANDROID)
@ -307,7 +309,7 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
: std::string()); : std::string());
html_source->AddString(version_ui::kSanitizer, html_source->AddString(version_ui::kSanitizer,
version_info::GetSanitizerList()); std::string(version_info::GetSanitizerList()));
} }
#if !BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_ANDROID)

@ -61,7 +61,7 @@ MULTIPROCESS_TEST_MAIN(GetProductVersionInChildProc) {
case ChildMode::kWithVersion: case ChildMode::kWithVersion:
// Print the current version and report success. // Print the current version and report success.
printf("%s\n", version_info::GetVersionNumber().c_str()); printf("%s\n", version_info::GetVersionNumber().data());
return 0; return 0;
} }
return 1; return 1;

@ -68,8 +68,8 @@ TEST(ChromeLocatorTest, GetChromeBundleInfoWithLatestVersion) {
base::FilePath framework_path; base::FilePath framework_path;
base::FilePath framework_dylib_path; base::FilePath framework_dylib_path;
EXPECT_TRUE(app_mode::GetChromeBundleInfo( EXPECT_TRUE(app_mode::GetChromeBundleInfo(
chrome_bundle_path, version_info::GetVersionNumber(), &executable_path, chrome_bundle_path, std::string(version_info::GetVersionNumber()),
&framework_path, &framework_dylib_path)); &executable_path, &framework_path, &framework_dylib_path));
EXPECT_TRUE(base::PathExists(executable_path)); EXPECT_TRUE(base::PathExists(executable_path));
EXPECT_TRUE(base::DirectoryExists(framework_path)); EXPECT_TRUE(base::DirectoryExists(framework_path));
EXPECT_TRUE(base::PathExists(framework_dylib_path)); EXPECT_TRUE(base::PathExists(framework_dylib_path));

@ -93,7 +93,7 @@ static_assert(
// static // static
ChromeConnectionConfig ChromeConnectionConfig::GenerateForCurrentProcess() { ChromeConnectionConfig ChromeConnectionConfig::GenerateForCurrentProcess() {
return { return {
.framework_version = version_info::GetVersionNumber(), .framework_version = std::string(version_info::GetVersionNumber()),
.is_mojo_ipcz_enabled = mojo::core::IsMojoIpczEnabled(), .is_mojo_ipcz_enabled = mojo::core::IsMojoIpczEnabled(),
}; };
} }

@ -129,7 +129,7 @@ std::string Configurator::GetLang() const {
} }
std::string Configurator::GetOSLongName() const { std::string Configurator::GetOSLongName() const {
return version_info::GetOSType(); return std::string(version_info::GetOSType());
} }
base::flat_map<std::string, std::string> Configurator::ExtraRequestParams() base::flat_map<std::string, std::string> Configurator::ExtraRequestParams()

@ -34,7 +34,7 @@ bool AuthFactorRef::operator==(const AuthFactorRef& other) const {
// =============== `AuthFactorCommonMetadata` =============== // =============== `AuthFactorCommonMetadata` ===============
AuthFactorCommonMetadata::AuthFactorCommonMetadata() AuthFactorCommonMetadata::AuthFactorCommonMetadata()
: chrome_version_last_updated_( : chrome_version_last_updated_(
ComponentVersion(version_info::GetVersionNumber())) {} ComponentVersion(std::string(version_info::GetVersionNumber()))) {}
AuthFactorCommonMetadata::AuthFactorCommonMetadata(ComponentVersion chrome, AuthFactorCommonMetadata::AuthFactorCommonMetadata(ComponentVersion chrome,
ComponentVersion chromeos) ComponentVersion chromeos)

@ -36,7 +36,8 @@ const cryptauth::DeviceClassifier& GetDeviceClassifier() {
classifier.set_device_software_version_code(version_components[0]); classifier.set_device_software_version_code(version_components[0]);
} }
classifier.set_device_software_package(version_info::GetProductName()); classifier.set_device_software_package(
std::string(version_info::GetProductName()));
return classifier; return classifier;
}()); }());

@ -10,6 +10,7 @@
#include <deque> #include <deque>
#include <map> #include <map>
#include <memory> #include <memory>
#include <string>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <utility> #include <utility>
@ -414,7 +415,7 @@ std::vector<AutofillUploadContents> FormStructure::EncodeUploadRequest(
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(observed_submission); upload.set_submission(observed_submission);
upload.set_client_version( upload.set_client_version(
version_info::GetProductNameAndVersionForUserAgent()); std::string(version_info::GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_signature().value()); upload.set_form_signature(form_signature().value());
upload.set_autofill_used(form_was_autofilled); upload.set_autofill_used(form_was_autofilled);
upload.set_data_present(data_present); upload.set_data_present(data_present);
@ -500,7 +501,7 @@ std::vector<AutofillUploadContents> FormStructure::EncodeUploadRequest(
base::flat_map<FormGlobalId, FormSignature>(std::move(subforms))) { base::flat_map<FormGlobalId, FormSignature>(std::move(subforms))) {
uploads.emplace_back(); uploads.emplace_back();
uploads.back().set_client_version( uploads.back().set_client_version(
version_info::GetProductNameAndVersionForUserAgent()); std::string(version_info::GetProductNameAndVersionForUserAgent()));
uploads.back().set_form_signature(subform_signature.value()); uploads.back().set_form_signature(subform_signature.value());
uploads.back().set_autofill_used(form_was_autofilled); uploads.back().set_autofill_used(form_was_autofilled);
uploads.back().set_data_present(data_present); uploads.back().set_data_present(data_present);
@ -521,7 +522,7 @@ bool FormStructure::EncodeQueryRequest(
queried_form_signatures->reserve(forms.size()); queried_form_signatures->reserve(forms.size());
query->set_client_version( query->set_client_version(
version_info::GetProductNameAndVersionForUserAgent()); std::string(version_info::GetProductNameAndVersionForUserAgent()));
// If a page contains repeated forms, detect that and encode only one form as // If a page contains repeated forms, detect that and encode only one form as
// the returned data would be the same for all the repeated forms. // the returned data would be the same for all the repeated forms.

@ -7,6 +7,7 @@
#include <stddef.h> #include <stddef.h>
#include <memory> #include <memory>
#include <string>
#include "base/base64.h" #include "base/base64.h"
#include "base/command_line.h" #include "base/command_line.h"
@ -2247,7 +2248,7 @@ TEST_P(ParameterizedFormStructureTest, EncodeQueryRequest) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
{ {
AutofillPageQueryRequest::Form* query_form = query.add_forms(); AutofillPageQueryRequest::Form* query_form = query.add_forms();
query_form->set_signature(form_signature.value()); query_form->set_signature(form_signature.value());
@ -2552,7 +2553,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithMatchingValidities) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("1442000308"); upload.set_data_present("1442000308");
@ -2731,7 +2733,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithNonMatchingValidities) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("1442000308"); upload.set_data_present("1442000308");
@ -2855,7 +2858,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithMultipleValidities) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("1442000308"); upload.set_data_present("1442000308");
@ -2977,7 +2981,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest) {
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_submission_event(AutofillUploadContents::HTML_FORM_SUBMISSION); upload.set_submission_event(AutofillUploadContents::HTML_FORM_SUBMISSION);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("1442000308"); upload.set_data_present("1442000308");
@ -3159,7 +3164,8 @@ TEST_F(FormStructureTestImpl,
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440000000000000000802"); upload.set_data_present("1440000000000000000802");
@ -3250,7 +3256,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithAutocomplete) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3338,7 +3345,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequestWithPropertiesMask) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3423,7 +3431,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_ObservedSubmissionFalse) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(false); upload.set_submission(false);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3497,7 +3506,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithLabels) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3570,7 +3580,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithCssClassesAndIds) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3653,7 +3664,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithFormName) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3729,7 +3741,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequestPartialMetadata) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3814,7 +3827,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_DisabledMetadata) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(true); upload.set_autofill_used(true);
upload.set_data_present("1440"); upload.set_data_present("1440");
@ -3919,7 +3933,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithSubForms) {
upload.set_submission(true); upload.set_submission(true);
upload.set_submission_event( upload.set_submission_event(
AutofillUploadContents_SubmissionIndicatorEvent_NONE); AutofillUploadContents_SubmissionIndicatorEvent_NONE);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("0000000000001850"); upload.set_data_present("0000000000001850");
@ -3939,7 +3954,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithSubForms) {
const AutofillUploadContents upload_name_exp = [&] { const AutofillUploadContents upload_name_exp = [&] {
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form.fields[0].host_form_signature.value()); upload.set_form_signature(form.fields[0].host_form_signature.value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("0000000000001850"); upload.set_data_present("0000000000001850");
@ -3952,7 +3968,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithSubForms) {
const AutofillUploadContents upload_number = [&] { const AutofillUploadContents upload_number = [&] {
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form.fields[1].host_form_signature.value()); upload.set_form_signature(form.fields[1].host_form_signature.value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("0000000000001850"); upload.set_data_present("0000000000001850");
@ -3963,7 +3980,8 @@ TEST_F(FormStructureTestImpl, EncodeUploadRequest_WithSubForms) {
const AutofillUploadContents upload_cvc = [&] { const AutofillUploadContents upload_cvc = [&] {
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form.fields[3].host_form_signature.value()); upload.set_form_signature(form.fields[3].host_form_signature.value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("0000000000001850"); upload.set_data_present("0000000000001850");
@ -4030,7 +4048,8 @@ TEST_F(FormStructureTestImpl, CheckDataPresence) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure.form_signature().value()); upload.set_form_signature(form_structure.form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present(""); upload.set_data_present("");
@ -4291,7 +4310,8 @@ TEST_F(FormStructureTestImpl, CheckMultipleTypes) {
// Prepare the expected proto string. // Prepare the expected proto string.
AutofillUploadContents upload; AutofillUploadContents upload;
upload.set_submission(true); upload.set_submission(true);
upload.set_client_version(GetProductNameAndVersionForUserAgent()); upload.set_client_version(
std::string(GetProductNameAndVersionForUserAgent()));
upload.set_form_signature(form_structure->form_signature().value()); upload.set_form_signature(form_structure->form_signature().value());
upload.set_autofill_used(false); upload.set_autofill_used(false);
upload.set_data_present("1440000360000008"); upload.set_data_present("1440000360000008");
@ -4787,7 +4807,7 @@ TEST_F(FormStructureTestImpl, SkipFieldTest) {
// Create the expected query and serialize it to a string. // Create the expected query and serialize it to a string.
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
AutofillPageQueryRequest::Form* query_form = query.add_forms(); AutofillPageQueryRequest::Form* query_form = query.add_forms();
query_form->set_signature(form_structure.form_signature().value()); query_form->set_signature(form_structure.form_signature().value());
@ -4836,7 +4856,7 @@ TEST_F(FormStructureTestImpl, EncodeQueryRequest_WithLabels) {
// Create the expected query and serialize it to a string. // Create the expected query and serialize it to a string.
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
AutofillPageQueryRequest::Form* query_form = query.add_forms(); AutofillPageQueryRequest::Form* query_form = query.add_forms();
query_form->set_signature(form_structure.form_signature().value()); query_form->set_signature(form_structure.form_signature().value());
@ -4887,7 +4907,7 @@ TEST_F(FormStructureTestImpl, EncodeQueryRequest_WithLongLabels) {
// Create the expected query and serialize it to a string. // Create the expected query and serialize it to a string.
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
AutofillPageQueryRequest::Form* query_form = query.add_forms(); AutofillPageQueryRequest::Form* query_form = query.add_forms();
query_form->set_signature(form_structure.form_signature().value()); query_form->set_signature(form_structure.form_signature().value());
@ -4933,7 +4953,7 @@ TEST_F(FormStructureTestImpl, EncodeQueryRequest_MissingNames) {
// Create the expected query and serialize it to a string. // Create the expected query and serialize it to a string.
AutofillPageQueryRequest query; AutofillPageQueryRequest query;
query.set_client_version(GetProductNameAndVersionForUserAgent()); query.set_client_version(std::string(GetProductNameAndVersionForUserAgent()));
AutofillPageQueryRequest::Form* query_form = query.add_forms(); AutofillPageQueryRequest::Form* query_form = query.add_forms();
query_form->set_signature(form_structure.form_signature().value()); query_form->set_signature(form_structure.form_signature().value());

@ -89,7 +89,7 @@ const base::Version& ConfiguratorImpl::GetBrowserVersion() const {
} }
std::string ConfiguratorImpl::GetOSLongName() const { std::string ConfiguratorImpl::GetOSLongName() const {
return version_info::GetOSType(); return std::string(version_info::GetOSType());
} }
base::flat_map<std::string, std::string> ConfiguratorImpl::ExtraRequestParams() base::flat_map<std::string, std::string> ConfiguratorImpl::ExtraRequestParams()

@ -4,6 +4,7 @@
#include "components/embedder_support/user_agent_utils.h" #include "components/embedder_support/user_agent_utils.h"
#include <string>
#include <vector> #include <vector>
#include "base/command_line.h" #include "base/command_line.h"
@ -232,7 +233,7 @@ std::string GetVersionNumber(const UserAgentOptions& options) {
// Force major version to 99. // Force major version to 99.
return ShouldForceMajorVersionToMinorPosition(options.force_major_to_minor) return ShouldForceMajorVersionToMinorPosition(options.force_major_to_minor)
? GetMajorInMinorVersionNumber() ? GetMajorInMinorVersionNumber()
: version_info::GetVersionNumber(); : std::string(version_info::GetVersionNumber());
} }
const blink::UserAgentBrandList GetUserAgentBrandList( const blink::UserAgentBrandList GetUserAgentBrandList(
@ -273,7 +274,7 @@ const blink::UserAgentBrandList GetUserAgentBrandMajorVersionList(
bool enable_updated_grease_by_policy) { bool enable_updated_grease_by_policy) {
return GetUserAgentBrandList(version_info::GetMajorVersionNumber(), return GetUserAgentBrandList(version_info::GetMajorVersionNumber(),
enable_updated_grease_by_policy, enable_updated_grease_by_policy,
version_info::GetVersionNumber(), std::string(version_info::GetVersionNumber()),
blink::UserAgentBrandVersionType::kMajorVersion); blink::UserAgentBrandVersionType::kMajorVersion);
} }
@ -291,7 +292,7 @@ blink::UserAgentBrandList GetUserAgentBrandFullVersionList(
bool enable_updated_grease_by_policy) { bool enable_updated_grease_by_policy) {
return GetUserAgentBrandList(version_info::GetMajorVersionNumber(), return GetUserAgentBrandList(version_info::GetMajorVersionNumber(),
enable_updated_grease_by_policy, enable_updated_grease_by_policy,
version_info::GetVersionNumber(), std::string(version_info::GetVersionNumber()),
blink::UserAgentBrandVersionType::kFullVersion); blink::UserAgentBrandVersionType::kFullVersion);
} }
@ -358,7 +359,8 @@ std::string GetProductAndVersion(
return ShouldReduceUserAgentMinorVersion(user_agent_reduction) return ShouldReduceUserAgentMinorVersion(user_agent_reduction)
? version_info::GetProductNameAndVersionForReducedUserAgent( ? version_info::GetProductNameAndVersionForReducedUserAgent(
blink::features::kUserAgentFrozenBuildVersion.Get()) blink::features::kUserAgentFrozenBuildVersion.Get())
: version_info::GetProductNameAndVersionForUserAgent(); : std::string(
version_info::GetProductNameAndVersionForUserAgent());
} }
// Internal function to handle return the full or "reduced" user agent string, // Internal function to handle return the full or "reduced" user agent string,
@ -577,7 +579,7 @@ std::string GetPlatformForUAMetadata() {
return "Chromium OS"; return "Chromium OS";
# endif # endif
#else #else
return version_info::GetOSType(); return std::string(version_info::GetOSType());
#endif #endif
} }

@ -4,6 +4,7 @@
#include "components/embedder_support/user_agent_utils.h" #include "components/embedder_support/user_agent_utils.h"
#include <string>
#include <vector> #include <vector>
#include "base/command_line.h" #include "base/command_line.h"
@ -462,7 +463,7 @@ TEST_F(UserAgentUtilsTest, InvalidCustomUserAgent) {
// Make sure all APIs have the correct behavior once user provide invalid // Make sure all APIs have the correct behavior once user provide invalid
// custom user agent. // custom user agent.
const std::string major_version = version_info::GetMajorVersionNumber(); const std::string major_version = version_info::GetMajorVersionNumber();
const std::string full_version = version_info::GetVersionNumber(); const std::string full_version(version_info::GetVersionNumber());
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(blink::features::kReduceUserAgent); scoped_feature_list.InitAndEnableFeature(blink::features::kReduceUserAgent);
@ -824,7 +825,7 @@ TEST_F(UserAgentUtilsTest, UserAgentMetadata) {
auto metadata = GetUserAgentMetadata(); auto metadata = GetUserAgentMetadata();
const std::string major_version = version_info::GetMajorVersionNumber(); const std::string major_version = version_info::GetMajorVersionNumber();
const std::string full_version = version_info::GetVersionNumber(); const std::string full_version(version_info::GetVersionNumber());
const std::string major_to_minor_full_version = MajorToMinorVersionNumber(); const std::string major_to_minor_full_version = MajorToMinorVersionNumber();
// According to spec, Sec-CH-UA should contain what project the browser is // According to spec, Sec-CH-UA should contain what project the browser is
@ -837,9 +838,9 @@ TEST_F(UserAgentUtilsTest, UserAgentMetadata) {
const blink::UserAgentBrandVersion major_to_minor_chromium_brand_version = { const blink::UserAgentBrandVersion major_to_minor_chromium_brand_version = {
"Chromium", "99"}; "Chromium", "99"};
const blink::UserAgentBrandVersion product_brand_version = { const blink::UserAgentBrandVersion product_brand_version = {
version_info::GetProductName(), major_version}; std::string(version_info::GetProductName()), major_version};
const blink::UserAgentBrandVersion major_to_minor_product_brand_version = { const blink::UserAgentBrandVersion major_to_minor_product_brand_version = {
version_info::GetProductName(), "99"}; std::string(version_info::GetProductName()), "99"};
EXPECT_TRUE(ContainsBrandVersion(metadata.brand_version_list, EXPECT_TRUE(ContainsBrandVersion(metadata.brand_version_list,
chromium_brand_version)); chromium_brand_version));
@ -853,9 +854,10 @@ TEST_F(UserAgentUtilsTest, UserAgentMetadata) {
major_to_minor_chromium_brand_full_version = { major_to_minor_chromium_brand_full_version = {
"Chromium", major_to_minor_full_version}; "Chromium", major_to_minor_full_version};
const blink::UserAgentBrandVersion product_brand_full_version = { const blink::UserAgentBrandVersion product_brand_full_version = {
version_info::GetProductName(), full_version}; std::string(version_info::GetProductName()), full_version};
const blink::UserAgentBrandVersion major_to_minor_product_brand_full_version = const blink::UserAgentBrandVersion major_to_minor_product_brand_full_version =
{version_info::GetProductName(), major_to_minor_full_version}; {std::string(version_info::GetProductName()),
major_to_minor_full_version};
EXPECT_TRUE(ContainsBrandVersion(metadata.brand_full_version_list, EXPECT_TRUE(ContainsBrandVersion(metadata.brand_full_version_list,
chromium_brand_full_version)); chromium_brand_full_version));

@ -57,7 +57,7 @@ void BrowserReportGenerator::GenerateBasicInfo(em::BrowserReport* report,
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
if (contains_version_and_channel) { if (contains_version_and_channel) {
report->set_browser_version(version_info::GetVersionNumber()); report->set_browser_version(std::string(version_info::GetVersionNumber()));
report->set_channel(policy::ConvertToProtoChannel(delegate_->GetChannel())); report->set_channel(policy::ConvertToProtoChannel(delegate_->GetChannel()));
if (delegate_->IsExtendedStableChannel()) if (delegate_->IsExtendedStableChannel())
report->set_is_extended_stable_channel(true); report->set_is_extended_stable_channel(true);

@ -30,7 +30,7 @@ void RegisterProductDataForCrashReporting(
fuchsia::feedback::CrashReportingProduct product_data; fuchsia::feedback::CrashReportingProduct product_data;
product_data.set_name(std::string(crash_product_name)); product_data.set_name(std::string(crash_product_name));
product_data.set_version(version_info::GetVersionNumber()); product_data.set_version(std::string(version_info::GetVersionNumber()));
// TODO(https://crbug.com/1077428): Use the actual channel when appropriate. // TODO(https://crbug.com/1077428): Use the actual channel when appropriate.
// For now, always set it to the empty string to avoid reporting "missing". // For now, always set it to the empty string to avoid reporting "missing".
product_data.set_channel(""); product_data.set_channel("");
@ -58,7 +58,7 @@ void RegisterProductDataForFeedback(base::StringPiece component_namespace) {
component_data.set_namespace_(std::string(component_namespace)); component_data.set_namespace_(std::string(component_namespace));
// TODO(https://crbug.com/1077428): Add release channel to the annotations. // TODO(https://crbug.com/1077428): Add release channel to the annotations.
component_data.mutable_annotations()->push_back( component_data.mutable_annotations()->push_back(
{"version", version_info::GetVersionNumber()}); {"version", std::string(version_info::GetVersionNumber())});
base::ComponentContextForProcess() base::ComponentContextForProcess()
->svc() ->svc()
->Connect<fuchsia::feedback::ComponentDataRegister>() ->Connect<fuchsia::feedback::ComponentDataRegister>()

@ -19,10 +19,10 @@ void PublishVersionInfoToInspect(sys::ComponentInspector* inspector) {
// These values are managed by the inspector, since they won't be updated over // These values are managed by the inspector, since they won't be updated over
// the lifetime of the component. // the lifetime of the component.
// TODO(https://crbug.com/1077428): Add release channel. // TODO(https://crbug.com/1077428): Add release channel.
inspector->root().CreateString(kVersion, version_info::GetVersionNumber(), inspector->root().CreateString(
inspector); kVersion, std::string(version_info::GetVersionNumber()), inspector);
inspector->root().CreateString(kLastChange, version_info::GetLastChange(), inspector->root().CreateString(
inspector); kLastChange, std::string(version_info::GetLastChange()), inspector);
} }
} // namespace fuchsia_component_support } // namespace fuchsia_component_support

@ -57,7 +57,7 @@ GCMClient::ChromeChannel GetChannel(version_info::Channel channel) {
} }
std::string GetVersion() { std::string GetVersion() {
return version_info::GetVersionNumber(); return std::string(version_info::GetVersionNumber());
} }
GCMClient::ChromeBuildInfo GetChromeBuildInfo( GCMClient::ChromeBuildInfo GetChromeBuildInfo(

@ -16,7 +16,7 @@
namespace metrics { namespace metrics {
std::string GetVersionString() { std::string GetVersionString() {
std::string version = version_info::GetVersionNumber(); std::string version(version_info::GetVersionNumber());
#if defined(ARCH_CPU_64_BITS) #if defined(ARCH_CPU_64_BITS)
version += "-64"; version += "-64";
#endif // defined(ARCH_CPU_64_BITS) #endif // defined(ARCH_CPU_64_BITS)

@ -230,8 +230,8 @@ static void WriteAnrAsMime(crashpad::FileReader* anr_reader,
crashpad::HTTPMultipartBuilder builder; crashpad::HTTPMultipartBuilder builder;
builder.SetFormData("version", version_number); builder.SetFormData("version", version_number);
builder.SetFormData("product", "Chrome_Android"); builder.SetFormData("product", "Chrome_Android");
builder.SetFormData("channel", version_info::GetChannelString( builder.SetFormData("channel", std::string(version_info::GetChannelString(
version_info::android::GetChannel())); version_info::android::GetChannel())));
if (!build_id.empty()) { if (!build_id.empty()) {
builder.SetFormData("elf_build_id", build_id); builder.SetFormData("elf_build_id", build_id);
} }

@ -155,7 +155,7 @@ std::string GetOSVersion() {
} }
std::string GetOSPlatform() { std::string GetOSPlatform() {
return version_info::GetOSType(); return std::string(version_info::GetOSType());
} }
std::string GetOSArchitecture() { std::string GetOSArchitecture() {

@ -60,7 +60,7 @@ std::string GetLogSeverity(const PolicyLogger::Log::Severity log_severity) {
// Constructs the URL for Chromium Code Search that points to the line of code // Constructs the URL for Chromium Code Search that points to the line of code
// that generated the log and the Chromium git revision hash. // that generated the log and the Chromium git revision hash.
std::string GetLineURL(const base::Location location) { std::string GetLineURL(const base::Location location) {
std::string last_change = version_info::GetLastChange(); std::string last_change(version_info::GetLastChange());
// The substring separates the last change commit hash from the branch name on // The substring separates the last change commit hash from the branch name on
// the '-'. // the '-'.

@ -81,7 +81,7 @@ V4ProtocolConfig GetV4ProtocolConfig(const std::string& client_name,
bool disable_auto_update) { bool disable_auto_update) {
return V4ProtocolConfig(client_name, disable_auto_update, return V4ProtocolConfig(client_name, disable_auto_update,
google_apis::GetAPIKey(), google_apis::GetAPIKey(),
version_info::GetVersionNumber()); std::string(version_info::GetVersionNumber()));
} }
void SetSbV4UrlPrefixForTesting(const char* url_prefix) { void SetSbV4UrlPrefixForTesting(const char* url_prefix) {

@ -486,8 +486,9 @@ CertificateErrorReport::CertificateErrorReport(
chrome_browser_ssl::CertLoggerFeaturesInfo::ANDROID_AIA_FETCHING_ENABLED); chrome_browser_ssl::CertLoggerFeaturesInfo::ANDROID_AIA_FETCHING_ENABLED);
#endif #endif
cert_report_->set_chrome_version(version_info::GetVersionNumber()); cert_report_->set_chrome_version(
cert_report_->set_os_type(version_info::GetOSType()); std::string(version_info::GetVersionNumber()));
cert_report_->set_os_type(std::string(version_info::GetOSType()));
cert_report_->set_os_version(base::SysInfo::OperatingSystemVersion()); cert_report_->set_os_version(base::SysInfo::OperatingSystemVersion());
cert_report_->set_hardware_model_name(base::SysInfo::HardwareModelName()); cert_report_->set_hardware_model_name(base::SysInfo::HardwareModelName());
cert_report_->set_os_architecture( cert_report_->set_os_architecture(

@ -158,7 +158,7 @@ const char* UpdateQueryParams::GetNaclArch() {
// static // static
std::string UpdateQueryParams::GetProdVersion() { std::string UpdateQueryParams::GetProdVersion() {
return version_info::GetVersionNumber(); return std::string(version_info::GetVersionNumber());
} }
// static // static

@ -9,6 +9,7 @@
#include "base/notreached.h" #include "base/notreached.h"
#include "base/sanitizer_buildflags.h" #include "base/sanitizer_buildflags.h"
#include "base/strings/string_piece.h"
#include "build/branding_buildflags.h" #include "build/branding_buildflags.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/version_info/channel.h" #include "components/version_info/channel.h"
@ -27,18 +28,18 @@ const std::string GetProductNameAndVersionForReducedUserAgent(
const std::string& build_version); const std::string& build_version);
// Returns the product name, e.g. "Chromium" or "Google Chrome". // Returns the product name, e.g. "Chromium" or "Google Chrome".
constexpr std::string GetProductName() { constexpr base::StringPiece GetProductName() {
return PRODUCT_NAME; return PRODUCT_NAME;
} }
// Returns the version number, e.g. "6.0.490.1". // Returns the version number, e.g. "6.0.490.1".
constexpr std::string GetVersionNumber() { constexpr base::StringPiece GetVersionNumber() {
return PRODUCT_VERSION; return PRODUCT_VERSION;
} }
// Returns the product name and version information for the User-Agent header, // Returns the product name and version information for the User-Agent header,
// in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>. // in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>.
constexpr std::string GetProductNameAndVersionForUserAgent() { constexpr base::StringPiece GetProductNameAndVersionForUserAgent() {
return "Chrome/" PRODUCT_VERSION; return "Chrome/" PRODUCT_VERSION;
} }
@ -53,7 +54,7 @@ std::string GetMajorVersionNumber();
const base::Version& GetVersion(); const base::Version& GetVersion();
// Returns a version control specific identifier of this release. // Returns a version control specific identifier of this release.
constexpr std::string GetLastChange() { constexpr base::StringPiece GetLastChange() {
return LAST_CHANGE; return LAST_CHANGE;
} }
@ -65,7 +66,7 @@ constexpr bool IsOfficialBuild() {
} }
// Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ... // Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ...
constexpr std::string GetOSType() { constexpr base::StringPiece GetOSType() {
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
return "Windows"; return "Windows";
#elif BUILDFLAG(IS_IOS) #elif BUILDFLAG(IS_IOS)
@ -97,7 +98,7 @@ constexpr std::string GetOSType() {
// Returns a string equivalent of |channel|, independent of whether the build // Returns a string equivalent of |channel|, independent of whether the build
// is branded or not and without any additional modifiers. // is branded or not and without any additional modifiers.
constexpr std::string GetChannelString(Channel channel) { constexpr base::StringPiece GetChannelString(Channel channel) {
switch (channel) { switch (channel) {
case Channel::STABLE: case Channel::STABLE:
return "stable"; return "stable";
@ -114,7 +115,7 @@ constexpr std::string GetChannelString(Channel channel) {
} }
// Returns a list of sanitizers enabled in this build. // Returns a list of sanitizers enabled in this build.
constexpr std::string GetSanitizerList() { constexpr base::StringPiece GetSanitizerList() {
return "" return ""
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER)
"address " "address "

@ -106,7 +106,8 @@ std::unique_ptr<std::string> BuildProtoInBackground(
webapk->set_manifest_url(shortcut_info.manifest_url.spec()); webapk->set_manifest_url(shortcut_info.manifest_url.spec());
webapk->set_requester_application_package( webapk->set_requester_application_package(
base::android::BuildInfo::GetInstance()->package_name()); base::android::BuildInfo::GetInstance()->package_name());
webapk->set_requester_application_version(version_info::GetVersionNumber()); webapk->set_requester_application_version(
std::string(version_info::GetVersionNumber()));
webapk->set_android_abi(getCurrentAbi()); webapk->set_android_abi(getCurrentAbi());
webapk->set_package_name(package_name); webapk->set_package_name(package_name);
webapk->set_version(version); webapk->set_version(version);

@ -321,7 +321,7 @@ std::string ShellExtensionsBrowserClient::GetApplicationLocale() {
std::string ShellExtensionsBrowserClient::GetUserAgent() const { std::string ShellExtensionsBrowserClient::GetUserAgent() const {
return content::BuildUserAgentFromProduct( return content::BuildUserAgentFromProduct(
version_info::GetProductNameAndVersionForUserAgent()); std::string(version_info::GetProductNameAndVersionForUserAgent()));
} }
void ShellExtensionsBrowserClient::InitWithBrowserContext( void ShellExtensionsBrowserClient::InitWithBrowserContext(

@ -48,7 +48,7 @@ bool InitLoggingFromCommandLineDefaultingToStderrForTest(
void LogComponentStartWithVersion(base::StringPiece component_name) { void LogComponentStartWithVersion(base::StringPiece component_name) {
std::string version_string = base::StringPrintf( std::string version_string = base::StringPrintf(
"Starting %.*s %s", base::saturated_cast<int>(component_name.length()), "Starting %.*s %s", base::saturated_cast<int>(component_name.length()),
component_name.data(), version_info::GetVersionNumber().c_str()); component_name.data(), version_info::GetVersionNumber().data());
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
version_string += version_string +=
base::StrCat({" (built at ", version_info::GetLastChange(), ")"}); base::StrCat({" (built at ", version_info::GetLastChange(), ")"});

@ -169,7 +169,7 @@ WebEngineContentBrowserClient::CreateDevToolsManagerDelegate() {
} }
std::string WebEngineContentBrowserClient::GetProduct() { std::string WebEngineContentBrowserClient::GetProduct() {
return version_info::GetProductNameAndVersionForUserAgent(); return std::string(version_info::GetProductNameAndVersionForUserAgent());
} }
std::string WebEngineContentBrowserClient::GetUserAgent() { std::string WebEngineContentBrowserClient::GetUserAgent() {

@ -624,10 +624,10 @@ std::string OmahaService::GetCurrentPingContent() {
// An install retry ping only makes sense if an install event must be send. // An install retry ping only makes sense if an install event must be send.
DCHECK(sending_install_event_ || !IsNextPingInstallRetry()); DCHECK(sending_install_event_ || !IsNextPingInstallRetry());
std::string request_id = GetNextPingRequestId(ping_content); std::string request_id = GetNextPingRequestId(ping_content);
return GetPingContent(request_id, ios::device_util::GetRandomId(), return GetPingContent(
version_info::GetVersionNumber(), GetChannelString(), request_id, ios::device_util::GetRandomId(),
base::Time::FromTimeT(application_install_date_), std::string(version_info::GetVersionNumber()), GetChannelString(),
ping_content); base::Time::FromTimeT(application_install_date_), ping_content);
} }
void OmahaService::SendPing() { void OmahaService::SendPing() {

@ -149,7 +149,7 @@ TEST_F(OmahaServiceTest, PingMessageTest) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
std::string content = service.GetPingContent( std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(), "requestId", "sessionId", std::string(version_info::GetVersionNumber()),
GetChannelString(), base::Time::Now(), OmahaService::USAGE_PING); GetChannelString(), base::Time::Now(), OmahaService::USAGE_PING);
regex_t regex; regex_t regex;
regcomp(&regex, expectedResult, REG_NOSUB); regcomp(&regex, expectedResult, REG_NOSUB);
@ -177,7 +177,7 @@ TEST_F(OmahaServiceTest, PingMessageTestWithUnknownInstallDate) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
std::string content = service.GetPingContent( std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(), "requestId", "sessionId", std::string(version_info::GetVersionNumber()),
GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate), GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate),
OmahaService::USAGE_PING); OmahaService::USAGE_PING);
regex_t regex; regex_t regex;
@ -210,7 +210,7 @@ TEST_F(OmahaServiceTest, InstallEventMessageTest) {
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
CleanService(&service, ""); CleanService(&service, "");
std::string content = service.GetPingContent( std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(), "requestId", "sessionId", std::string(version_info::GetVersionNumber()),
GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT); GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT);
regmatch_t matches[2]; regmatch_t matches[2];
regex_t regex; regex_t regex;
@ -227,7 +227,7 @@ TEST_F(OmahaServiceTest, InstallEventMessageTest) {
const char* kPreviousVersion = "0.5"; const char* kPreviousVersion = "0.5";
CleanService(&service, kPreviousVersion); CleanService(&service, kPreviousVersion);
content = service.GetPingContent( content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(), "requestId", "sessionId", std::string(version_info::GetVersionNumber()),
GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT); GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT);
expected_result = base::StringPrintf(kExpectedResultFormat, kPreviousVersion, expected_result = base::StringPrintf(kExpectedResultFormat, kPreviousVersion,
0 /* install age */, 3 /* event type */); 0 /* install age */, 3 /* event type */);
@ -246,7 +246,7 @@ TEST_F(OmahaServiceTest, SendPingSuccess) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -275,7 +275,7 @@ TEST_F(OmahaServiceTest, PingUpToDateUpdatesUserDefaults) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -296,7 +296,7 @@ TEST_F(OmahaServiceTest, PingOutOfDateUpdatesUserDefaults) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -337,7 +337,7 @@ TEST_F(OmahaServiceTest, CallbackForScheduledNotUsedOnErrorResponse) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -375,7 +375,7 @@ TEST_F(OmahaServiceTest, OneOffSuccess) {
base::BindOnce(^(UpgradeRecommendedDetails details) { base::BindOnce(^(UpgradeRecommendedDetails details) {
OmahaServiceTest::OneOffCheck(details); OmahaServiceTest::OneOffCheck(details);
}); });
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -405,7 +405,7 @@ TEST_F(OmahaServiceTest, OngoingPingOneOffCallbackUsed) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -447,7 +447,7 @@ TEST_F(OmahaServiceTest, OneOffCallbackUsedOnlyOnce) {
base::BindOnce(^(UpgradeRecommendedDetails details) { base::BindOnce(^(UpgradeRecommendedDetails details) {
OmahaServiceTest::OneOffCheck(details); OmahaServiceTest::OneOffCheck(details);
}); });
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -491,7 +491,7 @@ TEST_F(OmahaServiceTest, ScheduledPingDuringOneOffDropped) {
base::BindOnce(^(UpgradeRecommendedDetails details) { base::BindOnce(^(UpgradeRecommendedDetails details) {
OmahaServiceTest::OneOffCheck(details); OmahaServiceTest::OneOffCheck(details);
}); });
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -528,7 +528,7 @@ TEST_F(OmahaServiceTest, ParseAndEchoLastServerDate) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -550,7 +550,7 @@ TEST_F(OmahaServiceTest, ParseAndEchoLastServerDate) {
"<ping active=\"1\" ad=\"4088\" rd=\"4088\"/></app></request>"; "<ping active=\"1\" ad=\"4088\" rd=\"4088\"/></app></request>";
std::string content = service.GetPingContent( std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(), "requestId", "sessionId", std::string(version_info::GetVersionNumber()),
GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate), GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate),
OmahaService::USAGE_PING); OmahaService::USAGE_PING);
regex_t regex; regex_t regex;
@ -603,7 +603,7 @@ TEST_F(OmahaServiceTest, SendPingReceiveUpdate) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -650,7 +650,7 @@ TEST_F(OmahaServiceTest, SendPingFailure) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();
@ -695,7 +695,7 @@ TEST_F(OmahaServiceTest, SendPingFailure) {
} }
TEST_F(OmahaServiceTest, PersistStatesTest) { TEST_F(OmahaServiceTest, PersistStatesTest) {
std::string version_string = version_info::GetVersionNumber(); std::string version_string(version_info::GetVersionNumber());
base::Time now = base::Time::Now(); base::Time now = base::Time::Now();
OmahaService service(false); OmahaService service(false);
service.StartInternal(); service.StartInternal();
@ -780,7 +780,7 @@ TEST_F(OmahaServiceTest, NonSpammingTest) {
service.set_upgrade_recommended_callback(base::BindRepeating( service.set_upgrade_recommended_callback(base::BindRepeating(
&OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber()); CleanService(&service, std::string(version_info::GetVersionNumber()));
service.SendPing(); service.SendPing();

@ -182,7 +182,7 @@ const CGFloat kDefaultHeight = 70;
} }
- (std::string)versionString { - (std::string)versionString {
std::string versionString = version_info::GetVersionNumber(); std::string versionString(version_info::GetVersionNumber());
std::string versionStringModifier = GetChannelString(); std::string versionStringModifier = GetChannelString();
if (!versionStringModifier.empty()) { if (!versionStringModifier.empty()) {
versionString = versionString + " " + versionStringModifier; versionString = versionString + " " + versionStringModifier;

@ -34,13 +34,15 @@ web::WebUIIOSDataSource* CreateInternalsHTMLSource(
IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS); IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS);
source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML); source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML);
// Data strings: // Data strings:
source->AddString(version_ui::kVersion, version_info::GetVersionNumber()); source->AddString(version_ui::kVersion,
std::string(version_info::GetVersionNumber()));
source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild() source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild()
? "official" ? "official"
: "Developer build"); : "Developer build");
source->AddString(version_ui::kVersionModifier, source->AddString(version_ui::kVersionModifier,
GetChannelString(GetChannel())); std::string(GetChannelString(GetChannel())));
source->AddString(version_ui::kCL, version_info::GetLastChange()); source->AddString(version_ui::kCL,
std::string(version_info::GetLastChange()));
source->AddString(version_ui::kUserAgent, web::GetWebClient()->GetUserAgent( source->AddString(version_ui::kUserAgent, web::GetWebClient()->GetUserAgent(
web::UserAgentType::MOBILE)); web::UserAgentType::MOBILE));
source->AddString("app_locale", source->AddString("app_locale",

@ -42,7 +42,8 @@ namespace {
web::WebUIIOSDataSource* CreateFlagsUIHTMLSource() { web::WebUIIOSDataSource* CreateFlagsUIHTMLSource() {
web::WebUIIOSDataSource* source = web::WebUIIOSDataSource* source =
web::WebUIIOSDataSource::Create(kChromeUIFlagsHost); web::WebUIIOSDataSource::Create(kChromeUIFlagsHost);
source->AddString(flags_ui::kVersion, version_info::GetVersionNumber()); source->AddString(flags_ui::kVersion,
std::string(version_info::GetVersionNumber()));
source->UseStringsJs(); source->UseStringsJs();
FlagsUI::AddFlagsIOSStrings(source); FlagsUI::AddFlagsIOSStrings(source);

@ -188,10 +188,10 @@ std::string PolicyUIHandler::GetPoliciesAsJson() {
GetStatusValue(), GetStatusValue(),
policy::JsonGenerationParams() policy::JsonGenerationParams()
.with_application_name(l10n_util::GetStringUTF8(IDS_IOS_PRODUCT_NAME)) .with_application_name(l10n_util::GetStringUTF8(IDS_IOS_PRODUCT_NAME))
.with_channel_name(GetChannelString(GetChannel())) .with_channel_name(std::string(GetChannelString(GetChannel())))
.with_processor_variation(l10n_util::GetStringUTF8( .with_processor_variation(l10n_util::GetStringUTF8(
sizeof(void*) == 8 ? IDS_VERSION_UI_64BIT : IDS_VERSION_UI_32BIT)) sizeof(void*) == 8 ? IDS_VERSION_UI_64BIT : IDS_VERSION_UI_32BIT))
.with_os_name(version_info::GetOSType())); .with_os_name(std::string(version_info::GetOSType())));
} }
void PolicyUIHandler::OnSchemaRegistryUpdated(bool has_new_schemas) { void PolicyUIHandler::OnSchemaRegistryUpdated(bool has_new_schemas) {

@ -49,11 +49,12 @@ web::WebUIIOSDataSource* CreateVersionUIDataSource() {
html_source->AddLocalizedString(version_ui::kApplicationLabel, html_source->AddLocalizedString(version_ui::kApplicationLabel,
IDS_IOS_PRODUCT_NAME); IDS_IOS_PRODUCT_NAME);
html_source->AddString(version_ui::kVersion, html_source->AddString(version_ui::kVersion,
version_info::GetVersionNumber()); std::string(version_info::GetVersionNumber()));
html_source->AddString(version_ui::kVersionModifier, html_source->AddString(version_ui::kVersionModifier,
GetChannelString(GetChannel())); std::string(GetChannelString(GetChannel())));
html_source->AddLocalizedString(version_ui::kOSName, IDS_VERSION_UI_OS); html_source->AddLocalizedString(version_ui::kOSName, IDS_VERSION_UI_OS);
html_source->AddString(version_ui::kOSType, version_info::GetOSType()); html_source->AddString(version_ui::kOSType,
std::string(version_info::GetOSType()));
html_source->AddLocalizedString(version_ui::kCompany, html_source->AddLocalizedString(version_ui::kCompany,
IDS_IOS_ABOUT_VERSION_COMPANY_NAME); IDS_IOS_ABOUT_VERSION_COMPANY_NAME);
@ -67,7 +68,7 @@ web::WebUIIOSDataSource* CreateVersionUIDataSource() {
base::NumberToString16(exploded_time.year))); base::NumberToString16(exploded_time.year)));
html_source->AddLocalizedString(version_ui::kRevision, html_source->AddLocalizedString(version_ui::kRevision,
IDS_VERSION_UI_REVISION); IDS_VERSION_UI_REVISION);
std::string last_change = version_info::GetLastChange(); std::string last_change(version_info::GetLastChange());
// Shorten the git hash to display it correctly on small devices. // Shorten the git hash to display it correctly on small devices.
if ((ui::GetDeviceFormFactor() != ui::DEVICE_FORM_FACTOR_TABLET) && if ((ui::GetDeviceFormFactor() != ui::DEVICE_FORM_FACTOR_TABLET) &&
last_change.length() > 12) { last_change.length() > 12) {
@ -110,7 +111,8 @@ web::WebUIIOSDataSource* CreateVersionUIDataSource() {
version_ui::SeedTypeToUiString( version_ui::SeedTypeToUiString(
GetApplicationContext()->GetVariationsService()->GetSeedType())); GetApplicationContext()->GetVariationsService()->GetSeedType()));
html_source->AddString(version_ui::kSanitizer, version_info::GetSanitizerList()); html_source->AddString(version_ui::kSanitizer,
std::string(version_info::GetSanitizerList()));
html_source->UseStringsJs(); html_source->UseStringsJs();
html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS);

@ -56,7 +56,7 @@ using chrome_test_util::ForwardButton;
[ChromeEarlGrey loadURL:WebUIPageUrlWithHost(kChromeUIVersionHost)]; [ChromeEarlGrey loadURL:WebUIPageUrlWithHost(kChromeUIVersionHost)];
// Verify that app version is present on the page. // Verify that app version is present on the page.
const std::string version = version_info::GetVersionNumber(); const std::string version(version_info::GetVersionNumber());
[ChromeEarlGrey waitForWebStateContainingText:version]; [ChromeEarlGrey waitForWebStateContainingText:version];
NSString* userAgent = [ChromeEarlGrey mobileUserAgentString]; NSString* userAgent = [ChromeEarlGrey mobileUserAgentString];

@ -177,7 +177,7 @@ NSString* GetHttpsOnlyModeErrorPageHtml(web::WebState* web_state,
// form "productname/version". Used as part of the user agent string. // form "productname/version". Used as part of the user agent string.
std::string GetMobileProduct() { std::string GetMobileProduct() {
return base::StringPrintf(kProductTagWithPlaceholder, return base::StringPrintf(kProductTagWithPlaceholder,
version_info::GetVersionNumber().c_str()); version_info::GetVersionNumber().data());
} }
// Returns a string describing the product name and version, of the // Returns a string describing the product name and version, of the

@ -416,7 +416,7 @@ class PausableResponseProvider : public HtmlResponseProvider {
[ChromeEarlGrey goForward]; [ChromeEarlGrey goForward];
[ChromeEarlGrey goForward]; [ChromeEarlGrey goForward];
const std::string version = version_info::GetVersionNumber(); const std::string version(version_info::GetVersionNumber());
[ChromeEarlGrey waitForWebStateContainingText:version]; [ChromeEarlGrey waitForWebStateContainingText:version];
// Make sure that kChromeUIVersionURL URL is displayed in the omnibox. // Make sure that kChromeUIVersionURL URL is displayed in the omnibox.

@ -578,7 +578,7 @@ base::Value CWTRequestHandler::GetVersionInfo() {
// The full revision starts with a git hash and ends with the revision // The full revision starts with a git hash and ends with the revision
// number in the following format: @{#123456} // number in the following format: @{#123456}
std::string full_revision = version_info::GetLastChange(); std::string full_revision(version_info::GetLastChange());
size_t start_position = full_revision.rfind("#") + 1; size_t start_position = full_revision.rfind("#") + 1;
if (start_position == std::string::npos) { if (start_position == std::string::npos) {

@ -127,7 +127,8 @@ WebViewDeviceInfoSyncServiceFactory::BuildServiceInstanceFor(
browser_state->GetPrefs(), sync_invalidations_service); browser_state->GetPrefs(), sync_invalidations_service);
auto local_device_info_provider = auto local_device_info_provider =
std::make_unique<syncer::LocalDeviceInfoProviderImpl>( std::make_unique<syncer::LocalDeviceInfoProviderImpl>(
version_info::Channel::STABLE, version_info::GetVersionNumber(), version_info::Channel::STABLE,
std::string(version_info::GetVersionNumber()),
device_info_sync_client.get()); device_info_sync_client.get());
auto device_prefs = std::make_unique<syncer::DeviceInfoPrefs>( auto device_prefs = std::make_unique<syncer::DeviceInfoPrefs>(
browser_state->GetPrefs(), base::DefaultClock::GetInstance()); browser_state->GetPrefs(), base::DefaultClock::GetInstance());

@ -134,7 +134,8 @@ SCTAuditingCache::MaybeGenerateReportEntry(
} }
RecordSCTAuditingReportDeduplicatedMetrics(false); RecordSCTAuditingReportDeduplicatedMetrics(false);
report->set_user_agent(version_info::GetProductNameAndVersionForUserAgent()); report->set_user_agent(
std::string(version_info::GetProductNameAndVersionForUserAgent()));
// Add `cache_key` to the dedupe cache. The cache value is not used. // Add `cache_key` to the dedupe cache. The cache value is not used.
dedupe_cache_.Put(cache_key, true); dedupe_cache_.Put(cache_key, true);

@ -422,7 +422,7 @@ void ContentBrowserClientImpl::LogWebFeatureForCurrentPage(
} }
std::string ContentBrowserClientImpl::GetProduct() { std::string ContentBrowserClientImpl::GetProduct() {
return version_info::GetProductNameAndVersionForUserAgent(); return std::string(version_info::GetProductNameAndVersionForUserAgent());
} }
std::string ContentBrowserClientImpl::GetUserAgent() { std::string ContentBrowserClientImpl::GetUserAgent() {