summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-18 00:31:30 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-18 00:31:30 +0000
commitd9cb161850584e5d277b141aadb68abec0af28bb (patch)
tree52cdb82bc14b488f7c93edcaa018550fcd8c9cc3 /chrome/common
parent92f132ae9e06a0f55d65b44a324ac74b53a2945d (diff)
downloadchromium_src-d9cb161850584e5d277b141aadb68abec0af28bb.zip
chromium_src-d9cb161850584e5d277b141aadb68abec0af28bb.tar.gz
chromium_src-d9cb161850584e5d277b141aadb68abec0af28bb.tar.bz2
file_version_info was not finding Mac values correctly.
Changed file_version_info to find Mac values, and changed version_info to fail if values can't be found. BUG=NONE TEST=BUILD Review URL: http://codereview.chromium.org/5815001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69592 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_version_info.cc25
-rw-r--r--chrome/common/chrome_version_info.h6
-rw-r--r--chrome/common/extensions/extension.cc5
-rw-r--r--chrome/common/service_process_util.cc11
-rw-r--r--chrome/common/service_process_util_unittest.cc1
5 files changed, 6 insertions, 42 deletions
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc
index 5157c4a..70e8cb24 100644
--- a/chrome/common/chrome_version_info.cc
+++ b/chrome/common/chrome_version_info.cc
@@ -9,47 +9,38 @@
#include "base/string_util.h"
#include "base/thread_restrictions.h"
#include "build/build_config.h"
+#include "chrome/common/chrome_constants.h"
namespace chrome {
#if defined(OS_WIN) || defined(OS_MACOSX)
-// On Windows and Mac, we get the Chrome version info by querying
-// FileVersionInfo for the current module.
+// On Windows and Mac we get the Chrome version info by querying FileVersionInfo
+// for the current module.
VersionInfo::VersionInfo() {
// The current module is already loaded in memory, so this will be cheap.
base::ThreadRestrictions::ScopedAllowIO allow_io;
version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ DCHECK(version_info_.get());
}
VersionInfo::~VersionInfo() {
}
-bool VersionInfo::is_valid() const {
- return version_info_.get() != NULL;
-}
-
std::string VersionInfo::Name() const {
- if (!is_valid())
- return std::string();
- return WideToASCII(version_info_->product_name());
+ std::wstring name = version_info_->product_name();
+ return WideToASCII(name);
}
std::string VersionInfo::Version() const {
- if (!is_valid())
- return std::string();
return WideToASCII(version_info_->product_version());
}
std::string VersionInfo::LastChange() const {
- if (!is_valid())
- return std::string();
return WideToASCII(version_info_->last_change());
}
bool VersionInfo::IsOfficialBuild() const {
- if (!is_valid())
- return false;
return version_info_->is_official_build();
}
@@ -65,10 +56,6 @@ VersionInfo::VersionInfo() {
VersionInfo::~VersionInfo() {
}
-bool VersionInfo::is_valid() const {
- return true;
-}
-
std::string VersionInfo::Name() const {
return PRODUCT_NAME;
}
diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h
index 0ec911e..b785249 100644
--- a/chrome/common/chrome_version_info.h
+++ b/chrome/common/chrome_version_info.h
@@ -22,12 +22,6 @@ class VersionInfo {
VersionInfo();
~VersionInfo();
- // In the rare case where we fail to get the version info,
- // is_valid() will return false. The other functions will return
- // the empty string in this case, so it's not harmful if you don't
- // check is_valid().
- bool is_valid() const;
-
// E.g. "Chromium" or "Google Chrome".
std::string Name() const;
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 56e0683..3cbe44d 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1343,11 +1343,6 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
}
chrome::VersionInfo current_version_info;
- if (!current_version_info.is_valid()) {
- NOTREACHED();
- return false;
- }
-
scoped_ptr<Version> current_version(
Version::GetVersionFromString(current_version_info.Version()));
if (!current_version.get()) {
diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc
index bcbac69..4c22fda 100644
--- a/chrome/common/service_process_util.cc
+++ b/chrome/common/service_process_util.cc
@@ -82,12 +82,6 @@ ServiceProcessRunningState GetServiceProcessRunningState(
// Get the version of the currently *running* instance of Chrome.
chrome::VersionInfo version_info;
- if (!version_info.is_valid()) {
- NOTREACHED() << "Failed to get current file version";
- // Our own version is invalid. This is an error case. Pretend that we
- // are out of date.
- return SERVICE_NEWER_VERSION_RUNNING;
- }
scoped_ptr<Version> running_version(Version::GetVersionFromString(
version_info.Version()));
if (!running_version.get()) {
@@ -130,7 +124,6 @@ std::string GetServiceProcessScopedVersionedName(
const std::string& append_str) {
std::string versioned_str;
chrome::VersionInfo version_info;
- DCHECK(version_info.is_valid());
versioned_str.append(version_info.Version());
versioned_str.append(append_str);
return GetServiceProcessScopedName(versioned_str);
@@ -198,10 +191,6 @@ bool ServiceProcessState::HandleOtherVersion() {
bool ServiceProcessState::CreateSharedData() {
chrome::VersionInfo version_info;
- if (!version_info.is_valid()) {
- NOTREACHED() << "Failed to get current file version";
- return false;
- }
if (version_info.Version().length() >= kMaxVersionStringLength) {
NOTREACHED() << "Version string length is << " <<
version_info.Version().length() << "which is longer than" <<
diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc
index 58b68e1..34b855a 100644
--- a/chrome/common/service_process_util_unittest.cc
+++ b/chrome/common/service_process_util_unittest.cc
@@ -14,7 +14,6 @@ TEST(ServiceProcessUtilTest, ScopedVersionedName) {
std::string test_str = "test";
std::string scoped_name = GetServiceProcessScopedVersionedName(test_str);
chrome::VersionInfo version_info;
- DCHECK(version_info.is_valid());
EXPECT_TRUE(EndsWith(scoped_name, test_str, true));
EXPECT_NE(std::string::npos, scoped_name.find(version_info.Version()));
}