[M108 Migration][VD] Support set time and time zone offset
[platform/framework/web/chromium-efl.git] / base / file_version_info_win.h
1 // Copyright 2011 The Chromium Authors
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_
7
8 #include <windows.h>
9
10 #include <stdint.h>
11
12 #include <memory>
13 #include <string>
14 #include <vector>
15
16 #include "base/base_export.h"
17 #include "base/file_version_info.h"
18 #include "base/memory/raw_ptr.h"
19 #include "base/version.h"
20
21 struct tagVS_FIXEDFILEINFO;
22 typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
23
24 class BASE_EXPORT FileVersionInfoWin : public FileVersionInfo {
25  public:
26   FileVersionInfoWin(const FileVersionInfoWin&) = delete;
27   FileVersionInfoWin& operator=(const FileVersionInfoWin&) = delete;
28   ~FileVersionInfoWin() override;
29
30   // Accessors to the different version properties.
31   // Returns an empty string if the property is not found.
32   std::u16string company_name() override;
33   std::u16string company_short_name() override;
34   std::u16string product_name() override;
35   std::u16string product_short_name() override;
36   std::u16string internal_name() override;
37   std::u16string product_version() override;
38   std::u16string special_build() override;
39   std::u16string original_filename() override;
40   std::u16string file_description() override;
41   std::u16string file_version() override;
42
43   // Lets you access other properties not covered above. |value| is only
44   // modified if GetValue() returns true.
45   bool GetValue(const char16_t* name, std::u16string* value) const;
46
47   // Similar to GetValue but returns a std::u16string (empty string if the
48   // property does not exist).
49   std::u16string GetStringValue(const char16_t* name) const;
50
51   // Get file version number in dotted version format.
52   base::Version GetFileVersion() const;
53
54   // Behaves like CreateFileVersionInfo, but returns a FileVersionInfoWin.
55   static std::unique_ptr<FileVersionInfoWin> CreateFileVersionInfoWin(
56       const base::FilePath& file_path);
57
58  private:
59   friend FileVersionInfo;
60
61   // |data| is a VS_VERSION_INFO resource. |language| and |code_page| are
62   // extracted from the \VarFileInfo\Translation value of |data|.
63   FileVersionInfoWin(std::vector<uint8_t>&& data,
64                      WORD language,
65                      WORD code_page);
66   FileVersionInfoWin(void* data, WORD language, WORD code_page);
67
68   const std::vector<uint8_t> owned_data_;
69   const raw_ptr<const void> data_;
70   const WORD language_;
71   const WORD code_page_;
72
73   // This is a reference for a portion of |data_|.
74   const VS_FIXEDFILEINFO& fixed_file_info_;
75 };
76
77 #endif  // BASE_FILE_VERSION_INFO_WIN_H_