summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gyp59
-rw-r--r--base/base.gypi6
-rw-r--r--base/file_version_info.h83
-rw-r--r--base/file_version_info_linux.cc86
-rw-r--r--base/file_version_info_mac.h63
-rw-r--r--base/file_version_info_mac.mm49
-rw-r--r--base/file_version_info_unittest.cc30
-rw-r--r--base/file_version_info_win.cc (renamed from base/file_version_info.cc)50
-rw-r--r--base/file_version_info_win.h67
-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.version (renamed from base/file_version_info_linux.h.version)8
-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
-rw-r--r--chrome_frame/chrome_frame.gyp1
-rw-r--r--chrome_frame/test/util_unittests.cc5
-rw-r--r--webkit/glue/plugins/plugin_lib_win.cc9
-rw-r--r--webkit/glue/webkit_glue.cc18
-rw-r--r--webkit/glue/webkit_glue.gypi1
-rw-r--r--webkit/glue/webkit_glue.h3
-rw-r--r--webkit/tools/test_shell/test_shell.cc4
39 files changed, 434 insertions, 317 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 05f8a0f..bccac47 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -268,65 +268,6 @@
},
],
}],
- [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', {
- 'targets': [
- {
- 'target_name': 'linux_versioninfo',
- 'type': '<(library)',
- 'sources': [
- 'file_version_info_linux.cc',
- ],
- 'include_dirs': [
- '..',
- '<(SHARED_INTERMEDIATE_DIR)',
- ],
- 'actions': [
- {
- 'action_name': 'linux_version',
- 'variables': {
- 'lastchange_path':
- '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE',
- 'version_py_path': '../chrome/tools/build/version.py',
- 'version_path': '../chrome/VERSION',
- 'template_input_path': 'file_version_info_linux.h.version',
- },
- 'conditions': [
- [ 'branding == "Chrome"', {
- 'variables': {
- 'branding_path':
- '../chrome/app/theme/google_chrome/BRANDING',
- },
- }, { # else branding!="Chrome"
- 'variables': {
- 'branding_path':
- '../chrome/app/theme/chromium/BRANDING',
- },
- }],
- ],
- 'inputs': [
- '<(template_input_path)',
- '<(version_path)',
- '<(branding_path)',
- '<(lastchange_path)',
- ],
- 'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/base/file_version_info_linux.h',
- ],
- 'action': [
- 'python',
- '<(version_py_path)',
- '-f', '<(version_path)',
- '-f', '<(branding_path)',
- '-f', '<(lastchange_path)',
- '<(template_input_path)',
- '<@(_outputs)',
- ],
- 'message': 'Generating version information',
- },
- ],
- },
- ],
- }],
],
}
diff --git a/base/base.gypi b/base/base.gypi
index df96e51..abdb161 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -80,9 +80,11 @@
'file_util_mac.mm',
'file_util_posix.cc',
'file_util_win.cc',
- 'file_version_info.cc',
'file_version_info.h',
+ 'file_version_info_mac.h',
'file_version_info_mac.mm',
+ 'file_version_info_win.cc',
+ 'file_version_info_win.h',
'fix_wp64.h',
'float_util.h',
'foundation_utils_mac.h',
@@ -301,7 +303,7 @@
'linux_util.cc',
'message_pump_glib.cc',
],
- },],
+ }],
[ 'OS != "linux"', {
'sources!': [
# Not automatically excluded by the *linux.cc rules.
diff --git a/base/file_version_info.h b/base/file_version_info.h
index 561c324..def2ea5 100644
--- a/base/file_version_info.h
+++ b/base/file_version_info.h
@@ -7,28 +7,17 @@
#include <string>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-#if defined(OS_WIN)
-struct tagVS_FIXEDFILEINFO;
-typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
-#elif defined(OS_MACOSX)
-#ifdef __OBJC__
-@class NSBundle;
-#else
-class NSBundle;
-#endif
-#endif
+#include "build/build_config.h"
class FilePath;
-// Provides a way to access the version information for a file.
+// Provides an interface for accessing the version information for a file.
// This is the information you access when you select a file in the Windows
// explorer, right-click select Properties, then click the Version tab.
class FileVersionInfo {
public:
+#if defined(OS_WIN) || defined(OS_MACOSX)
// Creates a FileVersionInfo for the specified path. Returns NULL if something
// goes wrong (typically the file does not exit or cannot be opened). The
// returned object should be deleted when you are done with it.
@@ -36,62 +25,30 @@ class FileVersionInfo {
// This version, taking a wstring, is deprecated and only kept around
// until we can fix all callers.
static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path);
+#endif
// Creates a FileVersionInfo for the current module. Returns NULL in case
// of error. The returned object should be deleted when you are done with it.
static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
- ~FileVersionInfo();
-
// Accessors to the different version properties.
// Returns an empty string if the property is not found.
- std::wstring company_name();
- std::wstring company_short_name();
- std::wstring product_name();
- std::wstring product_short_name();
- std::wstring internal_name();
- std::wstring product_version();
- std::wstring private_build();
- std::wstring special_build();
- std::wstring comments();
- std::wstring original_filename();
- std::wstring file_description();
- std::wstring file_version();
- std::wstring legal_copyright();
- std::wstring legal_trademarks();
- std::wstring last_change();
- bool is_official_build();
-
- // Lets you access other properties not covered above.
- bool GetValue(const wchar_t* name, std::wstring* value);
-
- // Similar to GetValue but returns a wstring (empty string if the property
- // does not exist).
- std::wstring GetStringValue(const wchar_t* name);
-
-#ifdef OS_WIN
- // Get the fixed file info if it exists. Otherwise NULL
- VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; }
-#endif
-
- private:
-#if defined(OS_WIN)
- FileVersionInfo(void* data, int language, int code_page);
-
- scoped_ptr_malloc<char> data_;
- int language_;
- int code_page_;
- // This is a pointer into the data_ if it exists. Otherwise NULL.
- VS_FIXEDFILEINFO* fixed_file_info_;
-#elif defined(OS_MACOSX)
- explicit FileVersionInfo(NSBundle *bundle);
-
- NSBundle *bundle_;
-#elif defined(OS_POSIX)
- FileVersionInfo();
-#endif
-
- DISALLOW_EVIL_CONSTRUCTORS(FileVersionInfo);
+ virtual std::wstring company_name() = 0;
+ virtual std::wstring company_short_name() = 0;
+ virtual std::wstring product_name() = 0;
+ virtual std::wstring product_short_name() = 0;
+ virtual std::wstring internal_name() = 0;
+ virtual std::wstring product_version() = 0;
+ virtual std::wstring private_build() = 0;
+ virtual std::wstring special_build() = 0;
+ virtual std::wstring comments() = 0;
+ virtual std::wstring original_filename() = 0;
+ virtual std::wstring file_description() = 0;
+ virtual std::wstring file_version() = 0;
+ virtual std::wstring legal_copyright() = 0;
+ virtual std::wstring legal_trademarks() = 0;
+ virtual std::wstring last_change() = 0;
+ virtual bool is_official_build() = 0;
};
#endif // BASE_FILE_VERSION_INFO_H__
diff --git a/base/file_version_info_linux.cc b/base/file_version_info_linux.cc
deleted file mode 100644
index 55e1bd2..0000000
--- a/base/file_version_info_linux.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2008 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 "base/file_version_info.h"
-#include "base/file_version_info_linux.h"
-
-#include <string>
-
-// TODO(mmoss) This only provides version info for the current binary, but it's
-// also called for arbitrary files (e.g. plugins).
-// See http://code.google.com/p/chromium/issues/detail?id=8132 for a discussion
-// on what we should do with this module.
-
-FileVersionInfo::FileVersionInfo() {}
-
-FileVersionInfo::~FileVersionInfo() {}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
- return new FileVersionInfo();
-}
-
-std::wstring FileVersionInfo::company_name() {
- return COMPANY_NAME;
-}
-
-std::wstring FileVersionInfo::company_short_name() {
- return COMPANY_SHORT_NAME;
-}
-
-std::wstring FileVersionInfo::product_name() {
- return PRODUCT_NAME;
-}
-
-std::wstring FileVersionInfo::product_short_name() {
- return PRODUCT_SHORT_NAME;
-}
-
-std::wstring FileVersionInfo::internal_name() {
- return INTERNAL_NAME;
-}
-
-std::wstring FileVersionInfo::product_version() {
- return PRODUCT_VERSION;
-}
-
-std::wstring FileVersionInfo::private_build() {
- return PRIVATE_BUILD;
-}
-
-std::wstring FileVersionInfo::special_build() {
- return SPECIAL_BUILD;
-}
-
-std::wstring FileVersionInfo::comments() {
- return COMMENTS;
-}
-
-std::wstring FileVersionInfo::original_filename() {
- return ORIGINAL_FILENAME;
-}
-
-std::wstring FileVersionInfo::file_description() {
- return FILE_DESCRIPTION;
-}
-
-std::wstring FileVersionInfo::file_version() {
- return FILE_VERSION;
-}
-
-std::wstring FileVersionInfo::legal_copyright() {
- return LEGAL_COPYRIGHT;
-}
-
-std::wstring FileVersionInfo::legal_trademarks() {
- return LEGAL_TRADEMARKS;
-}
-
-std::wstring FileVersionInfo::last_change() {
- return LAST_CHANGE;
-}
-
-bool FileVersionInfo::is_official_build() {
- return OFFICIAL_BUILD;
-}
diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h
new file mode 100644
index 0000000..a523f54
--- /dev/null
+++ b/base/file_version_info_mac.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2006-2008 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 BASE_FILE_VERSION_INFO_MAC_H_
+#define BASE_FILE_VERSION_INFO_MAC_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/file_version_info.h"
+#include "base/scoped_ptr.h"
+
+#ifdef __OBJC__
+@class NSBundle;
+#else
+class NSBundle;
+#endif
+
+class FilePath;
+
+// Provides a way to access the version information for a file.
+// This is the information you access when you select a file in the Windows
+// explorer, right-click select Properties, then click the Version tab.
+
+class FileVersionInfoMac : public FileVersionInfo {
+ public:
+ explicit FileVersionInfoMac(NSBundle *bundle);
+ ~FileVersionInfoMac();
+
+ // Accessors to the different version properties.
+ // Returns an empty string if the property is not found.
+ virtual std::wstring company_name();
+ virtual std::wstring company_short_name();
+ virtual std::wstring product_name();
+ virtual std::wstring product_short_name();
+ virtual std::wstring internal_name();
+ virtual std::wstring product_version();
+ virtual std::wstring private_build();
+ virtual std::wstring special_build();
+ virtual std::wstring comments();
+ virtual std::wstring original_filename();
+ virtual std::wstring file_description();
+ virtual std::wstring file_version();
+ virtual std::wstring legal_copyright();
+ virtual std::wstring legal_trademarks();
+ virtual std::wstring last_change();
+ virtual bool is_official_build();
+
+ private:
+ // Lets you access other properties not covered above.
+ bool GetValue(const wchar_t* name, std::wstring* value);
+
+ // Similar to GetValue but returns a wstring (empty string if the property
+ // does not exist).
+ std::wstring GetStringValue(const wchar_t* name);
+
+ NSBundle *bundle_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileVersionInfoMac);
+};
+
+#endif // BASE_FILE_VERSION_INFO_MAC_H_
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index c1395df..2218226 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_version_info.h"
+#include "base/file_version_info_mac.h"
#import <Cocoa/Cocoa.h>
@@ -11,11 +11,11 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) {
+FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) {
[bundle_ retain];
}
-FileVersionInfo::~FileVersionInfo() {
+FileVersionInfoMac::~FileVersionInfoMac() {
[bundle_ release];
}
@@ -24,7 +24,7 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
// TODO(erikkay): this should really use bundleForClass, but we don't have
// a class to hang onto yet.
NSBundle* bundle = [NSBundle mainBundle];
- return new FileVersionInfo(bundle);
+ return new FileVersionInfoMac(bundle);
}
// static
@@ -33,77 +33,77 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
NSString* path = [NSString stringWithCString:
reinterpret_cast<const char*>(file_path.c_str())
encoding:NSUTF32StringEncoding];
- return new FileVersionInfo([NSBundle bundleWithPath:path]);
+ return new FileVersionInfoMac([NSBundle bundleWithPath:path]);
}
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
const FilePath& file_path) {
NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()];
- return new FileVersionInfo([NSBundle bundleWithPath:path]);
+ return new FileVersionInfoMac([NSBundle bundleWithPath:path]);
}
-std::wstring FileVersionInfo::company_name() {
+std::wstring FileVersionInfoMac::company_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::company_short_name() {
+std::wstring FileVersionInfoMac::company_short_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::internal_name() {
+std::wstring FileVersionInfoMac::internal_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::product_name() {
+std::wstring FileVersionInfoMac::product_name() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::product_short_name() {
+std::wstring FileVersionInfoMac::product_short_name() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::comments() {
+std::wstring FileVersionInfoMac::comments() {
return std::wstring();
}
-std::wstring FileVersionInfo::legal_copyright() {
+std::wstring FileVersionInfoMac::legal_copyright() {
return GetStringValue(L"CFBundleGetInfoString");
}
-std::wstring FileVersionInfo::product_version() {
+std::wstring FileVersionInfoMac::product_version() {
return GetStringValue(L"CFBundleShortVersionString");
}
-std::wstring FileVersionInfo::file_description() {
+std::wstring FileVersionInfoMac::file_description() {
return std::wstring();
}
-std::wstring FileVersionInfo::legal_trademarks() {
+std::wstring FileVersionInfoMac::legal_trademarks() {
return std::wstring();
}
-std::wstring FileVersionInfo::private_build() {
+std::wstring FileVersionInfoMac::private_build() {
return std::wstring();
}
-std::wstring FileVersionInfo::file_version() {
+std::wstring FileVersionInfoMac::file_version() {
return product_version();
}
-std::wstring FileVersionInfo::original_filename() {
+std::wstring FileVersionInfoMac::original_filename() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::special_build() {
+std::wstring FileVersionInfoMac::special_build() {
return std::wstring();
}
-std::wstring FileVersionInfo::last_change() {
+std::wstring FileVersionInfoMac::last_change() {
return GetStringValue(L"SVNRevision");
}
-bool FileVersionInfo::is_official_build() {
+bool FileVersionInfoMac::is_official_build() {
#if defined (GOOGLE_CHROME_BUILD)
return true;
#else
@@ -111,7 +111,8 @@ bool FileVersionInfo::is_official_build() {
#endif
}
-bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
+bool FileVersionInfoMac::GetValue(const wchar_t* name,
+ std::wstring* value_str) {
if (bundle_) {
NSString* value = [bundle_ objectForInfoDictionaryKey:
[NSString stringWithUTF8String:WideToUTF8(name).c_str()]];
@@ -124,7 +125,7 @@ bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
return false;
}
-std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
+std::wstring FileVersionInfoMac::GetStringValue(const wchar_t* name) {
std::wstring str;
if (GetValue(name, &str))
return str;
diff --git a/base/file_version_info_unittest.cc b/base/file_version_info_unittest.cc
index 676e950..4e058f4 100644
--- a/base/file_version_info_unittest.cc
+++ b/base/file_version_info_unittest.cc
@@ -8,6 +8,10 @@
#include "base/file_version_info.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_WIN)
+#include "base/file_version_info_win.h"
+#endif
+
namespace {
class FileVersionInfoTest : public testing::Test {
@@ -24,7 +28,7 @@ FilePath GetTestDataPath() {
}
-#ifdef OS_WIN
+#if defined(OS_WIN)
TEST(FileVersionInfoTest, HardCodedProperties) {
const wchar_t* kDLLNames[] = {
L"FileVersionInfoTest1.dll"
@@ -76,7 +80,7 @@ TEST(FileVersionInfoTest, HardCodedProperties) {
}
#endif
-#ifdef OS_WIN
+#if defined(OS_WIN)
TEST(FileVersionInfoTest, IsOfficialBuild) {
const wchar_t* kDLLNames[] = {
L"FileVersionInfoTest1.dll",
@@ -103,6 +107,7 @@ TEST(FileVersionInfoTest, IsOfficialBuild) {
}
#endif
+#if defined(OS_WIN)
TEST(FileVersionInfoTest, CustomProperties) {
FilePath dll_path = GetTestDataPath();
dll_path = dll_path.AppendASCII("FileVersionInfoTest1.dll");
@@ -112,22 +117,23 @@ TEST(FileVersionInfoTest, CustomProperties) {
// Test few existing properties.
std::wstring str;
-#ifdef OS_WIN
- EXPECT_TRUE(version_info->GetValue(L"Custom prop 1", &str));
+ FileVersionInfoWin* version_info_win =
+ static_cast<FileVersionInfoWin*>(version_info.get());
+ EXPECT_TRUE(version_info_win->GetValue(L"Custom prop 1", &str));
EXPECT_EQ(L"Un", str);
- EXPECT_EQ(L"Un", version_info->GetStringValue(L"Custom prop 1"));
+ EXPECT_EQ(L"Un", version_info_win->GetStringValue(L"Custom prop 1"));
- EXPECT_TRUE(version_info->GetValue(L"Custom prop 2", &str));
+ EXPECT_TRUE(version_info_win->GetValue(L"Custom prop 2", &str));
EXPECT_EQ(L"Deux", str);
- EXPECT_EQ(L"Deux", version_info->GetStringValue(L"Custom prop 2"));
+ EXPECT_EQ(L"Deux", version_info_win->GetStringValue(L"Custom prop 2"));
- EXPECT_TRUE(version_info->GetValue(L"Custom prop 3", &str));
+ EXPECT_TRUE(version_info_win->GetValue(L"Custom prop 3", &str));
EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043", str);
EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043",
- version_info->GetStringValue(L"Custom prop 3"));
-#endif
+ version_info_win->GetStringValue(L"Custom prop 3"));
// Test an non-existing property.
- EXPECT_FALSE(version_info->GetValue(L"Unknown property", &str));
- EXPECT_EQ(L"", version_info->GetStringValue(L"Unknown property"));
+ EXPECT_FALSE(version_info_win->GetValue(L"Unknown property", &str));
+ EXPECT_EQ(L"", version_info_win->GetStringValue(L"Unknown property"));
}
+#endif
diff --git a/base/file_version_info.cc b/base/file_version_info_win.cc
index f9bee21..d1049b8 100644
--- a/base/file_version_info.cc
+++ b/base/file_version_info_win.cc
@@ -2,18 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_version_info.h"
+#include "base/file_version_info_win.h"
#include <windows.h>
#include "base/file_path.h"
+#include "base/file_version_info.h"
#include "base/logging.h"
#include "base/path_service.h"
// This has to be last.
#include <strsafe.h>
-FileVersionInfo::FileVersionInfo(void* data, int language, int code_page)
+FileVersionInfoWin::FileVersionInfoWin(void* data, int language, int code_page)
: language_(language), code_page_(code_page) {
data_.reset((char*) data);
fixed_file_info_ = NULL;
@@ -21,7 +22,7 @@ FileVersionInfo::FileVersionInfo(void* data, int language, int code_page)
::VerQueryValue(data_.get(), L"\\", (LPVOID*)&fixed_file_info_, &size);
}
-FileVersionInfo::~FileVersionInfo() {
+FileVersionInfoWin::~FileVersionInfoWin() {
DCHECK(data_.get());
}
@@ -63,8 +64,8 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
(void**) &translate, &page_count);
if (query_result && translate) {
- return new FileVersionInfo(data, translate->language,
- translate->code_page);
+ return new FileVersionInfoWin(data, translate->language,
+ translate->code_page);
} else {
free(data);
@@ -72,78 +73,79 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
}
}
+// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
const std::wstring& file_path) {
FilePath file_path_fp = FilePath::FromWStringHack(file_path);
return CreateFileVersionInfo(file_path_fp);
}
-std::wstring FileVersionInfo::company_name() {
+std::wstring FileVersionInfoWin::company_name() {
return GetStringValue(L"CompanyName");
}
-std::wstring FileVersionInfo::company_short_name() {
+std::wstring FileVersionInfoWin::company_short_name() {
return GetStringValue(L"CompanyShortName");
}
-std::wstring FileVersionInfo::internal_name() {
+std::wstring FileVersionInfoWin::internal_name() {
return GetStringValue(L"InternalName");
}
-std::wstring FileVersionInfo::product_name() {
+std::wstring FileVersionInfoWin::product_name() {
return GetStringValue(L"ProductName");
}
-std::wstring FileVersionInfo::product_short_name() {
+std::wstring FileVersionInfoWin::product_short_name() {
return GetStringValue(L"ProductShortName");
}
-std::wstring FileVersionInfo::comments() {
+std::wstring FileVersionInfoWin::comments() {
return GetStringValue(L"Comments");
}
-std::wstring FileVersionInfo::legal_copyright() {
+std::wstring FileVersionInfoWin::legal_copyright() {
return GetStringValue(L"LegalCopyright");
}
-std::wstring FileVersionInfo::product_version() {
+std::wstring FileVersionInfoWin::product_version() {
return GetStringValue(L"ProductVersion");
}
-std::wstring FileVersionInfo::file_description() {
+std::wstring FileVersionInfoWin::file_description() {
return GetStringValue(L"FileDescription");
}
-std::wstring FileVersionInfo::legal_trademarks() {
+std::wstring FileVersionInfoWin::legal_trademarks() {
return GetStringValue(L"LegalTrademarks");
}
-std::wstring FileVersionInfo::private_build() {
+std::wstring FileVersionInfoWin::private_build() {
return GetStringValue(L"PrivateBuild");
}
-std::wstring FileVersionInfo::file_version() {
+std::wstring FileVersionInfoWin::file_version() {
return GetStringValue(L"FileVersion");
}
-std::wstring FileVersionInfo::original_filename() {
+std::wstring FileVersionInfoWin::original_filename() {
return GetStringValue(L"OriginalFilename");
}
-std::wstring FileVersionInfo::special_build() {
+std::wstring FileVersionInfoWin::special_build() {
return GetStringValue(L"SpecialBuild");
}
-std::wstring FileVersionInfo::last_change() {
+std::wstring FileVersionInfoWin::last_change() {
return GetStringValue(L"LastChange");
}
-bool FileVersionInfo::is_official_build() {
+bool FileVersionInfoWin::is_official_build() {
return (GetStringValue(L"Official Build").compare(L"1") == 0);
}
-bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
-
+bool FileVersionInfoWin::GetValue(const wchar_t* name,
+ std::wstring* value_str) {
WORD lang_codepage[8];
int i = 0;
// Use the language and codepage from the DLL.
@@ -177,7 +179,7 @@ bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
return false;
}
-std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
+std::wstring FileVersionInfoWin::GetStringValue(const wchar_t* name) {
std::wstring str;
if (GetValue(name, &str))
return str;
diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h
new file mode 100644
index 0000000..ce173fe
--- /dev/null
+++ b/base/file_version_info_win.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2006-2008 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 BASE_FILE_VERSION_INFO_WIN_H_
+#define BASE_FILE_VERSION_INFO_WIN_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/file_version_info.h"
+#include "base/scoped_ptr.h"
+
+struct tagVS_FIXEDFILEINFO;
+typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
+
+class FilePath;
+
+// Provides a way to access the version information for a file.
+// This is the information you access when you select a file in the Windows
+// explorer, right-click select Properties, then click the Version tab.
+
+class FileVersionInfoWin : public FileVersionInfo {
+ public:
+ FileVersionInfoWin(void* data, int language, int code_page);
+ ~FileVersionInfoWin();
+
+ // Accessors to the different version properties.
+ // Returns an empty string if the property is not found.
+ virtual std::wstring company_name();
+ virtual std::wstring company_short_name();
+ virtual std::wstring product_name();
+ virtual std::wstring product_short_name();
+ virtual std::wstring internal_name();
+ virtual std::wstring product_version();
+ virtual std::wstring private_build();
+ virtual std::wstring special_build();
+ virtual std::wstring comments();
+ virtual std::wstring original_filename();
+ virtual std::wstring file_description();
+ virtual std::wstring file_version();
+ virtual std::wstring legal_copyright();
+ virtual std::wstring legal_trademarks();
+ virtual std::wstring last_change();
+ virtual bool is_official_build();
+
+ // Lets you access other properties not covered above.
+ bool GetValue(const wchar_t* name, std::wstring* value);
+
+ // Similar to GetValue but returns a wstring (empty string if the property
+ // does not exist).
+ std::wstring GetStringValue(const wchar_t* name);
+
+ // Get the fixed file info if it exists. Otherwise NULL
+ VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; }
+
+ private:
+ scoped_ptr_malloc<char> data_;
+ int language_;
+ int code_page_;
+ // This is a pointer into the data_ if it exists. Otherwise NULL.
+ VS_FIXEDFILEINFO* fixed_file_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin);
+};
+
+#endif // BASE_FILE_VERSION_INFO_WIN_H_
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/base/file_version_info_linux.h.version b/chrome/app/chrome_version_info_posix.h.version
index 88bf234..01295f2 100644
--- a/base/file_version_info_linux.h.version
+++ b/chrome/app/chrome_version_info_posix.h.version
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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 BASE_FILE_VERSION_INFO_LINUX_H_
-#define BASE_FILE_VERSION_INFO_LINUX_H_
+#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@"
@@ -23,4 +23,4 @@
#define COMMENTS L""
#define LEGAL_TRADEMARKS L""
-#endif // BASE_FILE_VERSION_INFO_LINUX_H_
+#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: ";
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index 9a53fe9..9d62c56 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -705,6 +705,7 @@
'chrome_frame_utils',
'chrome_launcher',
'xulrunner_sdk',
+ '../chrome/chrome.gyp:chrome_version_info',
'../chrome/chrome.gyp:common',
'../chrome/chrome.gyp:utility',
'../build/temp_gyp/googleurl.gyp:googleurl',
diff --git a/chrome_frame/test/util_unittests.cc b/chrome_frame/test/util_unittests.cc
index c589416..8780d3d 100644
--- a/chrome_frame/test/util_unittests.cc
+++ b/chrome_frame/test/util_unittests.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/file_version_info.h"
+#include "base/file_version_info_win.h"
#include "chrome_frame/utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,7 +28,9 @@ TEST(UtilTests, GetModuleVersionTest) {
EXPECT_NE(low, 0);
// Make sure they give the same results.
- VS_FIXEDFILEINFO* fixed_info = base_info->fixed_file_info();
+ FileVersionInfoWin* base_info_win =
+ static_cast<FileVersionInfoWin*>(base_info.get());
+ VS_FIXEDFILEINFO* fixed_info = base_info_win->fixed_file_info();
EXPECT_TRUE(fixed_info != NULL);
EXPECT_EQ(fixed_info->dwFileVersionMS, static_cast<DWORD>(high));
diff --git a/webkit/glue/plugins/plugin_lib_win.cc b/webkit/glue/plugins/plugin_lib_win.cc
index 94f1517..00f6243 100644
--- a/webkit/glue/plugins/plugin_lib_win.cc
+++ b/webkit/glue/plugins/plugin_lib_win.cc
@@ -5,6 +5,7 @@
#include "webkit/glue/plugins/plugin_lib.h"
#include "base/file_version_info.h"
+#include "base/file_version_info_win.h"
#include "base/path_service.h"
#include "webkit/glue/plugins/plugin_constants_win.h"
#include "webkit/glue/plugins/plugin_list.h"
@@ -23,10 +24,12 @@ bool PluginLib::ReadWebPluginInfo(const FilePath &filename,
if (!version_info.get())
return false;
+ FileVersionInfoWin* version_info_win =
+ static_cast<FileVersionInfoWin*>(version_info.get());
PluginVersionInfo pvi;
- pvi.mime_types = version_info->GetStringValue(L"MIMEType");
- pvi.file_extensions = version_info->GetStringValue(L"FileExtents");
- pvi.type_descriptions = version_info->GetStringValue(L"FileOpenName");
+ pvi.mime_types = version_info_win->GetStringValue(L"MIMEType");
+ pvi.file_extensions = version_info_win->GetStringValue(L"FileExtents");
+ pvi.type_descriptions = version_info_win->GetStringValue(L"FileOpenName");
pvi.product_name = version_info->product_name();
pvi.file_description = version_info->file_description();
pvi.file_version = version_info->file_version();
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index c3426a6c..f36a0e2 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -11,8 +11,8 @@
#include <sys/utsname.h>
#endif
-#include "base/file_version_info.h"
#include "base/logging.h"
+#include "base/scoped_ptr.h"
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
@@ -418,20 +418,8 @@ void BuildUserAgent(bool mimic_chrome1, bool mimic_windows,
// Get the product name and version, and replace Safari's Version/X string
// with it. This is done to expose our product name in a manner that is
// maximally compatible with Safari, we hope!!
- std::string product;
-
- if (mimic_chrome1) {
- product = kChrome1ProductString;
- } else {
- scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfoForCurrentModule());
- if (version_info.get()) {
- product = "Chrome/" + WideToASCII(version_info->product_version());
- } else {
- DLOG(WARNING) << "Unknown product version";
- product = "Chrome/0.0.0.0";
- }
- }
+ std::string product = mimic_chrome1 ? kChrome1ProductString
+ : GetProductVersion();
// Derived from Safari's UA string.
StringAppendF(
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 48efd0c..73293e3 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -301,7 +301,6 @@
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'dependencies': [
'<(DEPTH)/build/linux/system.gyp:gtk',
- '<(DEPTH)/base/base.gyp:linux_versioninfo',
],
'sources!': [
'plugins/plugin_stubs.cc',
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index afdceda..f8095d9 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -242,6 +242,9 @@ void CloseCurrentConnections();
// Enable or disable the disk cache. Used for debugging.
void SetCacheMode(bool enabled);
+// Returns the product version. E.g., Chrome/4.1.333.0
+std::string GetProductVersion();
+
// ---- END FUNCTIONS IMPLEMENTED BY EMBEDDER ---------------------------------
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index ba3a2c2..d529ba7 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -801,4 +801,8 @@ void SetCacheMode(bool enabled) {
// Used in benchmarking, Ignored for test_shell.
}
+std::string GetProductVersion() {
+ return std::string("Chrome/0.0.0.0");
+}
+
} // namespace webkit_glue