OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_version_info_win.h" | 5 #include "base/file_version_info_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (query_result && translate) { | 74 if (query_result && translate) { |
75 return new FileVersionInfoWin(data, translate->language, | 75 return new FileVersionInfoWin(data, translate->language, |
76 translate->code_page); | 76 translate->code_page); |
77 | 77 |
78 } else { | 78 } else { |
79 free(data); | 79 free(data); |
80 return NULL; | 80 return NULL; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 string16 FileVersionInfoWin::company_name() { | 84 base::string16 FileVersionInfoWin::company_name() { |
85 return GetStringValue(L"CompanyName"); | 85 return GetStringValue(L"CompanyName"); |
86 } | 86 } |
87 | 87 |
88 string16 FileVersionInfoWin::company_short_name() { | 88 base::string16 FileVersionInfoWin::company_short_name() { |
89 return GetStringValue(L"CompanyShortName"); | 89 return GetStringValue(L"CompanyShortName"); |
90 } | 90 } |
91 | 91 |
92 string16 FileVersionInfoWin::internal_name() { | 92 base::string16 FileVersionInfoWin::internal_name() { |
93 return GetStringValue(L"InternalName"); | 93 return GetStringValue(L"InternalName"); |
94 } | 94 } |
95 | 95 |
96 string16 FileVersionInfoWin::product_name() { | 96 base::string16 FileVersionInfoWin::product_name() { |
97 return GetStringValue(L"ProductName"); | 97 return GetStringValue(L"ProductName"); |
98 } | 98 } |
99 | 99 |
100 string16 FileVersionInfoWin::product_short_name() { | 100 base::string16 FileVersionInfoWin::product_short_name() { |
101 return GetStringValue(L"ProductShortName"); | 101 return GetStringValue(L"ProductShortName"); |
102 } | 102 } |
103 | 103 |
104 string16 FileVersionInfoWin::comments() { | 104 base::string16 FileVersionInfoWin::comments() { |
105 return GetStringValue(L"Comments"); | 105 return GetStringValue(L"Comments"); |
106 } | 106 } |
107 | 107 |
108 string16 FileVersionInfoWin::legal_copyright() { | 108 base::string16 FileVersionInfoWin::legal_copyright() { |
109 return GetStringValue(L"LegalCopyright"); | 109 return GetStringValue(L"LegalCopyright"); |
110 } | 110 } |
111 | 111 |
112 string16 FileVersionInfoWin::product_version() { | 112 base::string16 FileVersionInfoWin::product_version() { |
113 return GetStringValue(L"ProductVersion"); | 113 return GetStringValue(L"ProductVersion"); |
114 } | 114 } |
115 | 115 |
116 string16 FileVersionInfoWin::file_description() { | 116 base::string16 FileVersionInfoWin::file_description() { |
117 return GetStringValue(L"FileDescription"); | 117 return GetStringValue(L"FileDescription"); |
118 } | 118 } |
119 | 119 |
120 string16 FileVersionInfoWin::legal_trademarks() { | 120 base::string16 FileVersionInfoWin::legal_trademarks() { |
121 return GetStringValue(L"LegalTrademarks"); | 121 return GetStringValue(L"LegalTrademarks"); |
122 } | 122 } |
123 | 123 |
124 string16 FileVersionInfoWin::private_build() { | 124 base::string16 FileVersionInfoWin::private_build() { |
125 return GetStringValue(L"PrivateBuild"); | 125 return GetStringValue(L"PrivateBuild"); |
126 } | 126 } |
127 | 127 |
128 string16 FileVersionInfoWin::file_version() { | 128 base::string16 FileVersionInfoWin::file_version() { |
129 return GetStringValue(L"FileVersion"); | 129 return GetStringValue(L"FileVersion"); |
130 } | 130 } |
131 | 131 |
132 string16 FileVersionInfoWin::original_filename() { | 132 base::string16 FileVersionInfoWin::original_filename() { |
133 return GetStringValue(L"OriginalFilename"); | 133 return GetStringValue(L"OriginalFilename"); |
134 } | 134 } |
135 | 135 |
136 string16 FileVersionInfoWin::special_build() { | 136 base::string16 FileVersionInfoWin::special_build() { |
137 return GetStringValue(L"SpecialBuild"); | 137 return GetStringValue(L"SpecialBuild"); |
138 } | 138 } |
139 | 139 |
140 string16 FileVersionInfoWin::last_change() { | 140 base::string16 FileVersionInfoWin::last_change() { |
141 return GetStringValue(L"LastChange"); | 141 return GetStringValue(L"LastChange"); |
142 } | 142 } |
143 | 143 |
144 bool FileVersionInfoWin::is_official_build() { | 144 bool FileVersionInfoWin::is_official_build() { |
145 return (GetStringValue(L"Official Build").compare(L"1") == 0); | 145 return (GetStringValue(L"Official Build").compare(L"1") == 0); |
146 } | 146 } |
147 | 147 |
148 bool FileVersionInfoWin::GetValue(const wchar_t* name, | 148 bool FileVersionInfoWin::GetValue(const wchar_t* name, |
149 std::wstring* value_str) { | 149 std::wstring* value_str) { |
150 WORD lang_codepage[8]; | 150 WORD lang_codepage[8]; |
(...skipping 29 matching lines...) Expand all Loading... |
180 return false; | 180 return false; |
181 } | 181 } |
182 | 182 |
183 std::wstring FileVersionInfoWin::GetStringValue(const wchar_t* name) { | 183 std::wstring FileVersionInfoWin::GetStringValue(const wchar_t* name) { |
184 std::wstring str; | 184 std::wstring str; |
185 if (GetValue(name, &str)) | 185 if (GetValue(name, &str)) |
186 return str; | 186 return str; |
187 else | 187 else |
188 return L""; | 188 return L""; |
189 } | 189 } |
OLD | NEW |