diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 23:02:11 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 23:02:11 +0000 |
commit | 1eeb5e08580730cb2a0a2751f578dbc4e6402369 (patch) | |
tree | 8c630e2df02da8815f0ae5984bb708e8186af400 /chrome/common | |
parent | 4b783b4849481423eea0c1a99eb56f1b218ec4ba (diff) | |
download | chromium_src-1eeb5e08580730cb2a0a2751f578dbc4e6402369.zip chromium_src-1eeb5e08580730cb2a0a2751f578dbc4e6402369.tar.gz chromium_src-1eeb5e08580730cb2a0a2751f578dbc4e6402369.tar.bz2 |
Cleanup: Break another common->app dependency.
BUG=46666
TEST=none
Review URL: http://codereview.chromium.org/3007008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/chrome_version_info.cc | 52 | ||||
-rw-r--r-- | chrome/common/chrome_version_info.h | 18 | ||||
-rw-r--r-- | chrome/common/chrome_version_info_posix.h.version | 26 | ||||
-rw-r--r-- | chrome/common/extensions/extension.cc | 4 |
4 files changed, 98 insertions, 2 deletions
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc new file mode 100644 index 0000000..1b1d479 --- /dev/null +++ b/chrome/common/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/common/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/common/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 { + +FileVersionInfo* GetChromeVersionInfo() { +#if defined(OS_WIN) || defined(OS_MACOSX) + return FileVersionInfo::CreateFileVersionInfoForCurrentModule(); +#elif defined(OS_POSIX) + return new ChromeVersionInfoPosix(); +#endif +} + +} // namespace chrome diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h new file mode 100644 index 0000000..e3bfad71 --- /dev/null +++ b/chrome/common/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_COMMON_CHROME_VERSION_INFO_H_ +#define CHROME_COMMON_CHROME_VERSION_INFO_H_ + +class FileVersionInfo; + +namespace chrome { + +// 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(); + +} // namespace chrome + +#endif // CHROME_COMMON_CHROME_VERSION_INFO_H_ diff --git a/chrome/common/chrome_version_info_posix.h.version b/chrome/common/chrome_version_info_posix.h.version new file mode 100644 index 0000000..56a8fea --- /dev/null +++ b/chrome/common/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_COMMON_CHROME_VERSION_INFO_POSIX_H_ +#define CHROME_COMMON_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_COMMON_CHROME_VERSION_INFO_POSIX_H_ diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 10d69a0..a4ade47 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -20,9 +20,9 @@ #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/chrome_version_info.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_error_utils.h" @@ -1040,7 +1040,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, } scoped_ptr<FileVersionInfo> current_version_info( - chrome_app::GetChromeVersionInfo()); + chrome::GetChromeVersionInfo()); if (!current_version_info.get()) { DCHECK(false); return false; |