| 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/win/enumerate_modules_model.h" | 5 #include "chrome/browser/win/enumerate_modules_model.h" |
| 6 | 6 |
| 7 #include <Tlhelp32.h> | 7 #include <Tlhelp32.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <wintrust.h> | 10 #include <wintrust.h> |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 std::string filename_hash, location_hash; | 410 std::string filename_hash, location_hash; |
| 411 GenerateHash(base::WideToUTF8(module.name), &filename_hash); | 411 GenerateHash(base::WideToUTF8(module.name), &filename_hash); |
| 412 GenerateHash(base::WideToUTF8(module.location), &location_hash); | 412 GenerateHash(base::WideToUTF8(module.location), &location_hash); |
| 413 | 413 |
| 414 // Filenames are mandatory. Location is mandatory if given. | 414 // Filenames are mandatory. Location is mandatory if given. |
| 415 if (filename_hash == blacklisted.filename && | 415 if (filename_hash == blacklisted.filename && |
| 416 (std::string(blacklisted.location).empty() || | 416 (std::string(blacklisted.location).empty() || |
| 417 location_hash == blacklisted.location)) { | 417 location_hash == blacklisted.location)) { |
| 418 // We have a name match against the blacklist (and possibly location match | 418 // We have a name match against the blacklist (and possibly location match |
| 419 // also), so check version. | 419 // also), so check version. |
| 420 Version module_version(base::UTF16ToASCII(module.version)); | 420 base::Version module_version(base::UTF16ToASCII(module.version)); |
| 421 Version version_min(blacklisted.version_from); | 421 base::Version version_min(blacklisted.version_from); |
| 422 Version version_max(blacklisted.version_to); | 422 base::Version version_max(blacklisted.version_to); |
| 423 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); | 423 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); |
| 424 if (!version_ok) { | 424 if (!version_ok) { |
| 425 bool too_low = version_min.IsValid() && | 425 bool too_low = version_min.IsValid() && |
| 426 (!module_version.IsValid() || | 426 (!module_version.IsValid() || |
| 427 module_version.CompareTo(version_min) < 0); | 427 module_version.CompareTo(version_min) < 0); |
| 428 bool too_high = version_max.IsValid() && | 428 bool too_high = version_max.IsValid() && |
| 429 (!module_version.IsValid() || | 429 (!module_version.IsValid() || |
| 430 module_version.CompareTo(version_max) >= 0); | 430 module_version.CompareTo(version_max) >= 0); |
| 431 version_ok = !too_low && !too_high; | 431 version_ok = !too_low && !too_high; |
| 432 } | 432 } |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 GenerateHash(base::WideToUTF8(module.location), &location); | 1067 GenerateHash(base::WideToUTF8(module.location), &location); |
| 1068 GenerateHash(base::WideToUTF8(module.description), &description); | 1068 GenerateHash(base::WideToUTF8(module.description), &description); |
| 1069 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1069 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
| 1070 | 1070 |
| 1071 base::string16 url = | 1071 base::string16 url = |
| 1072 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1072 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
| 1073 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1073 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
| 1074 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1074 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
| 1075 return GURL(base::UTF16ToUTF8(url)); | 1075 return GURL(base::UTF16ToUTF8(url)); |
| 1076 } | 1076 } |
| OLD | NEW |