summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 01:46:43 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 01:46:43 +0000
commitbcff05af3d60df10a21e07751a14b95ce9e7f3d4 (patch)
tree76d8d3ec6c6c0d9564c675d423907e29607bf253 /chrome
parent474b2ab8c3b32c07692480aa234f3b2921fe5dd6 (diff)
downloadchromium_src-bcff05af3d60df10a21e07751a14b95ce9e7f3d4.zip
chromium_src-bcff05af3d60df10a21e07751a14b95ce9e7f3d4.tar.gz
chromium_src-bcff05af3d60df10a21e07751a14b95ce9e7f3d4.tar.bz2
Refactor FileVersionInfo into an interface with platform implementations.
This allows us to move the chrome specific version informaton used by Linux into src/chrome. Add a GetChromeVersionInfo() for Linux in src/chrome/app/ and make sure to use this in src/chrome. In src/webkit/glue, add a new glue method for getting the product version. When compiling chrome, use an implementation in src/chrome/renderer (which uses GetChromeVersionInfo()) and a stub implementation for test_shell. Review URL: http://codereview.chromium.org/1560027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/chrome_version_info.cc52
-rw-r--r--chrome/app/chrome_version_info.h18
-rw-r--r--chrome/app/chrome_version_info_posix.h.version26
-rw-r--r--chrome/browser/automation/automation_provider.cc9
-rw-r--r--chrome/browser/browser_about_handler.cc3
-rw-r--r--chrome/browser/bug_report_util.cc3
-rw-r--r--chrome/browser/diagnostics/recon_diagnostics.cc3
-rw-r--r--chrome/browser/extensions/extension_updater.cc5
-rw-r--r--chrome/browser/gtk/about_chrome_dialog.cc3
-rw-r--r--chrome/browser/memory_details_mac.cc3
-rw-r--r--chrome/browser/memory_details_win.cc3
-rw-r--r--chrome/browser/metrics/metrics_log.cc3
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc3
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc3
-rw-r--r--chrome/browser/views/about_chrome_view.cc3
-rw-r--r--chrome/browser/views/bug_report_view.cc3
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/chrome_exe.gypi63
-rw-r--r--chrome/common/extensions/extension.cc3
-rw-r--r--chrome/renderer/renderer_glue.cc12
-rw-r--r--chrome/test/automation/automation_proxy.cc3
-rw-r--r--chrome/test/reliability/page_load_test.cc8
23 files changed, 212 insertions, 23 deletions
diff --git a/chrome/app/chrome_version_info.cc b/chrome/app/chrome_version_info.cc
new file mode 100644
index 0000000..577cb32
--- /dev/null
+++ b/chrome/app/chrome_version_info.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 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.
+
+#include "chrome/app/chrome_version_info.h"
+
+#include "base/basictypes.h"
+#include "base/file_version_info.h"
+#include "build/build_config.h"
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#include "chrome/app/chrome_version_info_posix.h"
+
+// Posix files don't have per-file version information, so we get chrome
+// version information from chrome_version_info_posix.h, a generated header.
+class ChromeVersionInfoPosix : public FileVersionInfo {
+ public:
+ ChromeVersionInfoPosix() {}
+
+ virtual std::wstring company_name() { return COMPANY_NAME; }
+ virtual std::wstring company_short_name() { return COMPANY_SHORT_NAME; }
+ virtual std::wstring product_name() { return PRODUCT_NAME; }
+ virtual std::wstring product_short_name() { return PRODUCT_SHORT_NAME; }
+ virtual std::wstring internal_name() { return INTERNAL_NAME; }
+ virtual std::wstring product_version() { return PRODUCT_VERSION; }
+ virtual std::wstring private_build() { return PRIVATE_BUILD; }
+ virtual std::wstring special_build() { return SPECIAL_BUILD; }
+ virtual std::wstring comments() { return COMMENTS; }
+ virtual std::wstring original_filename() { return ORIGINAL_FILENAME; }
+ virtual std::wstring file_description() { return FILE_DESCRIPTION; }
+ virtual std::wstring file_version() { return FILE_VERSION; }
+ virtual std::wstring legal_copyright() { return LEGAL_COPYRIGHT; }
+ virtual std::wstring legal_trademarks() { return LEGAL_TRADEMARKS; }
+ virtual std::wstring last_change() { return LAST_CHANGE; }
+ virtual bool is_official_build() { return OFFICIAL_BUILD; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeVersionInfoPosix);
+};
+#endif
+
+namespace chrome_app {
+
+FileVersionInfo* GetChromeVersionInfo() {
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ return FileVersionInfo::CreateFileVersionInfoForCurrentModule();
+#elif defined(OS_POSIX)
+ return new ChromeVersionInfoPosix();
+#endif
+}
+
+} // namespace chrome_app
diff --git a/chrome/app/chrome_version_info.h b/chrome/app/chrome_version_info.h
new file mode 100644
index 0000000..472bcf4
--- /dev/null
+++ b/chrome/app/chrome_version_info.h
@@ -0,0 +1,18 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_APP_CHROME_VERSION_INFO_H_
+#define CHROME_APP_CHROME_VERSION_INFO_H_
+
+class FileVersionInfo;
+
+namespace chrome_app {
+
+// Creates a FileVersionInfo for the app, Chrome. Returns NULL in case of
+// error. The returned object should be deleted when you are done with it.
+FileVersionInfo* GetChromeVersionInfo();
+
+}
+
+#endif // CHROME_APP_CHROME_VERSION_INFO_H_
diff --git a/chrome/app/chrome_version_info_posix.h.version b/chrome/app/chrome_version_info_posix.h.version
new file mode 100644
index 0000000..01295f2
--- /dev/null
+++ b/chrome/app/chrome_version_info_posix.h.version
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_APP_CHROME_VERSION_INFO_POSIX_H_
+#define CHROME_APP_CHROME_VERSION_INFO_POSIX_H_
+
+#define COMPANY_NAME L"@COMPANY_FULLNAME@"
+#define FILE_DESCRIPTION L"@PRODUCT_FULLNAME@"
+#define FILE_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
+#define LEGAL_COPYRIGHT L"@COPYRIGHT@"
+#define PRODUCT_NAME L"@PRODUCT_FULLNAME@"
+#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
+#define COMPANY_SHORT_NAME L"@COMPANY_SHORTNAME@"
+#define PRODUCT_SHORT_NAME L"@PRODUCT_SHORTNAME@"
+#define LAST_CHANGE L"@LASTCHANGE@"
+#define OFFICIAL_BUILD @OFFICIAL_BUILD@
+// TODO(mmoss) Do these have values for Linux?
+#define INTERNAL_NAME L""
+#define ORIGINAL_FILENAME L""
+#define PRIVATE_BUILD L""
+#define SPECIAL_BUILD L""
+#define COMMENTS L""
+#define LEGAL_TRADEMARKS L""
+
+#endif // CHROME_APP_CHROME_VERSION_INFO_POSIX_H_
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 1aac1b1..3ef5750 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -22,6 +22,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/app_modal_dialog.h"
#include "chrome/browser/app_modal_dialog_queue.h"
#include "chrome/browser/automation/automation_extension_function.h"
@@ -187,11 +188,11 @@ void AutomationProvider::ConnectToChannel(const std::string& channel_id) {
automation_resource_message_filter_,
g_browser_process->io_thread()->message_loop(),
true, g_browser_process->shutdown_event()));
- scoped_ptr<FileVersionInfo> file_version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ scoped_ptr<FileVersionInfo> version_info(
+ chrome_app::GetChromeVersionInfo());
std::string version_string;
- if (file_version_info != NULL) {
- version_string = WideToASCII(file_version_info->file_version());
+ if (version_info != NULL) {
+ version_string = WideToASCII(version_info->file_version());
}
// Send a hello message with our current automation protocol version.
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index af05798..fa6bbe4 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -20,6 +20,7 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "base/tracked_objects.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
@@ -477,7 +478,7 @@ std::string AboutVersion(DictionaryValue* localized_strings) {
localized_strings->SetString(L"title",
l10n_util::GetString(IDS_ABOUT_VERSION_TITLE));
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info == NULL) {
DLOG(ERROR) << "Unable to create FileVersionInfo object";
return std::string();
diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc
index 1f8628e..8426e35 100644
--- a/chrome/browser/bug_report_util.cc
+++ b/chrome/browser/bug_report_util.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/file_version_info.h"
#include "base/utf_string_conversions.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
@@ -144,7 +145,7 @@ void BugReportUtil::SendReport(Profile* profile,
std::string chrome_version;
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get()) {
chrome_version = WideToUTF8(version_info->product_name()) + " - " +
WideToUTF8(version_info->file_version()) +
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc
index e2d214a..c32900c 100644
--- a/chrome/browser/diagnostics/recon_diagnostics.cc
+++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -12,6 +12,7 @@
#include "base/utf_string_conversions.h"
#include "base/sys_info.h"
#include "base/path_service.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/diagnostics/diagnostics_test.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/platform_util.h"
@@ -114,7 +115,7 @@ class VersionTest : public DiagnosticTest {
virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) {
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (!version_info.get()) {
RecordFailure(ASCIIToUTF16("No Version"));
return true;
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 09b90c8..eec96d9 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -17,6 +17,7 @@
#include "base/time.h"
#include "base/thread.h"
#include "base/version.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/pref_service.h"
@@ -781,10 +782,10 @@ std::vector<int> ExtensionUpdater::DetermineUpdates(
// First determine the browser version if we haven't already.
if (!browser_version.get()) {
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get()) {
browser_version.reset(Version::GetVersionFromString(
- version_info->product_version()));
+ version_info->product_version()));
}
}
scoped_ptr<Version> browser_min_version(
diff --git a/chrome/browser/gtk/about_chrome_dialog.cc b/chrome/browser/gtk/about_chrome_dialog.cc
index 712228f..0299d52 100644
--- a/chrome/browser/gtk/about_chrome_dialog.cc
+++ b/chrome/browser/gtk/about_chrome_dialog.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/file_version_info.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/gtk/cairo_cached_surface.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
@@ -104,7 +105,7 @@ void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
static GdkPixbuf* background = rb.GetPixbufNamed(IDR_ABOUT_BACKGROUND);
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
std::wstring current_version = version_info->file_version();
#if !defined(GOOGLE_CHROME_BUILD)
current_version += L" (";
diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc
index 2b334e4..dd1116b5 100644
--- a/chrome/browser/memory_details_mac.cc
+++ b/chrome/browser/memory_details_mac.cc
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "base/process_util.h"
#include "base/thread.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/child_process_host.h"
#include "chrome/browser/chrome_thread.h"
@@ -198,7 +199,7 @@ void MemoryDetails::CollectProcessDataChrome(
info.type = ChildProcessInfo::UNKNOWN_PROCESS;
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get()) {
info.product_name = version_info->product_name();
info.version = version_info->product_version();
diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc
index c7fb40b..56ae424 100644
--- a/chrome/browser/memory_details_win.cc
+++ b/chrome/browser/memory_details_win.cc
@@ -8,6 +8,7 @@
#include "app/l10n_util.h"
#include "base/file_version_info.h"
#include "base/string_util.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/child_process_host.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
@@ -121,7 +122,7 @@ void MemoryDetails::CollectProcessData(
TCHAR name[MAX_PATH];
if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) {
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info != NULL)
info.version = version_info->file_version();
// Check if this is one of the child processes whose data we collected
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 03dd925..baa7ec3 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -15,6 +15,7 @@
#include "base/sys_info.h"
#include "base/utf_string_conversions.h"
#include "base/third_party/nspr/prtime.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/pref_service.h"
@@ -302,7 +303,7 @@ void MetricsLog::EndElement() {
// static
std::string MetricsLog::GetVersionString() {
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get()) {
std::string version = WideToUTF8(version_info->product_version());
if (!version_extension_.empty())
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 4fe02ce..0a293c8 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -14,6 +14,7 @@
#include "base/string_util.h"
#include "base/task.h"
#include "base/timer.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
@@ -87,7 +88,7 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager(
next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec);
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (!version_info.get())
version_ = "0.1";
else
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index e58d84b..6d6b697 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -7,6 +7,7 @@
#include "base/file_version_info.h"
#include "base/task.h"
#include "base/utf_string_conversions.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/glue/change_processor.h"
@@ -320,7 +321,7 @@ std::string MakeUserAgentForSyncapi() {
user_agent += "MAC ";
#endif
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info == NULL) {
DLOG(ERROR) << "Unable to create FileVersionInfo object";
return user_agent;
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index 231ce94..4885b07 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -10,6 +10,7 @@
#include "base/file_version_info.h"
#include "base/i18n/rtl.h"
#include "base/utf_string_conversions.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/common/chrome_constants.h"
@@ -130,7 +131,7 @@ void AboutChromeView::Init() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get() == NULL) {
NOTREACHED() << L"Failed to initialize about window";
return;
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index b5e5f2a..352579e 100644
--- a/chrome/browser/views/bug_report_view.cc
+++ b/chrome/browser/views/bug_report_view.cc
@@ -8,6 +8,7 @@
#include "app/l10n_util.h"
#include "base/file_version_info.h"
#include "base/utf_string_conversions.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/bug_report_util.h"
#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/pref_service.h"
@@ -136,7 +137,7 @@ BugReportView::BugReportView(Profile* profile, TabContents* tab)
// Retrieve the application version info.
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (version_info.get()) {
version_ = version_info->product_name() + L" - " +
version_info->file_version() +
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index fef2da9..c9b2698 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1452,6 +1452,7 @@
'type': '<(library)',
'msvs_guid': '1556EF78-C7E6-43C8-951F-F6B43AC0DD12',
'dependencies': [
+ 'chrome_version_info',
'theme_resources',
'../skia/skia.gyp:skia',
'../testing/gtest.gyp:gtest',
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1689163..ec195eb 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -12,6 +12,7 @@
'common',
'chrome_resources',
'chrome_strings',
+ 'chrome_version_info',
'component_extensions',
'net_internals_resources',
'platform_locale_settings',
@@ -2479,7 +2480,6 @@
'../build/linux/system.gyp:gtk',
'../build/linux/system.gyp:gtkprint',
'../build/linux/system.gyp:nss',
- '../base/base.gyp:linux_versioninfo',
],
'link_settings': {
'libraries': [
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi
index 90421e3..5a36001 100644
--- a/chrome/chrome_exe.gypi
+++ b/chrome/chrome_exe.gypi
@@ -131,6 +131,7 @@
'chrome_exe_target': 1,
},
'dependencies': [
+ 'chrome_version_info',
# Copy a Flash Player binary to PRODUCT_DIR if applicable.
# Let the .gyp file decide what to do on a per-OS basis.
'../third_party/adobe/flash/flash_player.gyp:flash_player',
@@ -493,6 +494,68 @@
}],
],
},
+ {
+ 'target_name': 'chrome_version_info',
+ 'type': '<(library)',
+ 'sources': [
+ 'app/chrome_version_info.cc',
+ 'app/chrome_version_info.h',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)',
+ ],
+ 'conditions': [
+ [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'posix_version',
+ 'variables': {
+ 'lastchange_path':
+ '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE',
+ 'version_py_path': 'tools/build/version.py',
+ 'version_path': 'VERSION',
+ 'template_input_path': 'app/chrome_version_info_posix.h.version',
+ },
+ 'conditions': [
+ [ 'branding == "Chrome"', {
+ 'variables': {
+ 'branding_path':
+ 'app/theme/google_chrome/BRANDING',
+ },
+ }, { # else branding!="Chrome"
+ 'variables': {
+ 'branding_path':
+ 'app/theme/chromium/BRANDING',
+ },
+ }],
+ ],
+ 'inputs': [
+ '<(template_input_path)',
+ '<(version_path)',
+ '<(branding_path)',
+ '<(lastchange_path)',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/chrome/app/chrome_version_info_posix.h',
+ ],
+ 'action': [
+ 'python',
+ '<(version_py_path)',
+ '-f', '<(version_path)',
+ '-f', '<(branding_path)',
+ '-f', '<(lastchange_path)',
+ '<(template_input_path)',
+ '<@(_outputs)',
+ ],
+ 'message': 'Generating version information',
+ },
+ ],
+ }],
+ ]
+ }
],
'conditions': [
['OS=="win"', {
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 2e8b5bf..a598e9f 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -19,6 +19,7 @@
#include "base/third_party/nss/blapi.h"
#include "base/third_party/nss/sha256.h"
#include "base/utf_string_conversions.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -975,7 +976,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
}
scoped_ptr<FileVersionInfo> current_version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
if (!current_version_info.get()) {
DCHECK(false);
return false;
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index bf879be18..c2b4d0d 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -15,7 +15,10 @@
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
#include "app/resource_bundle.h"
+#include "base/file_version_info.h"
+#include "base/ref_counted.h"
#include "base/string_util.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/socket_stream_dispatcher.h"
@@ -265,4 +268,13 @@ void SetCacheMode(bool enabled) {
RenderThread::current()->SetCacheMode(enabled);
}
+std::string GetProductVersion() {
+ scoped_ptr<FileVersionInfo> version_info(
+ chrome_app::GetChromeVersionInfo());
+ std::string product("Chrome/");
+ product += version_info.get() ? WideToASCII(version_info->product_version())
+ : "0.0.0.0";
+ return product;
+}
+
} // namespace webkit_glue
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 04bc7ea..ecaf5d8 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -13,6 +13,7 @@
#include "base/process_util.h"
#include "base/ref_counted.h"
#include "base/waitable_event.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -173,7 +174,7 @@ AutomationLaunchResult AutomationProxy::WaitForAppLaunch() {
// Obtain our own version number and compare it to what the automation
// provider sent.
scoped_ptr<FileVersionInfo> file_version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ chrome_app::GetChromeVersionInfo());
DCHECK(file_version_info != NULL);
std::string version_string(
WideToASCII(file_version_info->file_version()));
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index 8d63696..fb673b9 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -47,6 +47,7 @@
#include "base/string_util.h"
#include "base/test/test_file_util.h"
#include "base/time.h"
+#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_constants.h"
@@ -160,9 +161,10 @@ class PageLoadTest : public UITest {
#if defined(OS_WIN)
file_info.reset(FileVersionInfo::CreateFileVersionInfo(kChromeDll));
#elif defined(OS_LINUX) || defined(OS_MACOSX)
- // TODO(fmeawad): the version retrieved here belongs to the test module and
- // not the chrome binary, need to be changed to chrome binary instead.
- file_info.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule());
+ // TODO(fmeawad): On Mac, the version retrieved here belongs to the test
+ // module and not the chrome binary, need to be changed to chrome binary
+ // instead.
+ file_info.reset(chrome_app::GetChromeVersionInfo());
#endif // !defined(OS_WIN)
std::wstring last_change = file_info->last_change();
test_log << "Last Change: ";