summaryrefslogtreecommitdiffstats
path: root/base/file_version_info.h
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 /base/file_version_info.h
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 'base/file_version_info.h')
-rw-r--r--base/file_version_info.h83
1 files changed, 20 insertions, 63 deletions
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__