blob: a8343f71714c1cf53ffb64e61d7f9807868793ee [file] [log] [blame]
[email protected]90509cb2011-03-25 18:46:381// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commitd7cae122008-07-26 21:49:384
tfarinaa31163512015-05-13 22:10:155#ifndef BASE_FILE_VERSION_INFO_H_
6#define BASE_FILE_VERSION_INFO_H_
initial.commitd7cae122008-07-26 21:49:387
David Benjamin04cc2b42019-01-29 05:30:338#include <memory>
thakisd62f54472016-04-04 02:21:109#include <string>
10
[email protected]70910be2011-04-22 23:55:4511#include "build/build_config.h"
thakisd62f54472016-04-04 02:21:1012#include "base/base_export.h"
13#include "base/strings/string16.h"
[email protected]70910be2011-04-22 23:55:4514
15#if defined(OS_WIN)
16#include <windows.h>
thakisd62f54472016-04-04 02:21:1017#endif
[email protected]72c93c702008-08-05 20:00:2618
[email protected]a3ef4832013-02-02 05:12:3319namespace base {
[email protected]f5393332009-06-03 15:01:2920class FilePath;
[email protected]a3ef4832013-02-02 05:12:3321}
[email protected]f5393332009-06-03 15:01:2922
[email protected]4f260d02010-12-23 18:35:4223// 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.commitd7cae122008-07-26 21:49:3832
mgiuca8137fc22015-05-07 02:20:3133class BASE_EXPORT FileVersionInfo {
initial.commitd7cae122008-07-26 21:49:3834 public:
[email protected]e462cf52010-05-21 23:00:1735 virtual ~FileVersionInfo() {}
[email protected]bcff05a2010-04-14 01:46:4336#if defined(OS_WIN) || defined(OS_MACOSX)
David Benjamin04cc2b42019-01-29 05:30:3337 // 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]a3ef4832013-02-02 05:12:3341 const base::FilePath& file_path);
[email protected]7c1e3032010-12-20 18:40:4242#endif // OS_WIN || OS_MACOSX
43
[email protected]70910be2011-04-22 23:55:4544#if defined(OS_WIN)
David Benjamin04cc2b42019-01-29 05:30:3345 // 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]70910be2011-04-22 23:55:4549#else
David Benjamin04cc2b42019-01-29 05:30:3350 // Creates a FileVersionInfo for the current module. Returns nullptr in case
51 // of error.
52 static std::unique_ptr<FileVersionInfo>
53 CreateFileVersionInfoForCurrentModule();
[email protected]70910be2011-04-22 23:55:4554#endif // OS_WIN
initial.commitd7cae122008-07-26 21:49:3855
initial.commitd7cae122008-07-26 21:49:3856 // Accessors to the different version properties.
57 // Returns an empty string if the property is not found.
[email protected]476dafb2013-12-03 00:39:2658 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]bcff05a2010-04-14 01:46:4373 virtual bool is_official_build() = 0;
initial.commitd7cae122008-07-26 21:49:3874};
75
tfarinaa31163512015-05-13 22:10:1576#endif // BASE_FILE_VERSION_INFO_H_