OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 std::string filename_hash, location_hash; | 377 std::string filename_hash, location_hash; |
378 GenerateHash(base::WideToUTF8(module.name), &filename_hash); | 378 GenerateHash(base::WideToUTF8(module.name), &filename_hash); |
379 GenerateHash(base::WideToUTF8(module.location), &location_hash); | 379 GenerateHash(base::WideToUTF8(module.location), &location_hash); |
380 | 380 |
381 // Filenames are mandatory. Location is mandatory if given. | 381 // Filenames are mandatory. Location is mandatory if given. |
382 if (filename_hash == blacklisted.filename && | 382 if (filename_hash == blacklisted.filename && |
383 (std::string(blacklisted.location).empty() || | 383 (std::string(blacklisted.location).empty() || |
384 location_hash == blacklisted.location)) { | 384 location_hash == blacklisted.location)) { |
385 // We have a name match against the blacklist (and possibly location match | 385 // We have a name match against the blacklist (and possibly location match |
386 // also), so check version. | 386 // also), so check version. |
387 base::Version module_version(UTF16ToASCII(module.version)); | 387 Version module_version(UTF16ToASCII(module.version)); |
388 base::Version version_min(blacklisted.version_from); | 388 Version version_min(blacklisted.version_from); |
389 base::Version version_max(blacklisted.version_to); | 389 Version version_max(blacklisted.version_to); |
390 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); | 390 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); |
391 if (!version_ok) { | 391 if (!version_ok) { |
392 bool too_low = version_min.IsValid() && | 392 bool too_low = version_min.IsValid() && |
393 (!module_version.IsValid() || | 393 (!module_version.IsValid() || |
394 module_version.CompareTo(version_min) < 0); | 394 module_version.CompareTo(version_min) < 0); |
395 bool too_high = version_max.IsValid() && | 395 bool too_high = version_max.IsValid() && |
396 (!module_version.IsValid() || | 396 (!module_version.IsValid() || |
397 module_version.CompareTo(version_max) >= 0); | 397 module_version.CompareTo(version_max) >= 0); |
398 version_ok = !too_low && !too_high; | 398 version_ok = !too_low && !too_high; |
399 } | 399 } |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 GenerateHash(base::WideToUTF8(module.location), &location); | 1063 GenerateHash(base::WideToUTF8(module.location), &location); |
1064 GenerateHash(base::WideToUTF8(module.description), &description); | 1064 GenerateHash(base::WideToUTF8(module.description), &description); |
1065 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1065 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
1066 | 1066 |
1067 base::string16 url = | 1067 base::string16 url = |
1068 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1068 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
1069 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1069 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
1070 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1070 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
1071 return GURL(base::UTF16ToUTF8(url)); | 1071 return GURL(base::UTF16ToUTF8(url)); |
1072 } | 1072 } |
OLD | NEW |