[email protected] | 90509cb | 2011-03-25 18:46:38 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 4 | |
tfarina | a3116351 | 2015-05-13 22:10:15 | [diff] [blame] | 5 | #ifndef BASE_FILE_VERSION_INFO_H_ |
6 | #define BASE_FILE_VERSION_INFO_H_ | ||||
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 7 | |
David Benjamin | 04cc2b4 | 2019-01-29 05:30:33 | [diff] [blame] | 8 | #include <memory> |
thakis | d62f5447 | 2016-04-04 02:21:10 | [diff] [blame] | 9 | #include <string> |
10 | |||||
[email protected] | 70910be | 2011-04-22 23:55:45 | [diff] [blame] | 11 | #include "build/build_config.h" |
thakis | d62f5447 | 2016-04-04 02:21:10 | [diff] [blame] | 12 | #include "base/base_export.h" |
13 | #include "base/strings/string16.h" | ||||
[email protected] | 70910be | 2011-04-22 23:55:45 | [diff] [blame] | 14 | |
15 | #if defined(OS_WIN) | ||||
16 | #include <windows.h> | ||||
thakis | d62f5447 | 2016-04-04 02:21:10 | [diff] [blame] | 17 | #endif |
[email protected] | 72c93c70 | 2008-08-05 20:00:26 | [diff] [blame] | 18 | |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 19 | namespace base { |
[email protected] | f539333 | 2009-06-03 15:01:29 | [diff] [blame] | 20 | class FilePath; |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 21 | } |
[email protected] | f539333 | 2009-06-03 15:01:29 | [diff] [blame] | 22 | |
[email protected] | 4f260d0 | 2010-12-23 18:35:42 | [diff] [blame] | 23 | // Provides an interface for accessing the version information for a file. This |
24 | // is the information you access when you select a file in the Windows Explorer, | ||||
25 | // right-click select Properties, then click the Version tab, and on the Mac | ||||
26 | // when you select a file in the Finder and do a Get Info. | ||||
27 | // | ||||
28 | // This list of properties is straight out of Win32's VerQueryValue | ||||
29 | // <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac | ||||
30 | // version returns values from the Info.plist as appropriate. TODO(avi): make | ||||
31 | // this a less-obvious Windows-ism. | ||||
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 32 | |
mgiuca | 8137fc2 | 2015-05-07 02:20:31 | [diff] [blame] | 33 | class BASE_EXPORT FileVersionInfo { |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 34 | public: |
[email protected] | e462cf5 | 2010-05-21 23:00:17 | [diff] [blame] | 35 | virtual ~FileVersionInfo() {} |
[email protected] | bcff05a | 2010-04-14 01:46:43 | [diff] [blame] | 36 | #if defined(OS_WIN) || defined(OS_MACOSX) |
David Benjamin | 04cc2b4 | 2019-01-29 05:30:33 | [diff] [blame] | 37 | // Creates a FileVersionInfo for the specified path. Returns nullptr if |
38 | // something goes wrong (typically the file does not exit or cannot be | ||||
39 | // opened). | ||||
40 | static std::unique_ptr<FileVersionInfo> CreateFileVersionInfo( | ||||
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 41 | const base::FilePath& file_path); |
[email protected] | 7c1e303 | 2010-12-20 18:40:42 | [diff] [blame] | 42 | #endif // OS_WIN || OS_MACOSX |
43 | |||||
[email protected] | 70910be | 2011-04-22 23:55:45 | [diff] [blame] | 44 | #if defined(OS_WIN) |
David Benjamin | 04cc2b4 | 2019-01-29 05:30:33 | [diff] [blame] | 45 | // Creates a FileVersionInfo for the specified module. Returns nullptr in |
46 | // case of error. | ||||
47 | static std::unique_ptr<FileVersionInfo> CreateFileVersionInfoForModule( | ||||
48 | HMODULE module); | ||||
[email protected] | 70910be | 2011-04-22 23:55:45 | [diff] [blame] | 49 | #else |
David Benjamin | 04cc2b4 | 2019-01-29 05:30:33 | [diff] [blame] | 50 | // Creates a FileVersionInfo for the current module. Returns nullptr in case |
51 | // of error. | ||||
52 | static std::unique_ptr<FileVersionInfo> | ||||
53 | CreateFileVersionInfoForCurrentModule(); | ||||
[email protected] | 70910be | 2011-04-22 23:55:45 | [diff] [blame] | 54 | #endif // OS_WIN |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 55 | |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 56 | // Accessors to the different version properties. |
57 | // Returns an empty string if the property is not found. | ||||
[email protected] | 476dafb | 2013-12-03 00:39:26 | [diff] [blame] | 58 | virtual base::string16 company_name() = 0; |
59 | virtual base::string16 company_short_name() = 0; | ||||
60 | virtual base::string16 product_name() = 0; | ||||
61 | virtual base::string16 product_short_name() = 0; | ||||
62 | virtual base::string16 internal_name() = 0; | ||||
63 | virtual base::string16 product_version() = 0; | ||||
64 | virtual base::string16 private_build() = 0; | ||||
65 | virtual base::string16 special_build() = 0; | ||||
66 | virtual base::string16 comments() = 0; | ||||
67 | virtual base::string16 original_filename() = 0; | ||||
68 | virtual base::string16 file_description() = 0; | ||||
69 | virtual base::string16 file_version() = 0; | ||||
70 | virtual base::string16 legal_copyright() = 0; | ||||
71 | virtual base::string16 legal_trademarks() = 0; | ||||
72 | virtual base::string16 last_change() = 0; | ||||
[email protected] | bcff05a | 2010-04-14 01:46:43 | [diff] [blame] | 73 | virtual bool is_official_build() = 0; |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 74 | }; |
75 | |||||
tfarina | a3116351 | 2015-05-13 22:10:15 | [diff] [blame] | 76 | #endif // BASE_FILE_VERSION_INFO_H_ |