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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 std::string filename_hash, location_hash; | 405 std::string filename_hash, location_hash; |
406 GenerateHash(base::WideToUTF8(module.name), &filename_hash); | 406 GenerateHash(base::WideToUTF8(module.name), &filename_hash); |
407 GenerateHash(base::WideToUTF8(module.location), &location_hash); | 407 GenerateHash(base::WideToUTF8(module.location), &location_hash); |
408 | 408 |
409 // Filenames are mandatory. Location is mandatory if given. | 409 // Filenames are mandatory. Location is mandatory if given. |
410 if (filename_hash == blacklisted.filename && | 410 if (filename_hash == blacklisted.filename && |
411 (std::string(blacklisted.location).empty() || | 411 (std::string(blacklisted.location).empty() || |
412 location_hash == blacklisted.location)) { | 412 location_hash == blacklisted.location)) { |
413 // We have a name match against the blacklist (and possibly location match | 413 // We have a name match against the blacklist (and possibly location match |
414 // also), so check version. | 414 // also), so check version. |
415 base::Version module_version(base::UTF16ToASCII(module.version)); | 415 Version module_version(base::UTF16ToASCII(module.version)); |
416 base::Version version_min(blacklisted.version_from); | 416 Version version_min(blacklisted.version_from); |
417 base::Version version_max(blacklisted.version_to); | 417 Version version_max(blacklisted.version_to); |
418 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); | 418 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); |
419 if (!version_ok) { | 419 if (!version_ok) { |
420 bool too_low = version_min.IsValid() && | 420 bool too_low = version_min.IsValid() && |
421 (!module_version.IsValid() || | 421 (!module_version.IsValid() || |
422 module_version.CompareTo(version_min) < 0); | 422 module_version.CompareTo(version_min) < 0); |
423 bool too_high = version_max.IsValid() && | 423 bool too_high = version_max.IsValid() && |
424 (!module_version.IsValid() || | 424 (!module_version.IsValid() || |
425 module_version.CompareTo(version_max) >= 0); | 425 module_version.CompareTo(version_max) >= 0); |
426 version_ok = !too_low && !too_high; | 426 version_ok = !too_low && !too_high; |
427 } | 427 } |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 GenerateHash(base::WideToUTF8(module.location), &location); | 1068 GenerateHash(base::WideToUTF8(module.location), &location); |
1069 GenerateHash(base::WideToUTF8(module.description), &description); | 1069 GenerateHash(base::WideToUTF8(module.description), &description); |
1070 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1070 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
1071 | 1071 |
1072 base::string16 url = | 1072 base::string16 url = |
1073 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1073 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
1074 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1074 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
1075 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1075 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
1076 return GURL(base::UTF16ToUTF8(url)); | 1076 return GURL(base::UTF16ToUTF8(url)); |
1077 } | 1077 } |
OLD | NEW |