summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 18:40:53 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 18:40:53 +0000
commit12126d37c6fafd799821164a00bf1fdd240b9ec3 (patch)
tree8a029e133da6d9ad82265b03dc930045b3ffd046 /chrome
parent26807c6123b72a2ab30ff3fb2d5ab1e154fc3585 (diff)
downloadchromium_src-12126d37c6fafd799821164a00bf1fdd240b9ec3.zip
chromium_src-12126d37c6fafd799821164a00bf1fdd240b9ec3.tar.gz
chromium_src-12126d37c6fafd799821164a00bf1fdd240b9ec3.tar.bz2
Remove two deprecated methods from base::Version
BUG=none TEST=none TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10683005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/client_util.cc16
-rw-r--r--chrome/browser/chrome_browser_main_win.cc5
-rw-r--r--chrome/browser/enumerate_modules_model_win.cc23
-rw-r--r--chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc1
-rw-r--r--chrome/browser/extensions/crx_installer.cc5
-rw-r--r--chrome/browser/extensions/crx_installer.h2
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc84
-rw-r--r--chrome/browser/extensions/external_extension_provider_impl.cc9
-rw-r--r--chrome/browser/extensions/external_registry_extension_loader_win.cc6
-rw-r--r--chrome/browser/extensions/updater/extension_updater_unittest.cc7
-rw-r--r--chrome/browser/extensions/user_script_master.cc6
-rw-r--r--chrome/browser/first_run/upgrade_util_win.cc10
-rw-r--r--chrome/browser/gpu_blacklist.cc41
-rw-r--r--chrome/browser/gpu_blacklist_unittest.cc135
-rw-r--r--chrome/browser/gpu_util.cc6
-rw-r--r--chrome/browser/hang_monitor/hung_plugin_action.cc10
-rw-r--r--chrome/browser/plugin_installer.cc10
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc15
-rw-r--r--chrome/browser/upgrade_detector_impl.cc35
-rw-r--r--chrome/common/extensions/extension.cc16
-rw-r--r--chrome/common/extensions/update_manifest.cc9
-rw-r--r--chrome/common/service_process_util.cc15
-rw-r--r--chrome/common/service_process_util_mac.mm15
-rw-r--r--chrome/installer/setup/install_worker_unittest.cc16
-rw-r--r--chrome/installer/setup/setup_main.cc8
-rw-r--r--chrome/installer/setup/setup_util.cc6
-rw-r--r--chrome/installer/util/google_update_settings_unittest.cc2
-rw-r--r--chrome/installer/util/install_util.cc29
-rw-r--r--chrome/installer/util/install_util.h23
-rw-r--r--chrome/installer/util/installation_state.cc15
-rw-r--r--chrome/installer/util/installation_validator_unittest.cc5
-rw-r--r--chrome/installer/util/installer_state.cc12
-rw-r--r--chrome/installer/util/installer_state_unittest.cc52
-rw-r--r--chrome/installer/util/product_unittest.cc9
-rw-r--r--chrome/test/mini_installer_test/installer_test_util.cc8
35 files changed, 316 insertions, 350 deletions
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
index 49ad1fa..1fd5e10 100644
--- a/chrome/app/client_util.cc
+++ b/chrome/app/client_util.cc
@@ -354,13 +354,13 @@ HMODULE MainDllLoader::Load(std::wstring* out_version, std::wstring* out_file) {
return dll;
std::wstring version_string;
- scoped_ptr<Version> version;
+ Version version;
const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
if (cmd_line.HasSwitch(switches::kChromeVersion)) {
version_string = cmd_line.GetSwitchValueNative(switches::kChromeVersion);
- version.reset(Version::GetVersionFromString(WideToASCII(version_string)));
+ version = Version(WideToASCII(version_string));
- if (!version.get()) {
+ if (!version.IsValid()) {
// If a bogus command line flag was given, then abort.
LOG(ERROR) << "Invalid command line version: " << version_string;
return NULL;
@@ -368,17 +368,17 @@ HMODULE MainDllLoader::Load(std::wstring* out_version, std::wstring* out_file) {
}
// If no version on the command line, then look in the environment.
- if (!version.get()) {
+ if (!version.IsValid()) {
if (EnvQueryStr(ASCIIToWide(chrome::kChromeVersionEnvVar).c_str(),
&version_string)) {
- version.reset(Version::GetVersionFromString(WideToASCII(version_string)));
- LOG_IF(ERROR, !version.get()) << "Invalid environment version: "
- << version_string;
+ version = Version(WideToASCII(version_string));
+ LOG_IF(ERROR, !version.IsValid()) << "Invalid environment version: "
+ << version_string;
}
}
// If no version in the environment, then look in the registry.
- if (!version.get()) {
+ if (!version.IsValid()) {
version_string = GetVersion();
if (version_string.empty()) {
LOG(ERROR) << "Could not get Chrome DLL version.";
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index 5939c47..047530b 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -295,8 +295,9 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() {
// TODO(tommi): Check if using the default distribution is always the right
// thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- scoped_ptr<Version> version(InstallUtil::GetChromeVersion(dist, true));
- if (version.get()) {
+ Version version;
+ InstallUtil::GetChromeVersion(dist, true, &version);
+ if (version.IsValid()) {
FilePath exe_path;
PathService::Get(base::DIR_EXE, &exe_path);
std::wstring exe = exe_path.value();
diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc
index 95b24d4..699c003e 100644
--- a/chrome/browser/enumerate_modules_model_win.cc
+++ b/chrome/browser/enumerate_modules_model_win.cc
@@ -341,20 +341,17 @@ ModuleEnumerator::ModuleStatus ModuleEnumerator::Match(
location_hash == blacklisted.location)) {
// We have a name match against the blacklist (and possibly location match
// also), so check version.
- scoped_ptr<Version> module_version(
- Version::GetVersionFromString(UTF16ToASCII(module.version)));
- scoped_ptr<Version> version_min(
- Version::GetVersionFromString(blacklisted.version_from));
- scoped_ptr<Version> version_max(
- Version::GetVersionFromString(blacklisted.version_to));
- bool version_ok = !version_min.get() && !version_max.get();
+ Version module_version(UTF16ToASCII(module.version));
+ Version version_min(blacklisted.version_from);
+ Version version_max(blacklisted.version_to);
+ bool version_ok = !version_min.IsValid() && !version_max.IsValid();
if (!version_ok) {
- bool too_low = version_min.get() &&
- (!module_version.get() ||
- module_version->CompareTo(*version_min.get()) < 0);
- bool too_high = version_max.get() &&
- (!module_version.get() ||
- module_version->CompareTo(*version_max.get()) >= 0);
+ bool too_low = version_min.IsValid() &&
+ (!module_version.IsValid() ||
+ module_version.CompareTo(version_min) < 0);
+ bool too_high = version_max.IsValid() &&
+ (!module_version.IsValid() ||
+ module_version.CompareTo(version_max) >= 0);
version_ok = !too_low && !too_high;
}
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
index 9fe1a4d..77e0a38 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -445,7 +445,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("1.0"));
GpuBlacklist* blacklist = GpuBlacklist::GetInstance();
ASSERT_TRUE(blacklist->LoadGpuBlacklist(
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index e4e7d4a..bb572f8 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -475,9 +475,8 @@ void CrxInstaller::CompleteInstall() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
if (!current_version_.empty()) {
- scoped_ptr<Version> current_version(
- Version::GetVersionFromString(current_version_));
- if (current_version->CompareTo(*(extension_->version())) > 0) {
+ Version current_version(current_version_);
+ if (current_version.CompareTo(*(extension_->version())) > 0) {
ReportFailureFromFileThread(
CrxInstallerError(
l10n_util::GetStringUTF16(IDS_EXTENSION_CANT_DOWNGRADE_VERSION)));
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index cfb2540..2431399 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -111,7 +111,7 @@ class CrxInstaller
void set_expected_id(const std::string& val) { expected_id_ = val; }
void set_expected_version(const Version& val) {
- expected_version_.reset(val.Clone());
+ expected_version_.reset(new Version(val));
}
bool delete_source() const { return delete_source_; }
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index eada4ca..3330bbb 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -179,11 +179,10 @@ class MockExtensionProvider : public ExternalExtensionProviderInterface {
visit_count_++;
for (DataMap::const_iterator i = extension_map_.begin();
i != extension_map_.end(); ++i) {
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString(i->second.first));
+ Version version(i->second.first);
visitor_->OnExternalExtensionFileFound(
- i->first, version.get(), i->second.second, location_,
+ i->first, &version, i->second.second, location_,
Extension::NO_FLAGS, false);
}
visitor_->OnExternalProviderReady(this);
@@ -202,7 +201,7 @@ class MockExtensionProvider : public ExternalExtensionProviderInterface {
return false;
if (version)
- version->reset(Version::GetVersionFromString(it->second.first));
+ version->reset(new Version(it->second.first));
if (location)
*location = location_;
@@ -1268,10 +1267,10 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) {
set_extensions_enabled(true);
// Register and install an external extension.
- scoped_ptr<Version> version(Version::GetVersionFromString("1.0.0.0"));
+ Version version("1.0.0.0");
service_->OnExternalExtensionFileFound(
good_crx,
- version.get(),
+ &version,
path,
Extension::EXTERNAL_PREF,
Extension::FROM_BOOKMARK,
@@ -1299,10 +1298,9 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
FilePath path = data_dir_.AppendASCII("good.crx");
set_extensions_enabled(true);
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString("1.0.0.0"));
+ Version version("1.0.0.0");
// Install an external extension.
- service_->OnExternalExtensionFileFound(good_crx, version.get(),
+ service_->OnExternalExtensionFileFound(good_crx, &version,
path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
@@ -1314,7 +1312,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
Extension::EXTERNAL_EXTENSION_UNINSTALLED);
// Try to re-install it externally. This should fail because of the killbit.
- service_->OnExternalExtensionFileFound(good_crx, version.get(),
+ service_->OnExternalExtensionFileFound(good_crx, &version,
path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
@@ -1322,10 +1320,10 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
ValidateIntegerPref(good_crx, "location",
Extension::EXTERNAL_EXTENSION_UNINSTALLED);
- version.reset(Version::GetVersionFromString("1.0.0.1"));
+ version = Version("1.0.0.1");
// Repeat the same thing with a newer version of the extension.
path = data_dir_.AppendASCII("good2.crx");
- service_->OnExternalExtensionFileFound(good_crx, version.get(),
+ service_->OnExternalExtensionFileFound(good_crx, &version,
path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
@@ -1376,8 +1374,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) {
FilePath path = data_dir_.AppendASCII("good.crx");
set_extensions_enabled(true);
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString("1.0.0.0"));
+ Version version("1.0.0.0");
const std::string wrong_id = all_zero;
const std::string correct_id = good_crx;
@@ -1386,7 +1383,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) {
// Install an external extension with an ID from the external
// source that is not equal to the ID in the extension manifest.
service_->OnExternalExtensionFileFound(
- wrong_id, version.get(), path, Extension::EXTERNAL_PREF,
+ wrong_id, &version, path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
@@ -1394,7 +1391,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) {
// Try again with the right ID. Expect success.
service_->OnExternalExtensionFileFound(
- correct_id, version.get(), path, Extension::EXTERNAL_PREF,
+ correct_id, &version, path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
ASSERT_TRUE(service_->GetExtensionById(good_crx, false));
@@ -1408,10 +1405,9 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) {
// Install an external extension with a version from the external
// source that is not equal to the version in the extension manifest.
- scoped_ptr<Version> wrong_version;
- wrong_version.reset(Version::GetVersionFromString("1.2.3.4"));
+ Version wrong_version("1.2.3.4");
service_->OnExternalExtensionFileFound(
- good_crx, wrong_version.get(), path, Extension::EXTERNAL_PREF,
+ good_crx, &wrong_version, path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
@@ -1419,10 +1415,9 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) {
// Try again with the right version. Expect success.
service_->pending_extension_manager()->Remove(good_crx);
- scoped_ptr<Version> correct_version;
- correct_version.reset(Version::GetVersionFromString("1.0.0.0"));
+ Version correct_version("1.0.0.0");
service_->OnExternalExtensionFileFound(
- good_crx, correct_version.get(), path, Extension::EXTERNAL_PREF,
+ good_crx, &correct_version, path, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
loop_.RunAllPending();
ASSERT_TRUE(service_->GetExtensionById(good_crx, false));
@@ -4823,11 +4818,8 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) {
}
TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
- scoped_ptr<Version> older_version;
- older_version.reset(Version::GetVersionFromString("0.1.0.0"));
-
- scoped_ptr<Version> newer_version;
- newer_version.reset(Version::GetVersionFromString("2.0.0.0"));
+ Version older_version("0.1.0.0");
+ Version newer_version("2.0.0.0");
// We don't want the extension to be installed. A path that doesn't
// point to a valid CRX ensures this.
@@ -4859,7 +4851,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Simulate an external source adding the extension as INTERNAL.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED);
@@ -4867,7 +4859,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Simulate an external source adding the extension as EXTERNAL_PREF.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED);
@@ -4875,7 +4867,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Simulate an external source adding as EXTERNAL_PREF again.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED);
@@ -4883,14 +4875,14 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Try INTERNAL again. Should fail.
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
// Now the registry adds the extension.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED);
@@ -4898,13 +4890,13 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Registry outranks both external pref and internal, so both fail.
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
@@ -4922,8 +4914,8 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Tests assume |older_version| is less than the installed version, and
// |newer_version| is greater. Verify this:
- ASSERT_TRUE(older_version->IsOlderThan(ext->VersionString()));
- ASSERT_TRUE(ext->version()->IsOlderThan(newer_version->GetString()));
+ ASSERT_TRUE(older_version.IsOlderThan(ext->VersionString()));
+ ASSERT_TRUE(ext->version()->IsOlderThan(newer_version.GetString()));
// An external install for the same location should fail if the version is
// older, or the same, and succeed if the version is newer.
@@ -4931,7 +4923,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Older than the installed version...
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged));
EXPECT_FALSE(pending->IsIdPending(kGoodId));
@@ -4945,7 +4937,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// Newer than the installed version...
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, newer_version.get(), kInvalidPathToCrx,
+ kGoodId, &newer_version, kInvalidPathToCrx,
Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
@@ -4953,14 +4945,14 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// if the version is greater. |older_version| is not...
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, older_version.get(), kInvalidPathToCrx,
+ kGoodId, &older_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
// |newer_version| is newer.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, newer_version.get(), kInvalidPathToCrx,
+ kGoodId, &newer_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
@@ -4968,7 +4960,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// succeed if the version is greater.
EXPECT_TRUE(
service_->OnExternalExtensionFileFound(
- kGoodId, newer_version.get(), kInvalidPathToCrx,
+ kGoodId, &newer_version, kInvalidPathToCrx,
Extension::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
@@ -4976,7 +4968,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// adding from external pref will now fail.
EXPECT_FALSE(
service_->OnExternalExtensionFileFound(
- kGoodId, newer_version.get(), kInvalidPathToCrx,
+ kGoodId, &newer_version, kInvalidPathToCrx,
Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged));
EXPECT_TRUE(pending->IsIdPending(kGoodId));
}
@@ -5085,11 +5077,10 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
// Fake an external file from external_extensions.json.
bool AddPendingExternalPrefFileInstall() {
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString("1.0.0.0"));
+ Version version("1.0.0.0");
return service_->OnExternalExtensionFileFound(
- crx_id_, version.get(), crx_path_, Extension::EXTERNAL_PREF,
+ crx_id_, &version, crx_path_, Extension::EXTERNAL_PREF,
Extension::NO_FLAGS, false);
}
@@ -5101,9 +5092,6 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
// Fake a policy install.
bool AddPendingPolicyInstall() {
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString("1.0.0.0"));
-
// Get path to the CRX with id |kGoodId|.
return service_->OnExternalExtensionUpdateUrlFound(
crx_id_, GURL(), Extension::EXTERNAL_POLICY_DOWNLOAD);
diff --git a/chrome/browser/extensions/external_extension_provider_impl.cc b/chrome/browser/extensions/external_extension_provider_impl.cc
index 09e34ea..a71c68b 100644
--- a/chrome/browser/extensions/external_extension_provider_impl.cc
+++ b/chrome/browser/extensions/external_extension_provider_impl.cc
@@ -217,15 +217,14 @@ void ExternalExtensionProviderImpl::SetPrefs(DictionaryValue* prefs) {
path = base_path.Append(external_crx);
}
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString(external_version));
- if (!version.get()) {
+ Version version(external_version);
+ if (!version.IsValid()) {
LOG(WARNING) << "Malformed extension dictionary for extension: "
<< extension_id.c_str() << ". Invalid version string \""
<< external_version << "\".";
continue;
}
- service_->OnExternalExtensionFileFound(extension_id, version.get(), path,
+ service_->OnExternalExtensionFileFound(extension_id, &version, path,
crx_location_, creation_flags,
auto_acknowledge_);
} else { // if (has_external_update_url)
@@ -296,7 +295,7 @@ bool ExternalExtensionProviderImpl::GetExtensionDetails(
return false;
if (version)
- version->reset(Version::GetVersionFromString(external_version));
+ version->reset(new Version(external_version));
} else {
NOTREACHED(); // Chrome should not allow prefs to get into this state.
diff --git a/chrome/browser/extensions/external_registry_extension_loader_win.cc b/chrome/browser/extensions/external_registry_extension_loader_win.cc
index 45651a3..ab90bfc 100644
--- a/chrome/browser/extensions/external_registry_extension_loader_win.cc
+++ b/chrome/browser/extensions/external_registry_extension_loader_win.cc
@@ -129,10 +129,8 @@ void ExternalRegistryExtensionLoader::LoadOnFileThread() {
continue;
}
- scoped_ptr<Version> version;
- version.reset(Version::GetVersionFromString(
- WideToASCII(extension_version)));
- if (!version.get()) {
+ Version version(WideToASCII(extension_version));
+ if (!version.IsValid()) {
LOG(ERROR) << "Invalid version value " << extension_version
<< " for key " << key_path << ".";
continue;
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
index f72c730..d3806c5 100644
--- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -857,10 +857,9 @@ class ExtensionUpdaterTest : public testing::Test {
std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
std::string hash = "";
- scoped_ptr<Version> version(Version::GetVersionFromString("0.0.1"));
- ASSERT_TRUE(version.get());
+ Version version("0.0.1");
updater.downloader_->FetchUpdatedExtension(
- id, test_url, hash, version->GetString());
+ id, test_url, hash, version.GetString());
if (pending) {
const bool kIsFromSync = true;
@@ -868,7 +867,7 @@ class ExtensionUpdaterTest : public testing::Test {
PendingExtensionManager* pending_extension_manager =
service->pending_extension_manager();
pending_extension_manager->AddForTesting(
- PendingExtensionInfo(id, test_url, *version,
+ PendingExtensionInfo(id, test_url, version,
&ShouldAlwaysInstall, kIsFromSync,
kInstallSilently,
Extension::INTERNAL));
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index a422139..f55295d7 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -107,9 +107,9 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
} else if (GetDeclarationValue(line, kNameDeclaration, &value)) {
script->set_name(value);
} else if (GetDeclarationValue(line, kVersionDeclaration, &value)) {
- scoped_ptr<Version> version(Version::GetVersionFromString(value));
- if (version.get())
- script->set_version(version->GetString());
+ Version version(value);
+ if (version.IsValid())
+ script->set_version(version.GetString());
} else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) {
script->set_description(value);
} else if (GetDeclarationValue(line, kMatchDeclaration, &value)) {
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index a4fc3b0..834a979 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -105,16 +105,14 @@ bool SwapNewChromeExeIfPresent() {
if (cmd_line.HasSwitch(switches::kChromeVersion)) {
std::string version_string =
cmd_line.GetSwitchValueASCII(switches::kChromeVersion);
- scoped_ptr<Version> cmd_version(
- Version::GetVersionFromString(version_string));
+ Version cmd_version(version_string);
std::wstring pv_value;
if (key.ReadValue(google_update::kRegVersionField,
&pv_value) == ERROR_SUCCESS) {
- scoped_ptr<Version> pv_version(
- Version::GetVersionFromString(WideToASCII(pv_value)));
- if (cmd_version.get() && pv_version.get() &&
- !cmd_version->Equals(*pv_version.get())) {
+ Version pv_version(WideToASCII(pv_value));
+ if (cmd_version.IsValid() && pv_version.IsValid() &&
+ !cmd_version.Equals(pv_version)) {
return false;
}
}
diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc
index 7c56b7a..bddb3c7 100644
--- a/chrome/browser/gpu_blacklist.cc
+++ b/chrome/browser/gpu_blacklist.cc
@@ -24,19 +24,21 @@ using content::GpuFeatureType;
namespace {
// Encode a date as Version, where [0] is year, [1] is month, and [2] is day.
-Version* GetDateFromString(const std::string& date_string) {
+void GetDateFromString(const std::string& date_string, Version* version) {
// TODO(zmo): verify if in Windows registry, driver dates are always in the
// format of "mm-dd-yyyy".
std::vector<std::string> pieces;
base::SplitString(date_string, '-', &pieces);
- if (pieces.size() != 3)
- return NULL;
+ if (pieces.size() != 3) {
+ *version = Version();
+ return;
+ }
std::string date_as_version_string = pieces[2];
for (size_t i = 0; i < 2; ++i) {
date_as_version_string += ".";
date_as_version_string += pieces[i];
}
- return Version::GetVersionFromString(date_as_version_string);
+ *version = Version(date_as_version_string);
}
// We assume the input format is major.minor, and we treat major version
@@ -91,14 +93,14 @@ GpuBlacklist::VersionInfo::VersionInfo(
processed_version_string = version_string;
processed_version_string2 = version_string2;
}
- version_.reset(Version::GetVersionFromString(processed_version_string));
- if (version_.get() == NULL) {
+ version_.reset(new Version(processed_version_string));
+ if (!version_->IsValid()) {
op_ = kUnknown;
return;
}
if (op_ == kBetween) {
- version2_.reset(Version::GetVersionFromString(processed_version_string2));
- if (version2_.get() == NULL)
+ version2_.reset(new Version(processed_version_string2));
+ if (!version2_->IsValid())
op_ = kUnknown;
}
}
@@ -795,16 +797,15 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains(
processed_driver_version = NumericalToLexical(gpu_info.driver_version);
else
processed_driver_version = gpu_info.driver_version;
- scoped_ptr<Version> driver_version(
- Version::GetVersionFromString(processed_driver_version));
- if (driver_version.get() == NULL ||
- !driver_version_info_->Contains(*driver_version))
+ Version driver_version(processed_driver_version);
+ if (!driver_version.IsValid() ||
+ !driver_version_info_->Contains(driver_version))
return false;
}
if (driver_date_info_.get() != NULL) {
- scoped_ptr<Version> driver_date(GetDateFromString(gpu_info.driver_date));
- if (driver_date.get() == NULL ||
- !driver_date_info_->Contains(*driver_date))
+ Version driver_date;
+ GetDateFromString(gpu_info.driver_date, &driver_date);
+ if (!driver_date.IsValid() || !driver_date_info_->Contains(driver_date))
return false;
}
if (gl_vendor_info_.get() != NULL &&
@@ -878,8 +879,8 @@ bool GpuBlacklist::LoadGpuBlacklist(
const std::string& browser_version_string,
const std::string& json_context,
GpuBlacklist::OsFilter os_filter) {
- browser_version_.reset(Version::GetVersionFromString(browser_version_string));
- DCHECK(browser_version_.get() != NULL);
+ browser_version_.reset(new Version(browser_version_string));
+ DCHECK(browser_version_->IsValid());
scoped_ptr<Value> root;
root.reset(base::JSONReader::Read(json_context));
@@ -897,8 +898,8 @@ bool GpuBlacklist::LoadGpuBlacklist(
std::string version_string;
parsed_json.GetString("version", &version_string);
- version_.reset(Version::GetVersionFromString(version_string));
- if (version_.get() == NULL)
+ version_.reset(new Version(version_string));
+ if (!version_->IsValid())
return false;
ListValue* list = NULL;
@@ -966,7 +967,7 @@ GpuFeatureType GpuBlacklist::DetermineGpuFeatureType(
size_t pos = version_string.find_first_not_of("0123456789.");
if (pos != std::string::npos)
version_string = version_string.substr(0, pos);
- my_os_version.reset(Version::GetVersionFromString(version_string));
+ my_os_version.reset(new Version(version_string));
os_version = my_os_version.get();
}
DCHECK(os_version != NULL);
diff --git a/chrome/browser/gpu_blacklist_unittest.cc b/chrome/browser/gpu_blacklist_unittest.cc
index 8920ce5..7825016 100644
--- a/chrome/browser/gpu_blacklist_unittest.cc
+++ b/chrome/browser/gpu_blacklist_unittest.cc
@@ -75,11 +75,11 @@ TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) {
}
TEST_F(GpuBlacklistTest, DefaultBlacklistSettings) {
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
// Default blacklist settings: all feature are allowed.
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
}
@@ -92,14 +92,14 @@ TEST_F(GpuBlacklistTest, EmptyBlacklist) {
" \"entries\": [\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
empty_list_json, GpuBlacklist::kAllOs));
EXPECT_EQ(blacklist->GetVersion(), std::string("2.5"));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
}
@@ -131,13 +131,13 @@ TEST_F(GpuBlacklistTest, DetailedEntryAndInvalidJson) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
exact_list_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING);
// Invalid json input should not change the current blacklist settings.
@@ -146,7 +146,7 @@ TEST_F(GpuBlacklistTest, DetailedEntryAndInvalidJson) {
EXPECT_FALSE(blacklist->LoadGpuBlacklist(
invalid_json, GpuBlacklist::kAllOs));
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING);
std::vector<uint32> entries;
bool disabled = false;
@@ -177,20 +177,20 @@ TEST_F(GpuBlacklistTest, VendorOnAllOsEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
// Blacklist entries won't be filtered to the current OS only upon loading.
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
vendor_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) || \
defined(OS_OPENBSD)
@@ -198,13 +198,13 @@ TEST_F(GpuBlacklistTest, VendorOnAllOsEntry) {
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
vendor_json, GpuBlacklist::kCurrentOsOnly));
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
#endif
}
@@ -228,19 +228,19 @@ TEST_F(GpuBlacklistTest, VendorOnLinuxEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
vendor_linux_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS);
}
@@ -267,19 +267,19 @@ TEST_F(GpuBlacklistTest, AllExceptNVidiaOnLinuxEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
linux_except_nvidia_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, 0);
}
@@ -306,19 +306,19 @@ TEST_F(GpuBlacklistTest, AllExceptIntelOnLinuxEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
linux_except_intel_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS);
}
@@ -344,19 +344,19 @@ TEST_F(GpuBlacklistTest, DateOnWindowsEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
date_windows_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, 0);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS);
}
@@ -376,19 +376,19 @@ TEST_F(GpuBlacklistTest, MultipleDevicesEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
devices_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING);
}
@@ -409,16 +409,16 @@ TEST_F(GpuBlacklistTest, ChromeOSEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
devices_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsChromeOS, os_version.get(), gpu_info());
+ GpuBlacklist::kOsChromeOS, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info());
+ GpuBlacklist::kOsLinux, &os_version, gpu_info());
EXPECT_EQ(type, 0);
}
@@ -440,20 +440,20 @@ TEST_F(GpuBlacklistTest, ChromeVersionEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist9(Create());
EXPECT_TRUE(blacklist9->LoadGpuBlacklist(
"9.0", browser_version_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist9->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
scoped_ptr<GpuBlacklist> blacklist10(Create());
EXPECT_TRUE(blacklist10->LoadGpuBlacklist(
"10.0", browser_version_json, GpuBlacklist::kAllOs));
type = blacklist10->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -500,7 +500,7 @@ TEST_F(GpuBlacklistTest, UnknownField) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
@@ -508,7 +508,7 @@ TEST_F(GpuBlacklistTest, UnknownField) {
EXPECT_EQ(1u, blacklist->num_entries());
EXPECT_TRUE(blacklist->contains_unknown_fields());
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -544,7 +544,7 @@ TEST_F(GpuBlacklistTest, UnknownExceptionField) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
@@ -552,7 +552,7 @@ TEST_F(GpuBlacklistTest, UnknownExceptionField) {
EXPECT_EQ(1u, blacklist->num_entries());
EXPECT_TRUE(blacklist->contains_unknown_fields());
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -571,7 +571,7 @@ TEST_F(GpuBlacklistTest, UnknownFeature) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
@@ -579,7 +579,7 @@ TEST_F(GpuBlacklistTest, UnknownFeature) {
EXPECT_EQ(1u, blacklist->num_entries());
EXPECT_TRUE(blacklist->contains_unknown_fields());
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -601,13 +601,13 @@ TEST_F(GpuBlacklistTest, GlVendor) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
gl_vendor_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -629,13 +629,13 @@ TEST_F(GpuBlacklistTest, GlRenderer) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
gl_renderer_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -657,12 +657,12 @@ TEST_F(GpuBlacklistTest, PerfGraphics) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -684,12 +684,12 @@ TEST_F(GpuBlacklistTest, PerfGaming) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
}
@@ -712,12 +712,12 @@ TEST_F(GpuBlacklistTest, PerfOverall) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -736,13 +736,13 @@ TEST_F(GpuBlacklistTest, DisabledEntry) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
scoped_ptr<GpuBlacklist> blacklist(Create());
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
disabled_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ GpuBlacklist::kOsWin, &os_version, gpu_info());
EXPECT_EQ(type, 0);
std::vector<uint32> flag_entries;
bool disabled = false;
@@ -773,7 +773,7 @@ TEST_F(GpuBlacklistTest, Optimus) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
content::GPUInfo gpu_info;
gpu_info.optimus = true;
@@ -782,7 +782,7 @@ TEST_F(GpuBlacklistTest, Optimus) {
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
optimus_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info);
+ GpuBlacklist::kOsLinux, &os_version, gpu_info);
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -804,7 +804,7 @@ TEST_F(GpuBlacklistTest, AMDSwitchable) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
content::GPUInfo gpu_info;
gpu_info.amd_switchable = true;
@@ -813,7 +813,7 @@ TEST_F(GpuBlacklistTest, AMDSwitchable) {
EXPECT_TRUE(blacklist->LoadGpuBlacklist(
amd_switchable_json, GpuBlacklist::kAllOs));
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsMacosx, os_version.get(), gpu_info);
+ GpuBlacklist::kOsMacosx, &os_version, gpu_info);
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
@@ -840,7 +840,7 @@ TEST_F(GpuBlacklistTest, LexicalDriverVersion) {
" }\n"
" ]\n"
"}";
- scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+ Version os_version("10.6.4");
content::GPUInfo gpu_info;
gpu_info.gpu.vendor_id = 0x1002;
@@ -851,22 +851,21 @@ TEST_F(GpuBlacklistTest, LexicalDriverVersion) {
gpu_info.driver_version = "8.109";
GpuFeatureType type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info);
+ GpuBlacklist::kOsLinux, &os_version, gpu_info);
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
gpu_info.driver_version = "8.2";
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info);
+ GpuBlacklist::kOsLinux, &os_version, gpu_info);
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
gpu_info.driver_version = "8.21";
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info);
+ GpuBlacklist::kOsLinux, &os_version, gpu_info);
EXPECT_EQ(type, 0);
gpu_info.driver_version = "8.2010";
type = blacklist->DetermineGpuFeatureType(
- GpuBlacklist::kOsLinux, os_version.get(), gpu_info);
+ GpuBlacklist::kOsLinux, &os_version, gpu_info);
EXPECT_EQ(type, 0);
}
-
diff --git a/chrome/browser/gpu_util.cc b/chrome/browser/gpu_util.cc
index 0f88faa..f10e214 100644
--- a/chrome/browser/gpu_util.cc
+++ b/chrome/browser/gpu_util.cc
@@ -140,9 +140,9 @@ int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) {
size_t pos = version_str.find_first_not_of("0123456789.");
if (pos != std::string::npos)
version_str = version_str.substr(0, pos);
- scoped_ptr<Version> os_version(Version::GetVersionFromString(version_str));
- if (os_version.get() && os_version->components().size() >= 2) {
- const std::vector<uint16>& version_numbers = os_version->components();
+ Version os_version(version_str);
+ if (os_version.IsValid() && os_version.components().size() >= 2) {
+ const std::vector<uint16>& version_numbers = os_version.components();
if (version_numbers[0] == 5)
sub_version = kWinXP;
else if (version_numbers[0] == 6 && version_numbers[1] == 0)
diff --git a/chrome/browser/hang_monitor/hung_plugin_action.cc b/chrome/browser/hang_monitor/hung_plugin_action.cc
index 0668425..aafff33 100644
--- a/chrome/browser/hang_monitor/hung_plugin_action.cc
+++ b/chrome/browser/hang_monitor/hung_plugin_action.cc
@@ -40,11 +40,11 @@ enum GTalkPluginLogVersion {
// 10 * major + minor - kGTalkPluginLogMinVersion.
GTalkPluginLogVersion GetGTalkPluginVersion(const string16& version) {
int gtalk_plugin_version = GTALK_PLUGIN_VERSION_MIN;
- scoped_ptr<Version> plugin_version(
- webkit::npapi::PluginGroup::CreateVersionFromString(version));
- if (plugin_version.get() && plugin_version->components().size() >= 2) {
- gtalk_plugin_version = 10 * plugin_version->components()[0] +
- plugin_version->components()[1] - kGTalkPluginLogMinVersion;
+ Version plugin_version;
+ webkit::npapi::PluginGroup::CreateVersionFromString(version, &plugin_version);
+ if (plugin_version.IsValid() && plugin_version.components().size() >= 2) {
+ gtalk_plugin_version = 10 * plugin_version.components()[0] +
+ plugin_version.components()[1] - kGTalkPluginLogMinVersion;
}
if (gtalk_plugin_version < GTALK_PLUGIN_VERSION_MIN)
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index 6a76213..f795662 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -96,14 +96,14 @@ PluginInstaller::SecurityStatus PluginInstaller::GetSecurityStatus(
if (versions_.empty())
return SECURITY_STATUS_REQUIRES_AUTHORIZATION;
- scoped_ptr<Version> version(
- webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version));
- if (!version.get())
- version.reset(new Version("0"));
+ Version version;
+ webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version, &version);
+ if (!version.IsValid())
+ version = Version("0");
// |lower_bound| returns the latest version that is not newer than |version|.
std::map<Version, SecurityStatus, VersionComparator>::const_iterator it =
- versions_.lower_bound(*version);
+ versions_.lower_bound(version);
// If there is at least one version defined, everything older than the oldest
// defined version is considered out-of-date.
if (it == versions_.end())
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 3f3c9ed..8badd9f 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -698,16 +698,15 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::ThreadRestrictions::ScopedAllowIO allow_io;
chrome::VersionInfo version_info;
- scoped_ptr<Version> installed_version(
- InstallUtil::GetChromeVersion(dist, false));
- if (!installed_version.get()) {
+ Version installed_version;
+ InstallUtil::GetChromeVersion(dist, false, &installed_version);
+ if (!installed_version.IsValid()) {
// User-level Chrome is not installed, check system-level.
- installed_version.reset(InstallUtil::GetChromeVersion(dist, true));
+ InstallUtil::GetChromeVersion(dist, true, &installed_version);
}
- scoped_ptr<Version> running_version(
- Version::GetVersionFromString(version_info.Version()));
- if (!installed_version.get() ||
- (installed_version->CompareTo(*running_version) <= 0)) {
+ Version running_version(version_info.Version());
+ if (!installed_version.IsValid() ||
+ (installed_version.CompareTo(running_version) <= 0)) {
content::RecordAction(
UserMetricsAction("UpgradeCheck_AlreadyUpToDate"));
string16 update_label_text = l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc
index fb81f96..570275e 100644
--- a/chrome/browser/upgrade_detector_impl.cc
+++ b/chrome/browser/upgrade_detector_impl.cc
@@ -76,8 +76,8 @@ void DetectUpgradeTask(const base::Closure& upgrade_detected_task,
bool* is_critical_upgrade) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- scoped_ptr<Version> installed_version;
- scoped_ptr<Version> critical_update;
+ Version installed_version;
+ Version critical_update;
#if defined(OS_WIN)
// Get the version of the currently *installed* instance of Chrome,
@@ -95,17 +95,15 @@ void DetectUpgradeTask(const base::Closure& upgrade_detected_task,
// TODO(tommi): Check if using the default distribution is always the right
// thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- installed_version.reset(InstallUtil::GetChromeVersion(dist,
- system_install));
+ InstallUtil::GetChromeVersion(dist, system_install, &installed_version);
- if (installed_version.get()) {
- critical_update.reset(
- InstallUtil::GetCriticalUpdateVersion(dist, system_install));
+ if (installed_version.IsValid()) {
+ InstallUtil::GetCriticalUpdateVersion(dist, system_install,
+ &critical_update);
}
#elif defined(OS_MACOSX)
- installed_version.reset(
- Version::GetVersionFromString(UTF16ToASCII(
- keystone_glue::CurrentlyInstalledVersion())));
+ installed_version =
+ Version(UTF16ToASCII(keystone_glue::CurrentlyInstalledVersion()));
#elif defined(OS_POSIX)
// POSIX but not Mac OS X: Linux, etc.
CommandLine command_line(*CommandLine::ForCurrentProcess());
@@ -116,7 +114,7 @@ void DetectUpgradeTask(const base::Closure& upgrade_detected_task,
return;
}
- installed_version.reset(Version::GetVersionFromString(reply));
+ installed_version = Version(reply);
#endif
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
@@ -129,23 +127,22 @@ void DetectUpgradeTask(const base::Closure& upgrade_detected_task,
NOTREACHED() << "Failed to get current file version";
return;
}
- scoped_ptr<Version> running_version(
- Version::GetVersionFromString(version_info.Version()));
- if (running_version.get() == NULL) {
- NOTREACHED() << "Failed to parse version info";
+ Version running_version(version_info.Version());
+ if (!running_version.IsValid()) {
+ NOTREACHED();
return;
}
// |installed_version| may be NULL when the user downgrades on Linux (by
// switching from dev to beta channel, for example). The user needs a
// restart in this case as well. See http://crbug.com/46547
- if (!installed_version.get() ||
- (installed_version->CompareTo(*running_version) > 0)) {
+ if (!installed_version.IsValid() ||
+ (installed_version.CompareTo(running_version) > 0)) {
// If a more recent version is available, it might be that we are lacking
// a critical update, such as a zero-day fix.
*is_critical_upgrade =
- critical_update.get() &&
- (critical_update->CompareTo(*running_version) > 0);
+ critical_update.IsValid() &&
+ (critical_update.CompareTo(running_version) > 0);
// Fire off the upgrade detected task.
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 9671778..ed98a61 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -968,9 +968,8 @@ bool Extension::CheckMinimumChromeVersion(string16* error) {
return false;
}
- scoped_ptr<Version> minimum_version(
- Version::GetVersionFromString(minimum_version_string));
- if (!minimum_version.get()) {
+ Version minimum_version(minimum_version_string);
+ if (!minimum_version.IsValid()) {
*error = ASCIIToUTF16(errors::kInvalidMinimumChromeVersion);
return false;
}
@@ -981,14 +980,13 @@ bool Extension::CheckMinimumChromeVersion(string16* error) {
return false;
}
- scoped_ptr<Version> current_version(
- Version::GetVersionFromString(current_version_info.Version()));
- if (!current_version.get()) {
+ Version current_version(current_version_info.Version());
+ if (!current_version.IsValid()) {
DCHECK(false);
return false;
}
- if (current_version->CompareTo(*minimum_version) < 0) {
+ if (current_version.CompareTo(minimum_version) < 0) {
*error = ExtensionErrorUtils::FormatErrorMessageUTF16(
errors::kChromeVersionTooLow,
l10n_util::GetStringUTF8(IDS_PRODUCT_NAME),
@@ -1327,8 +1325,8 @@ bool Extension::LoadVersion(string16* error) {
*error = ASCIIToUTF16(errors::kInvalidVersion);
return false;
}
- version_.reset(Version::GetVersionFromString(version_str));
- if (!version_.get() ||
+ version_.reset(new Version(version_str));
+ if (!version_->IsValid() ||
version_->components().size() > 4) {
*error = ASCIIToUTF16(errors::kInvalidVersion);
return false;
diff --git a/chrome/common/extensions/update_manifest.cc b/chrome/common/extensions/update_manifest.cc
index acc02b6..85947ca 100644
--- a/chrome/common/extensions/update_manifest.cc
+++ b/chrome/common/extensions/update_manifest.cc
@@ -165,8 +165,8 @@ static bool ParseSingleAppTag(xmlNode* app_node, xmlNs* xml_namespace,
*error_detail = "Missing version for updatecheck.";
return false;
}
- scoped_ptr<Version> version(Version::GetVersionFromString(result->version));
- if (!version.get()) {
+ Version version(result->version);
+ if (!version.IsValid()) {
*error_detail = "Invalid version: '";
*error_detail += result->version;
*error_detail += "'.";
@@ -176,9 +176,8 @@ static bool ParseSingleAppTag(xmlNode* app_node, xmlNs* xml_namespace,
// Get the minimum browser version (not required).
result->browser_min_version = GetAttribute(updatecheck, "prodversionmin");
if (result->browser_min_version.length()) {
- scoped_ptr<Version> browser_min_version(
- Version::GetVersionFromString(result->browser_min_version));
- if (!browser_min_version.get()) {
+ Version browser_min_version(result->browser_min_version);
+ if (!browser_min_version.IsValid()) {
*error_detail = "Invalid prodversionmin: '";
*error_detail += result->browser_min_version;
*error_detail += "'.";
diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc
index 768c618..7161ca4 100644
--- a/chrome/common/service_process_util.cc
+++ b/chrome/common/service_process_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,9 +69,9 @@ ServiceProcessRunningState GetServiceProcessRunningState(
if (service_version_out)
*service_version_out = version;
- scoped_ptr<Version> service_version(Version::GetVersionFromString(version));
+ Version service_version(version);
// If the version string is invalid, treat it like an older version.
- if (!service_version.get())
+ if (!service_version.IsValid())
return SERVICE_OLDER_VERSION_RUNNING;
// Get the version of the currently *running* instance of Chrome.
@@ -82,18 +82,17 @@ ServiceProcessRunningState GetServiceProcessRunningState(
// are out of date.
return SERVICE_NEWER_VERSION_RUNNING;
}
- scoped_ptr<Version> running_version(Version::GetVersionFromString(
- version_info.Version()));
- if (!running_version.get()) {
+ Version running_version(version_info.Version());
+ if (!running_version.IsValid()) {
NOTREACHED() << "Failed to parse version info";
// Our own version is invalid. This is an error case. Pretend that we
// are out of date.
return SERVICE_NEWER_VERSION_RUNNING;
}
- if (running_version->CompareTo(*service_version) > 0) {
+ if (running_version.CompareTo(service_version) > 0) {
return SERVICE_OLDER_VERSION_RUNNING;
- } else if (service_version->CompareTo(*running_version) > 0) {
+ } else if (service_version.CompareTo(running_version) > 0) {
return SERVICE_NEWER_VERSION_RUNNING;
}
return SERVICE_SAME_VERSION_RUNNING;
diff --git a/chrome/common/service_process_util_mac.mm b/chrome/common/service_process_util_mac.mm
index 72f0f21..858beec 100644
--- a/chrome/common/service_process_util_mac.mm
+++ b/chrome/common/service_process_util_mac.mm
@@ -205,27 +205,26 @@ bool CheckServiceProcessReady() {
if (!GetServiceProcessData(&version, &pid)) {
return false;
}
- scoped_ptr<Version> service_version(Version::GetVersionFromString(version));
+ Version service_version(version);
bool ready = true;
- if (!service_version.get()) {
+ if (!service_version.IsValid()) {
ready = false;
} else {
chrome::VersionInfo version_info;
if (!version_info.is_valid()) {
// Our own version is invalid. This is an error case. Pretend that we
// are out of date.
- NOTREACHED() << "Failed to get current file version";
+ NOTREACHED();
ready = true;
}
else {
- scoped_ptr<Version> running_version(Version::GetVersionFromString(
- version_info.Version()));
- if (!running_version.get()) {
+ Version running_version(version_info.Version());
+ if (!running_version.IsValid()) {
// Our own version is invalid. This is an error case. Pretend that we
// are out of date.
- NOTREACHED() << "Failed to parse version info";
+ NOTREACHED();
ready = true;
- } else if (running_version->CompareTo(*service_version) > 0) {
+ } else if (running_version.CompareTo(service_version) > 0) {
ready = false;
} else {
ready = true;
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc
index a683b0c..9a09805 100644
--- a/chrome/installer/setup/install_worker_unittest.cc
+++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -165,8 +165,8 @@ class MockInstallerState : public InstallerState {
class InstallWorkerTest : public testing::Test {
public:
virtual void SetUp() {
- current_version_.reset(Version::GetVersionFromString("1.0.0.0"));
- new_version_.reset(Version::GetVersionFromString("42.0.0.0"));
+ current_version_.reset(new Version("1.0.0.0"));
+ new_version_.reset(new Version("42.0.0.0"));
// Don't bother ensuring that these paths exist. Since we're just
// building the work item lists and not running them, they shouldn't
@@ -190,7 +190,7 @@ class InstallWorkerTest : public testing::Test {
if (installation_state->GetProductState(
system_level, BrowserDistribution::CHROME_BINARIES) == NULL) {
MockProductState product_state;
- product_state.set_version(current_version_->Clone());
+ product_state.set_version(new Version(*current_version_));
installation_state->SetProductState(system_level,
BrowserDistribution::CHROME_BINARIES,
product_state);
@@ -205,7 +205,7 @@ class InstallWorkerTest : public testing::Test {
if (multi_install)
MaybeAddBinariesToInstallationState(system_level, installation_state);
MockProductState product_state;
- product_state.set_version(current_version_->Clone());
+ product_state.set_version(new Version(*current_version_));
product_state.set_multi_install(multi_install);
product_state.set_brand(L"TEST");
product_state.set_eula_accepted(1);
@@ -244,7 +244,7 @@ class InstallWorkerTest : public testing::Test {
if (multi_install)
MaybeAddBinariesToInstallationState(system_level, installation_state);
MockProductState product_state;
- product_state.set_version(current_version_->Clone());
+ product_state.set_version(new Version(*current_version_));
product_state.set_multi_install(multi_install);
BrowserDistribution* dist =
BrowserDistribution::GetSpecificDistribution(
@@ -498,7 +498,7 @@ TEST_F(InstallWorkerTest, GoogleUpdateWorkItemsTest) {
BuildChromeInstallationState(system_level, false));
MockProductState cf_state;
- cf_state.set_version(current_version_->Clone());
+ cf_state.set_version(new Version(*current_version_));
cf_state.set_multi_install(false);
installation_state->SetProductState(system_level,
@@ -571,7 +571,7 @@ TEST_F(InstallWorkerTest, AddUsageStatsWorkItems) {
BuildChromeInstallationState(system_level, multi_install));
MockProductState chrome_state;
- chrome_state.set_version(current_version_->Clone());
+ chrome_state.set_version(new Version(*current_version_));
chrome_state.set_multi_install(false);
chrome_state.set_usagestats(1);
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 2010e4c..7925d79 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -1092,16 +1092,16 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
BrowserDistribution* browser_dist = product->distribution();
// We started as system-level and have been re-launched as user level
// to continue with the toast experiment.
- scoped_ptr<Version> installed_version(
- InstallUtil::GetChromeVersion(browser_dist, true));
- if (!installed_version.get()) {
+ Version installed_version;
+ InstallUtil::GetChromeVersion(browser_dist, true, &installed_version);
+ if (!installed_version.IsValid()) {
LOG(ERROR) << "No installation of "
<< browser_dist->GetAppShortCutName()
<< " found for system-level toast.";
} else {
browser_dist->LaunchUserExperiment(cmd_line.GetProgram(),
installer::REENTRY_SYS_UPDATE,
- *installed_version, *product, true);
+ installed_version, *product, true);
}
}
} else if (cmd_line.HasSwitch(
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index 768ac10..340ede9 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -61,7 +61,7 @@ Version* GetMaxVersionFromArchiveDir(const FilePath& chrome_path) {
// TODO(tommi): The version directory really should match the version of
// setup.exe. To begin with, we should at least DCHECK that that's true.
- scoped_ptr<Version> max_version(Version::GetVersionFromString("0.0.0.0"));
+ scoped_ptr<Version> max_version(new Version("0.0.0.0"));
bool version_found = false;
while (!version_enum.Next().empty()) {
@@ -70,8 +70,8 @@ Version* GetMaxVersionFromArchiveDir(const FilePath& chrome_path) {
VLOG(1) << "directory found: " << find_data.cFileName;
scoped_ptr<Version> found_version(
- Version::GetVersionFromString(WideToASCII(find_data.cFileName)));
- if (found_version.get() != NULL &&
+ new Version(WideToASCII(find_data.cFileName)));
+ if (found_version->IsValid() &&
found_version->CompareTo(*max_version.get()) > 0) {
max_version.reset(found_version.release());
version_found = true;
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc
index cec1421..de3f2e3 100644
--- a/chrome/installer/util/google_update_settings_unittest.cc
+++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -398,7 +398,7 @@ TEST_F(GoogleUpdateSettingsTest, SetEULAConsent) {
// Chrome is installed.
machine_state.AddChrome(system_level, multi_install,
- Version::GetVersionFromString(chrome::kChromeVersion));
+ new Version(chrome::kChromeVersion));
RegKey key;
DWORD value;
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index bb10265..6b327f8 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -171,8 +171,9 @@ CommandLine InstallUtil::GetChromeUninstallCmd(
return CommandLine(CommandLine::NO_PROGRAM);
}
-Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
- bool system_install) {
+void InstallUtil::GetChromeVersion(BrowserDistribution* dist,
+ bool system_install,
+ Version* version) {
DCHECK(dist);
RegKey key;
HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
@@ -183,22 +184,21 @@ Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
if (result == ERROR_SUCCESS)
result = key.ReadValue(google_update::kRegVersionField, &version_str);
- Version* ret = NULL;
+ *version = Version();
if (result == ERROR_SUCCESS && !version_str.empty()) {
VLOG(1) << "Existing " << dist->GetAppShortCutName() << " version found "
<< version_str;
- ret = Version::GetVersionFromString(WideToASCII(version_str));
+ *version = Version(WideToASCII(version_str));
} else {
DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
VLOG(1) << "No existing " << dist->GetAppShortCutName()
<< " install found.";
}
-
- return ret;
}
-Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
- bool system_install) {
+void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
+ bool system_install,
+ Version* version) {
DCHECK(dist);
RegKey key;
HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
@@ -210,18 +210,16 @@ Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
result = key.ReadValue(google_update::kRegCriticalVersionField,
&version_str);
- Version* ret = NULL;
+ *version = Version();
if (result == ERROR_SUCCESS && !version_str.empty()) {
VLOG(1) << "Critical Update version for " << dist->GetAppShortCutName()
<< " found " << version_str;
- ret = Version::GetVersionFromString(WideToASCII(version_str));
+ *version = Version(WideToASCII(version_str));
} else {
DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
VLOG(1) << "No existing " << dist->GetAppShortCutName()
<< " install found.";
}
-
- return ret;
}
bool InstallUtil::IsOSSupported() {
@@ -345,14 +343,15 @@ bool InstallUtil::HasDelegateExecuteHandler(BrowserDistribution* dist,
const string16& chrome_exe) {
bool found = false;
bool system_install = !IsPerUserInstall(chrome_exe.c_str());
- scoped_ptr<Version> version(GetChromeVersion(dist, system_install));
- if (!version.get()) {
+ Version version;
+ GetChromeVersion(dist, system_install, &version);
+ if (!version.IsValid()) {
LOG(ERROR) << __FUNCTION__ << " failed to determine version of "
<< dist->GetAppShortCutName() << " installed at " << chrome_exe;
} else {
FilePath handler(
FilePath(chrome_exe).DirName()
- .AppendASCII(version->GetString())
+ .AppendASCII(version.GetString())
.Append(installer::kDelegateExecuteExe));
found = file_util::PathExists(handler);
}
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 682290f..c3232bd 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -39,20 +39,23 @@ class InstallUtil {
BrowserDistribution::Type distribution_type);
// Find the version of Chrome installed on the system by checking the
- // Google Update registry key. Returns the version or NULL if no version is
- // found.
+ // Google Update registry key. Fills |version| with the version or a
+ // default-constructed Version if no version is found.
// system_install: if true, looks for version number under the HKLM root,
// otherwise looks under the HKCU.
- static Version* GetChromeVersion(BrowserDistribution* dist,
- bool system_install);
-
- // Find the last critical update (version) of Chrome. Returns the version or
- // NULL if no such version is found. A critical update is a specially flagged
- // version (by Google Update) that contains an important security fix.
+ static void GetChromeVersion(BrowserDistribution* dist,
+ bool system_install,
+ Version* version);
+
+ // Find the last critical update (version) of Chrome. Fills |version| with the
+ // version or a default-constructed Version if no version is found. A critical
+ // update is a specially flagged version (by Google Update) that contains an
+ // important security fix.
// system_install: if true, looks for version number under the HKLM root,
// otherwise looks under the HKCU.
- static Version* GetCriticalUpdateVersion(BrowserDistribution* dist,
- bool system_install);
+ static void GetCriticalUpdateVersion(BrowserDistribution* dist,
+ bool system_install,
+ Version* version);
// This function checks if the current OS is supported for Chromium.
static bool IsOSSupported();
diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc
index ab09924..6f12eb7 100644
--- a/chrome/installer/util/installation_state.cc
+++ b/chrome/installer/util/installation_state.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,7 +60,9 @@ bool ProductState::Initialize(bool system_install,
std::wstring version_str;
if (key.ReadValue(google_update::kRegVersionField,
&version_str) == ERROR_SUCCESS) {
- version_.reset(Version::GetVersionFromString(WideToASCII(version_str)));
+ version_.reset(new Version(WideToASCII(version_str)));
+ if (!version_->IsValid())
+ version_.reset();
}
// Attempt to read the other values even if the "pv" version value was
@@ -68,8 +70,9 @@ bool ProductState::Initialize(bool system_install,
// only be accessible via InstallationState::GetNonVersionedProductState.
if (key.ReadValue(google_update::kRegOldVersionField,
&version_str) == ERROR_SUCCESS) {
- old_version_.reset(
- Version::GetVersionFromString(WideToASCII(version_str)));
+ old_version_.reset(new Version(WideToASCII(version_str)));
+ if (!old_version_->IsValid())
+ old_version_.reset();
}
key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_);
@@ -151,9 +154,9 @@ const Version& ProductState::version() const {
ProductState& ProductState::CopyFrom(const ProductState& other) {
channel_.set_value(other.channel_.value());
- version_.reset(other.version_.get() == NULL ? NULL : other.version_->Clone());
+ version_.reset(other.version_.get() ? new Version(*other.version_) : NULL);
old_version_.reset(
- other.old_version_.get() == NULL ? NULL : other.old_version_->Clone());
+ other.old_version_.get() ? new Version(*other.old_version_) : NULL);
brand_ = other.brand_;
rename_cmd_ = other.rename_cmd_;
uninstall_command_ = other.uninstall_command_;
diff --git a/chrome/installer/util/installation_validator_unittest.cc b/chrome/installer/util/installation_validator_unittest.cc
index f4ff1e5..56e854c 100644
--- a/chrome/installer/util/installation_validator_unittest.cc
+++ b/chrome/installer/util/installation_validator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -154,8 +154,7 @@ void FakeProductState::SetChannel(const wchar_t* base, int channel_modifiers) {
}
void FakeProductState::SetVersion(const char* version) {
- version_.reset(
- version == NULL ? NULL : Version::GetVersionFromString(version));
+ version_.reset(version == NULL ? NULL : new Version(version));
}
// Sets the uninstall command for this object.
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 24572be..34ceff4 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -412,7 +412,7 @@ Version* InstallerState::GetCurrentVersion(
if (version == NULL)
version = &product_state->version();
- current_version.reset(version->Clone());
+ current_version.reset(new Version(*version));
}
return current_version.release();
@@ -467,7 +467,7 @@ void InstallerState::RemoveOldVersionDirectories(
const Version& new_version,
Version* existing_version,
const FilePath& temp_path) const {
- scoped_ptr<Version> version;
+ Version version;
std::vector<FilePath> key_files;
scoped_ptr<WorkItem> item;
@@ -478,12 +478,12 @@ void InstallerState::RemoveOldVersionDirectories(
for (FilePath next_version = version_enum.Next(); !next_version.empty();
next_version = version_enum.Next()) {
FilePath dir_name(next_version.BaseName());
- version.reset(Version::GetVersionFromString(WideToASCII(dir_name.value())));
+ version = Version(WideToASCII(dir_name.value()));
// Delete the version folder if it is less than the new version and not
// equal to the old version (if we have an old version).
- if (version.get() &&
- version->CompareTo(new_version) < 0 &&
- (existing_version == NULL || !version->Equals(*existing_version))) {
+ if (version.IsValid() &&
+ version.CompareTo(new_version) < 0 &&
+ (existing_version == NULL || !version.Equals(*existing_version))) {
// Collect the key files (relative to the version dir) for all products.
key_files.clear();
std::for_each(products_.begin(), products_.end(),
diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc
index 5029699..316a052 100644
--- a/chrome/installer/util/installer_state_unittest.cc
+++ b/chrome/installer/util/installer_state_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -136,12 +136,11 @@ TEST_F(InstallerStateTest, Delete) {
MockInstallerState installer_state;
BuildSingleChromeState(chrome_dir, &installer_state);
- scoped_ptr<Version> latest_version(Version::GetVersionFromString("1.0.4.0"));
+ Version latest_version("1.0.4.0");
{
ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- installer_state.RemoveOldVersionDirectories(*latest_version.get(),
- NULL,
+ installer_state.RemoveOldVersionDirectories(latest_version, NULL,
temp_dir.path());
}
@@ -217,14 +216,13 @@ TEST_F(InstallerStateTest, DeleteInUsed) {
MockInstallerState installer_state;
BuildSingleChromeState(chrome_dir, &installer_state);
- scoped_ptr<Version> latest_version(Version::GetVersionFromString("1.0.4.0"));
- scoped_ptr<Version> existing_version(
- Version::GetVersionFromString("1.0.1.0"));
+ Version latest_version("1.0.4.0");
+ Version existing_version("1.0.1.0");
{
ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- installer_state.RemoveOldVersionDirectories(*latest_version.get(),
- existing_version.get(),
+ installer_state.RemoveOldVersionDirectories(latest_version,
+ &existing_version,
temp_dir.path());
}
@@ -262,19 +260,18 @@ TEST_F(InstallerStateTest, Basic) {
const char kOldVersion[] = "1.2.3.4";
const char kNewVersion[] = "2.3.4.5";
- scoped_ptr<Version> new_version(Version::GetVersionFromString(kNewVersion));
- scoped_ptr<Version> old_version(Version::GetVersionFromString(kOldVersion));
- ASSERT_TRUE(new_version.get() != NULL);
- ASSERT_TRUE(old_version.get() != NULL);
+ Version new_version(kNewVersion);
+ Version old_version(kOldVersion);
+ ASSERT_TRUE(new_version.IsValid());
+ ASSERT_TRUE(old_version.IsValid());
- FilePath installer_dir(
- installer_state.GetInstallerDirectory(*new_version.get()));
+ FilePath installer_dir(installer_state.GetInstallerDirectory(new_version));
EXPECT_FALSE(installer_dir.empty());
FilePath new_version_dir(installer_state.target_path().Append(
- UTF8ToWide(new_version->GetString())));
+ UTF8ToWide(new_version.GetString())));
FilePath old_version_dir(installer_state.target_path().Append(
- UTF8ToWide(old_version->GetString())));
+ UTF8ToWide(old_version.GetString())));
EXPECT_FALSE(file_util::PathExists(new_version_dir));
EXPECT_FALSE(file_util::PathExists(old_version_dir));
@@ -304,7 +301,7 @@ TEST_F(InstallerStateTest, Basic) {
// Don't explicitly tell the directory cleanup logic not to delete the
// old version, rely on the key files to keep it around.
- installer_state.RemoveOldVersionDirectories(*new_version.get(),
+ installer_state.RemoveOldVersionDirectories(new_version,
NULL,
temp_dir.path());
@@ -315,7 +312,7 @@ TEST_F(InstallerStateTest, Basic) {
// Now close the file handle to make it possible to delete our key file.
file.Close();
- installer_state.RemoveOldVersionDirectories(*new_version.get(),
+ installer_state.RemoveOldVersionDirectories(new_version,
NULL,
temp_dir.path());
// The new directory should still exist.
@@ -343,8 +340,7 @@ TEST_F(InstallerStateTest, WithProduct) {
EXPECT_EQ(system_level, installer_state.system_install());
const char kCurrentVersion[] = "1.2.3.4";
- scoped_ptr<Version> current_version(
- Version::GetVersionFromString(kCurrentVersion));
+ Version current_version(kCurrentVersion);
HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
EXPECT_EQ(root, installer_state.root_key());
@@ -358,15 +354,13 @@ TEST_F(InstallerStateTest, WithProduct) {
EXPECT_TRUE(chrome_key.Valid());
if (chrome_key.Valid()) {
chrome_key.WriteValue(google_update::kRegVersionField,
- UTF8ToWide(current_version->GetString()).c_str());
+ UTF8ToWide(current_version.GetString()).c_str());
machine_state.Initialize();
// TODO(tommi): Also test for when there exists a new_chrome.exe.
- scoped_ptr<Version> found_version(installer_state.GetCurrentVersion(
- machine_state));
- EXPECT_TRUE(found_version.get() != NULL);
- if (found_version.get()) {
- EXPECT_TRUE(current_version->Equals(*found_version));
- }
+ Version found_version(*installer_state.GetCurrentVersion(machine_state));
+ EXPECT_TRUE(found_version.IsValid());
+ if (found_version.IsValid())
+ EXPECT_TRUE(current_version.Equals(found_version));
}
}
}
@@ -454,7 +448,7 @@ TEST_F(InstallerStateTest, GetCurrentVersionMigrateChrome) {
// Pretend that this version of single-install Chrome is already installed.
machine_state.AddChrome(system_install, false,
- Version::GetVersionFromString(chrome::kChromeVersion));
+ new Version(chrome::kChromeVersion));
// Now we're invoked to install multi Chrome.
CommandLine cmd_line(
diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc
index b96bba4..8fa3aed 100644
--- a/chrome/installer/util/product_unittest.cc
+++ b/chrome/installer/util/product_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -98,10 +98,9 @@ TEST_F(ProductTest, MAYBE_ProductInstallBasic) {
ASSERT_TRUE(version_key.Valid());
const char kCurrentVersion[] = "1.2.3.4";
- scoped_ptr<Version> current_version(
- Version::GetVersionFromString(kCurrentVersion));
+ Version current_version(kCurrentVersion);
version_key.WriteValue(google_update::kRegVersionField,
- UTF8ToWide(current_version->GetString()).c_str());
+ UTF8ToWide(current_version.GetString()).c_str());
// We started out with a non-msi product.
machine_state.Initialize();
@@ -109,7 +108,7 @@ TEST_F(ProductTest, MAYBE_ProductInstallBasic) {
machine_state.GetProductState(system_level, distribution->GetType());
EXPECT_TRUE(chrome_state != NULL);
if (chrome_state != NULL) {
- EXPECT_TRUE(chrome_state->version().Equals(*current_version.get()));
+ EXPECT_TRUE(chrome_state->version().Equals(current_version));
EXPECT_FALSE(chrome_state->is_msi());
}
diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc
index ad93c54..8565dfd 100644
--- a/chrome/test/mini_installer_test/installer_test_util.cc
+++ b/chrome/test/mini_installer_test/installer_test_util.cc
@@ -112,11 +112,11 @@ bool GetInstalledProducts(
if (type != InstallationValidator::NO_PRODUCTS) {
current_dist = BrowserDistribution::GetSpecificDistribution(
ToBrowserDistributionType(type));
- scoped_ptr<Version> version(
- InstallUtil::GetChromeVersion(current_dist, system_level));
- if (version.get()) {
+ Version version;
+ InstallUtil::GetChromeVersion(current_dist, system_level, &version);
+ if (version.IsValid()) {
current_prod.type = type;
- current_prod.version = version->GetString();
+ current_prod.version = version.GetString();
current_prod.system = system_level;
products->push_back(current_prod);
}