[email protected] | bcff05a | 2010-04-14 01:46:43 | [diff] [blame] | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BASE_FILE_VERSION_INFO_WIN_H_ |
| 6 | #define BASE_FILE_VERSION_INFO_WIN_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame^] | 7 | #pragma once |
[email protected] | bcff05a | 2010-04-14 01:46:43 | [diff] [blame] | 8 | |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/basictypes.h" |
| 12 | #include "base/file_version_info.h" |
| 13 | #include "base/scoped_ptr.h" |
| 14 | |
| 15 | struct tagVS_FIXEDFILEINFO; |
| 16 | typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO; |
| 17 | |
| 18 | class FilePath; |
| 19 | |
| 20 | // Provides a way to access the version information for a file. |
| 21 | // This is the information you access when you select a file in the Windows |
| 22 | // explorer, right-click select Properties, then click the Version tab. |
| 23 | |
| 24 | class FileVersionInfoWin : public FileVersionInfo { |
| 25 | public: |
| 26 | FileVersionInfoWin(void* data, int language, int code_page); |
| 27 | ~FileVersionInfoWin(); |
| 28 | |
| 29 | // Accessors to the different version properties. |
| 30 | // Returns an empty string if the property is not found. |
| 31 | virtual std::wstring company_name(); |
| 32 | virtual std::wstring company_short_name(); |
| 33 | virtual std::wstring product_name(); |
| 34 | virtual std::wstring product_short_name(); |
| 35 | virtual std::wstring internal_name(); |
| 36 | virtual std::wstring product_version(); |
| 37 | virtual std::wstring private_build(); |
| 38 | virtual std::wstring special_build(); |
| 39 | virtual std::wstring comments(); |
| 40 | virtual std::wstring original_filename(); |
| 41 | virtual std::wstring file_description(); |
| 42 | virtual std::wstring file_version(); |
| 43 | virtual std::wstring legal_copyright(); |
| 44 | virtual std::wstring legal_trademarks(); |
| 45 | virtual std::wstring last_change(); |
| 46 | virtual bool is_official_build(); |
| 47 | |
| 48 | // Lets you access other properties not covered above. |
| 49 | bool GetValue(const wchar_t* name, std::wstring* value); |
| 50 | |
| 51 | // Similar to GetValue but returns a wstring (empty string if the property |
| 52 | // does not exist). |
| 53 | std::wstring GetStringValue(const wchar_t* name); |
| 54 | |
| 55 | // Get the fixed file info if it exists. Otherwise NULL |
| 56 | VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; } |
| 57 | |
| 58 | private: |
| 59 | scoped_ptr_malloc<char> data_; |
| 60 | int language_; |
| 61 | int code_page_; |
| 62 | // This is a pointer into the data_ if it exists. Otherwise NULL. |
| 63 | VS_FIXEDFILEINFO* fixed_file_info_; |
| 64 | |
| 65 | DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin); |
| 66 | }; |
| 67 | |
| 68 | #endif // BASE_FILE_VERSION_INFO_WIN_H_ |