diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 01:46:43 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 01:46:43 +0000 |
commit | bcff05af3d60df10a21e07751a14b95ce9e7f3d4 (patch) | |
tree | 76d8d3ec6c6c0d9564c675d423907e29607bf253 /chrome/app | |
parent | 474b2ab8c3b32c07692480aa234f3b2921fe5dd6 (diff) | |
download | chromium_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/app')
-rw-r--r-- | chrome/app/chrome_version_info.cc | 52 | ||||
-rw-r--r-- | chrome/app/chrome_version_info.h | 18 | ||||
-rw-r--r-- | chrome/app/chrome_version_info_posix.h.version | 26 |
3 files changed, 96 insertions, 0 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_ |