Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: chrome/common/chrome_version_info.cc

Issue 634583003: Simplify VersionInfo code, avoid hitting sandbox IPC constantly on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linux include Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_version_info.h ('k') | chrome/common/chrome_version_info_posix.h.version » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_version_info.cc
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc
index e197bd0a8253a38b359ed4447220a7dc4b2773a1..0b4a1ddf3d420054c8d2a55454d965b3fc688f74 100644
--- a/chrome/common/chrome_version_info.cc
+++ b/chrome/common/chrome_version_info.cc
@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
+#include "chrome/common/chrome_version_info_values.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -16,68 +17,15 @@
namespace chrome {
std::string VersionInfo::ProductNameAndVersionForUserAgent() const {
- if (!is_valid())
- return std::string();
return "Chrome/" + Version();
}
-#if defined(OS_WIN) || defined(OS_MACOSX)
-// 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());
}
VersionInfo::~VersionInfo() {
}
-bool VersionInfo::is_valid() const {
- return version_info_.get() != NULL;
-}
-
-std::string VersionInfo::Name() const {
- if (!is_valid())
- return std::string();
- return base::UTF16ToUTF8(version_info_->product_name());
-}
-
-std::string VersionInfo::Version() const {
- if (!is_valid())
- return std::string();
- return base::UTF16ToUTF8(version_info_->product_version());
-}
-
-std::string VersionInfo::LastChange() const {
- if (!is_valid())
- return std::string();
- return base::UTF16ToUTF8(version_info_->last_change());
-}
-
-bool VersionInfo::IsOfficialBuild() const {
- if (!is_valid())
- return false;
- return version_info_->is_official_build();
-}
-
-#elif defined(OS_POSIX)
-// We get chrome version information from chrome_version_info_posix.h,
-// a generated header.
-
-#include "chrome/common/chrome_version_info_posix.h"
-
-VersionInfo::VersionInfo() {
-}
-
-VersionInfo::~VersionInfo() {
-}
-
-bool VersionInfo::is_valid() const {
- return true;
-}
-
std::string VersionInfo::Name() const {
return PRODUCT_NAME;
}
@@ -94,25 +42,21 @@ bool VersionInfo::IsOfficialBuild() const {
return IS_OFFICIAL_BUILD;
}
-#endif
-
std::string VersionInfo::CreateVersionString() const {
std::string current_version;
- if (is_valid()) {
- current_version += Version();
+ current_version += Version();
#if !defined(GOOGLE_CHROME_BUILD)
- current_version += " (";
- current_version += l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL);
- current_version += " ";
- current_version += LastChange();
- current_version += " ";
- current_version += OSType();
- current_version += ")";
+ current_version += " (";
+ current_version += l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL);
+ current_version += " ";
+ current_version += LastChange();
+ current_version += " ";
+ current_version += OSType();
+ current_version += ")";
#endif
- std::string modifier = GetVersionStringModifier();
- if (!modifier.empty())
- current_version += " " + modifier;
- }
+ std::string modifier = GetVersionStringModifier();
+ if (!modifier.empty())
+ current_version += " " + modifier;
return current_version;
}
« no previous file with comments | « chrome/common/chrome_version_info.h ('k') | chrome/common/chrome_version_info_posix.h.version » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698