Commit 8dbfcb62 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Use version_info::GetVersion() where appropriate.

Instead of writing base::Version(version_info::GetVersionNumber()).

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I0a2c0826ffced29d22151bac51537da227b6dd95
Reviewed-on: https://chromium-review.googlesource.com/989092Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548268}
parent 7311d79c
...@@ -16,7 +16,7 @@ namespace { ...@@ -16,7 +16,7 @@ namespace {
// on a thread where IO is allowed. // on a thread where IO is allowed.
base::Version GetVersionForSimulation() { base::Version GetVersionForSimulation() {
base::AssertBlockingAllowed(); base::AssertBlockingAllowed();
return base::Version(version_info::GetVersionNumber()); return version_info::GetVersion();
} }
} // namespace } // namespace
......
...@@ -158,8 +158,8 @@ std::vector<GURL> ConfiguratorImpl::PingUrl() const { ...@@ -158,8 +158,8 @@ std::vector<GURL> ConfiguratorImpl::PingUrl() const {
return pings_enabled_ ? UpdateUrl() : std::vector<GURL>(); return pings_enabled_ ? UpdateUrl() : std::vector<GURL>();
} }
base::Version ConfiguratorImpl::GetBrowserVersion() const { const base::Version& ConfiguratorImpl::GetBrowserVersion() const {
return base::Version(version_info::GetVersionNumber()); return version_info::GetVersion();
} }
std::string ConfiguratorImpl::GetOSLongName() const { std::string ConfiguratorImpl::GetOSLongName() const {
......
...@@ -52,7 +52,7 @@ class ConfiguratorImpl { ...@@ -52,7 +52,7 @@ class ConfiguratorImpl {
std::vector<GURL> PingUrl() const; std::vector<GURL> PingUrl() const;
// Version of the application. Used to compare the component manifests. // Version of the application. Used to compare the component manifests.
base::Version GetBrowserVersion() const; const base::Version& GetBrowserVersion() const;
// Returns the OS's long name like "Windows", "Mac OS X", etc. // Returns the OS's long name like "Windows", "Mac OS X", etc.
std::string GetOSLongName() const; std::string GetOSLongName() const;
......
...@@ -27,8 +27,8 @@ const cryptauth::DeviceClassifier& GetDeviceClassifier() { ...@@ -27,8 +27,8 @@ const cryptauth::DeviceClassifier& GetDeviceClassifier() {
classifier.set_device_os_version_code(major_version); classifier.set_device_os_version_code(major_version);
classifier.set_device_type(cryptauth::CHROME); classifier.set_device_type(cryptauth::CHROME);
const std::vector<uint32_t> version_components = const std::vector<uint32_t>& version_components =
base::Version(version_info::GetVersionNumber()).components(); version_info::GetVersion().components();
if (!version_components.empty()) { if (!version_components.empty()) {
classifier.set_device_software_version_code(version_components[0]); classifier.set_device_software_version_code(version_components[0]);
} }
......
...@@ -187,12 +187,12 @@ bool VariationsFieldTrialCreator::CreateTrialsFromSeed( ...@@ -187,12 +187,12 @@ bool VariationsFieldTrialCreator::CreateTrialsFromSeed(
base::TimeTicks start_time = base::TimeTicks::Now(); base::TimeTicks start_time = base::TimeTicks::Now();
const base::Version current_version(version_info::GetVersionNumber()); const base::Version& current_version = version_info::GetVersion();
if (!current_version.IsValid()) if (!current_version.IsValid())
return false; return false;
std::unique_ptr<ClientFilterableState> client_filterable_state = std::unique_ptr<ClientFilterableState> client_filterable_state =
GetClientFilterableStateForVersion(current_version); GetClientFilterableStateForVersion(current_version);
VariationsSeed seed; VariationsSeed seed;
bool run_in_safe_mode = safe_seed_manager->ShouldRunInSafeMode() && bool run_in_safe_mode = safe_seed_manager->ShouldRunInSafeMode() &&
LoadSafeSeed(&seed, client_filterable_state.get()); LoadSafeSeed(&seed, client_filterable_state.get());
......
...@@ -469,7 +469,7 @@ const char* const kGeolocationAuthorizationActionNewUser = ...@@ -469,7 +469,7 @@ const char* const kGeolocationAuthorizationActionNewUser =
if (!previousVersion.IsValid()) if (!previousVersion.IsValid())
return YES; return YES;
base::Version currentVersion(version_info::GetVersionNumber()); const base::Version& currentVersion = version_info::GetVersion();
DCHECK(currentVersion.IsValid()); DCHECK(currentVersion.IsValid());
return currentVersion.components()[0] != previousVersion.components()[0]; return currentVersion.components()[0] != previousVersion.components()[0];
} }
......
...@@ -372,7 +372,7 @@ void OmahaService::Initialize() { ...@@ -372,7 +372,7 @@ void OmahaService::Initialize() {
} }
// Fire a ping as early as possible if the version changed. // Fire a ping as early as possible if the version changed.
base::Version current_version(version_info::GetVersionNumber()); const base::Version& current_version = version_info::GetVersion();
if (last_sent_version_ < current_version) { if (last_sent_version_ < current_version) {
next_tries_time_ = base::Time::Now() - base::TimeDelta::FromSeconds(1); next_tries_time_ = base::Time::Now() - base::TimeDelta::FromSeconds(1);
number_of_tries_ = 0; number_of_tries_ = 0;
...@@ -506,7 +506,7 @@ std::string OmahaService::GetPingContent(const std::string& requestId, ...@@ -506,7 +506,7 @@ std::string OmahaService::GetPingContent(const std::string& requestId,
} }
std::string OmahaService::GetCurrentPingContent() { std::string OmahaService::GetCurrentPingContent() {
base::Version current_version(version_info::GetVersionNumber()); const base::Version& current_version = version_info::GetVersion();
sending_install_event_ = last_sent_version_ < current_version; sending_install_event_ = last_sent_version_ < current_version;
PingContent ping_content = PingContent ping_content =
sending_install_event_ ? INSTALL_EVENT : USAGE_PING; sending_install_event_ ? INSTALL_EVENT : USAGE_PING;
...@@ -621,7 +621,7 @@ void OmahaService::OnURLFetchComplete(const net::URLFetcher* fetcher) { ...@@ -621,7 +621,7 @@ void OmahaService::OnURLFetchComplete(const net::URLFetcher* fetcher) {
kHoursBetweenRequests); kHoursBetweenRequests);
current_ping_time_ = next_tries_time_; current_ping_time_ = next_tries_time_;
last_sent_time_ = base::Time::Now(); last_sent_time_ = base::Time::Now();
last_sent_version_ = base::Version(version_info::GetVersionNumber()); last_sent_version_ = version_info::GetVersion();
sending_install_event_ = false; sending_install_event_ = false;
ClearInstallRetryRequestId(); ClearInstallRetryRequestId();
PersistStates(); PersistStates();
......
...@@ -160,7 +160,7 @@ NSSet* GaiaIdSetWithIdentities(NSArray* identities) { ...@@ -160,7 +160,7 @@ NSSet* GaiaIdSetWithIdentities(NSArray* identities) {
} }
+ (base::Version)currentVersion { + (base::Version)currentVersion {
base::Version currentVersion(version_info::GetVersionNumber()); base::Version currentVersion = version_info::GetVersion();
DCHECK(currentVersion.IsValid()); DCHECK(currentVersion.IsValid());
return currentVersion; return currentVersion;
} }
......
...@@ -255,7 +255,7 @@ class UpgradeInfoBarDismissObserver ...@@ -255,7 +255,7 @@ class UpgradeInfoBarDismissObserver
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* nextVersion = [defaults stringForKey:kNextVersionKey]; NSString* nextVersion = [defaults stringForKey:kNextVersionKey];
if (nextVersion) { if (nextVersion) {
base::Version current_version(version_info::GetVersionNumber()); const base::Version& current_version = version_info::GetVersion();
const std::string upgrade = base::SysNSStringToUTF8(nextVersion); const std::string upgrade = base::SysNSStringToUTF8(nextVersion);
return current_version < base::Version(upgrade); return current_version < base::Version(upgrade);
} }
......
...@@ -17,7 +17,7 @@ namespace { ...@@ -17,7 +17,7 @@ namespace {
base::Version GetVersionForSimulation() { base::Version GetVersionForSimulation() {
// TODO(asvitkine): Get the version that will be used on restart instead of // TODO(asvitkine): Get the version that will be used on restart instead of
// the current version. // the current version.
return base::Version(version_info::GetVersionNumber()); return version_info::GetVersion();
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment