1 // Copyright (c) 2011 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.
5 #ifndef BASE_FILE_VERSION_INFO_H_
6 #define BASE_FILE_VERSION_INFO_H_
11 #include "build/build_config.h"
12 #include "base/base_export.h"
13 #include "base/strings/string16.h"
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.
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.
33 class BASE_EXPORT FileVersionInfo {
35 virtual ~FileVersionInfo() {}
36 #if defined(OS_WIN) || defined(OS_MACOSX)
37 // Creates a FileVersionInfo for the specified path. Returns nullptr if
38 // something goes wrong (typically the file does not exit or cannot be
40 static std::unique_ptr<FileVersionInfo> CreateFileVersionInfo(
41 const base::FilePath& file_path);
42 #endif // OS_WIN || OS_MACOSX
45 // Creates a FileVersionInfo for the specified module. Returns nullptr in
47 static std::unique_ptr<FileVersionInfo> CreateFileVersionInfoForModule(
50 // Creates a FileVersionInfo for the current module. Returns nullptr in case
52 static std::unique_ptr<FileVersionInfo>
53 CreateFileVersionInfoForCurrentModule();
56 // Accessors to the different version properties.
57 // Returns an empty string if the property is not found.
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 special_build() = 0;
65 virtual base::string16 original_filename() = 0;
66 virtual base::string16 file_description() = 0;
67 virtual base::string16 file_version() = 0;
70 #endif // BASE_FILE_VERSION_INFO_H_