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 "chrome/browser/enumerate_modules_model_win.h" | 5 #include "chrome/browser/enumerate_modules_model_win.h" |
6 | 6 |
7 #include <Tlhelp32.h> | 7 #include <Tlhelp32.h> |
8 #include <wintrust.h> | 8 #include <wintrust.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/environment.h" | 11 #include "base/environment.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_version_info_win.h" | 13 #include "base/file_version_info_win.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/sha2.h" | |
16 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
18 #include "base/time.h" | 17 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
20 #include "base/values.h" | 19 #include "base/values.h" |
21 #include "base/version.h" | 20 #include "base/version.h" |
22 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
23 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
| 23 #include "crypto/sha2.h" |
24 #include "chrome/browser/net/service_providers_win.h" | 24 #include "chrome/browser/net/service_providers_win.h" |
25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "content/common/notification_service.h" | 27 #include "content/common/notification_service.h" |
28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
31 // The period of time (in milliseconds) to wait until checking to see if any | 31 // The period of time (in milliseconds) to wait until checking to see if any |
32 // incompatible modules exist. | 32 // incompatible modules exist. |
33 static const int kModuleCheckDelayMs = 60 * 1000; | 33 static const int kModuleCheckDelayMs = 60 * 1000; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 }; | 218 }; |
219 | 219 |
220 // Generates an 8 digit hash from the input given. | 220 // Generates an 8 digit hash from the input given. |
221 static void GenerateHash(const std::string& input, std::string* output) { | 221 static void GenerateHash(const std::string& input, std::string* output) { |
222 if (input.empty()) { | 222 if (input.empty()) { |
223 *output = ""; | 223 *output = ""; |
224 return; | 224 return; |
225 } | 225 } |
226 | 226 |
227 uint8 hash[4]; | 227 uint8 hash[4]; |
228 base::SHA256HashString(input, hash, sizeof(hash)); | 228 crypto::SHA256HashString(input, hash, sizeof(hash)); |
229 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); | 229 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); |
230 } | 230 } |
231 | 231 |
232 // ----------------------------------------------------------------------------- | 232 // ----------------------------------------------------------------------------- |
233 | 233 |
234 // static | 234 // static |
235 void ModuleEnumerator::NormalizeModule(Module* module) { | 235 void ModuleEnumerator::NormalizeModule(Module* module) { |
236 string16 path = module->location; | 236 string16 path = module->location; |
237 if (!ConvertToLongPath(path, &module->location)) | 237 if (!ConvertToLongPath(path, &module->location)) |
238 module->location = path; | 238 module->location = path; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 GenerateHash(WideToUTF8(module.name), &filename); | 894 GenerateHash(WideToUTF8(module.name), &filename); |
895 GenerateHash(WideToUTF8(module.location), &location); | 895 GenerateHash(WideToUTF8(module.location), &location); |
896 GenerateHash(WideToUTF8(module.description), &description); | 896 GenerateHash(WideToUTF8(module.description), &description); |
897 GenerateHash(WideToUTF8(module.digital_signer), &signer); | 897 GenerateHash(WideToUTF8(module.digital_signer), &signer); |
898 | 898 |
899 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 899 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
900 ASCIIToUTF16(filename), ASCIIToUTF16(location), | 900 ASCIIToUTF16(filename), ASCIIToUTF16(location), |
901 ASCIIToUTF16(description), ASCIIToUTF16(signer)); | 901 ASCIIToUTF16(description), ASCIIToUTF16(signer)); |
902 return GURL(UTF16ToUTF8(url)); | 902 return GURL(UTF16ToUTF8(url)); |
903 } | 903 } |
OLD | NEW |