Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2975)

Unified Diff: base/file_version_info.h

Issue 1560027: Refactor FileVersionInfo into an interface with platform implementations. (Closed)
Patch Set: comments Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | base/file_version_info_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_version_info.h
diff --git a/base/file_version_info.h b/base/file_version_info.h
index 561c324431ba6908c27e29f0e7c4982853a5f51a..def2ea5a84c3881a20d010c6bf869f586a3458af 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__
« no previous file with comments | « base/base.gypi ('k') | base/file_version_info_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698