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 {
// on a thread where IO is allowed.
base::Version GetVersionForSimulation() {
base::AssertBlockingAllowed();
return base::Version(version_info::GetVersionNumber());
return version_info::GetVersion();
}
} // namespace
......
......@@ -158,8 +158,8 @@ std::vector<GURL> ConfiguratorImpl::PingUrl() const {
return pings_enabled_ ? UpdateUrl() : std::vector<GURL>();
}
base::Version ConfiguratorImpl::GetBrowserVersion() const {
return base::Version(version_info::GetVersionNumber());
const base::Version& ConfiguratorImpl::GetBrowserVersion() const {
return version_info::GetVersion();
}
std::string ConfiguratorImpl::GetOSLongName() const {
......
......@@ -52,7 +52,7 @@ class ConfiguratorImpl {
std::vector<GURL> PingUrl() const;
// 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.
std::string GetOSLongName() const;
......
......@@ -27,8 +27,8 @@ const cryptauth::DeviceClassifier& GetDeviceClassifier() {
classifier.set_device_os_version_code(major_version);
classifier.set_device_type(cryptauth::CHROME);
const std::vector<uint32_t> version_components =
base::Version(version_info::GetVersionNumber()).components();
const std::vector<uint32_t>& version_components =
version_info::GetVersion().components();
if (!version_components.empty()) {
classifier.set_device_software_version_code(version_components[0]);
}
......
......@@ -187,12 +187,12 @@ bool VariationsFieldTrialCreator::CreateTrialsFromSeed(
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())
return false;
std::unique_ptr<ClientFilterableState> client_filterable_state =
GetClientFilterableStateForVersion(current_version);
VariationsSeed seed;
bool run_in_safe_mode = safe_seed_manager->ShouldRunInSafeMode() &&
LoadSafeSeed(&seed, client_filterable_state.get());
......
......@@ -469,7 +469,7 @@ const char* const kGeolocationAuthorizationActionNewUser =
if (!previousVersion.IsValid())
return YES;
base::Version currentVersion(version_info::GetVersionNumber());
const base::Version& currentVersion = version_info::GetVersion();
DCHECK(currentVersion.IsValid());
return currentVersion.components()[0] != previousVersion.components()[0];
}
......
......@@ -372,7 +372,7 @@ void OmahaService::Initialize() {
}
// 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) {
next_tries_time_ = base::Time::Now() - base::TimeDelta::FromSeconds(1);
number_of_tries_ = 0;
......@@ -506,7 +506,7 @@ std::string OmahaService::GetPingContent(const std::string& requestId,
}
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;
PingContent ping_content =
sending_install_event_ ? INSTALL_EVENT : USAGE_PING;
......@@ -621,7 +621,7 @@ void OmahaService::OnURLFetchComplete(const net::URLFetcher* fetcher) {
kHoursBetweenRequests);
current_ping_time_ = next_tries_time_;
last_sent_time_ = base::Time::Now();
last_sent_version_ = base::Version(version_info::GetVersionNumber());
last_sent_version_ = version_info::GetVersion();
sending_install_event_ = false;
ClearInstallRetryRequestId();
PersistStates();
......
......@@ -160,7 +160,7 @@ NSSet* GaiaIdSetWithIdentities(NSArray* identities) {
}
+ (base::Version)currentVersion {
base::Version currentVersion(version_info::GetVersionNumber());
base::Version currentVersion = version_info::GetVersion();
DCHECK(currentVersion.IsValid());
return currentVersion;
}
......
......@@ -255,7 +255,7 @@ class UpgradeInfoBarDismissObserver
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* nextVersion = [defaults stringForKey:kNextVersionKey];
if (nextVersion) {
base::Version current_version(version_info::GetVersionNumber());
const base::Version& current_version = version_info::GetVersion();
const std::string upgrade = base::SysNSStringToUTF8(nextVersion);
return current_version < base::Version(upgrade);
}
......
......@@ -17,7 +17,7 @@ namespace {
base::Version GetVersionForSimulation() {
// TODO(asvitkine): Get the version that will be used on restart instead of
// the current version.
return base::Version(version_info::GetVersionNumber());
return version_info::GetVersion();
}
} // 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