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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 }; | 255 }; |
256 | 256 |
257 // Generates an 8 digit hash from the input given. | 257 // Generates an 8 digit hash from the input given. |
258 static void GenerateHash(const std::string& input, std::string* output) { | 258 static void GenerateHash(const std::string& input, std::string* output) { |
259 if (input.empty()) { | 259 if (input.empty()) { |
260 *output = ""; | 260 *output = ""; |
261 return; | 261 return; |
262 } | 262 } |
263 | 263 |
264 uint8 hash[4]; | 264 uint8 hash[4]; |
265 base::SHA256HashString(input, hash, sizeof(hash)); | 265 crypto::SHA256HashString(input, hash, sizeof(hash)); |
266 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); | 266 *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); |
267 } | 267 } |
268 | 268 |
269 // ----------------------------------------------------------------------------- | 269 // ----------------------------------------------------------------------------- |
270 | 270 |
271 // static | 271 // static |
272 void ModuleEnumerator::NormalizeModule(Module* module) { | 272 void ModuleEnumerator::NormalizeModule(Module* module) { |
273 string16 path = module->location; | 273 string16 path = module->location; |
274 if (!ConvertToLongPath(path, &module->location)) | 274 if (!ConvertToLongPath(path, &module->location)) |
275 module->location = path; | 275 module->location = path; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 GenerateHash(WideToUTF8(module.name), &filename); | 951 GenerateHash(WideToUTF8(module.name), &filename); |
952 GenerateHash(WideToUTF8(module.location), &location); | 952 GenerateHash(WideToUTF8(module.location), &location); |
953 GenerateHash(WideToUTF8(module.description), &description); | 953 GenerateHash(WideToUTF8(module.description), &description); |
954 GenerateHash(WideToUTF8(module.digital_signer), &signer); | 954 GenerateHash(WideToUTF8(module.digital_signer), &signer); |
955 | 955 |
956 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 956 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
957 ASCIIToUTF16(filename), ASCIIToUTF16(location), | 957 ASCIIToUTF16(filename), ASCIIToUTF16(location), |
958 ASCIIToUTF16(description), ASCIIToUTF16(signer)); | 958 ASCIIToUTF16(description), ASCIIToUTF16(signer)); |
959 return GURL(UTF16ToUTF8(url)); | 959 return GURL(UTF16ToUTF8(url)); |
960 } | 960 } |
OLD | NEW |