| 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 <softpub.h> | 7 #include <softpub.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <tlhelp32.h> | 10 #include <tlhelp32.h> |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // enumeration in this already started task. | 511 // enumeration in this already started task. |
| 512 ++index; | 512 ++index; |
| 513 } | 513 } |
| 514 | 514 |
| 515 // Getting here means that all of the modules have been inspected. | 515 // Getting here means that all of the modules have been inspected. |
| 516 return ScanImplFinish(); | 516 return ScanImplFinish(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void ModuleEnumerator::ScanImplFinish() { | 519 void ModuleEnumerator::ScanImplFinish() { |
| 520 // TODO(chrisha): Annotate any modules that are suspicious/bad. | 520 // TODO(chrisha): Annotate any modules that are suspicious/bad. |
| 521 AnnotateBadModules(); |
| 521 | 522 |
| 522 ReportThirdPartyMetrics(); | 523 ReportThirdPartyMetrics(); |
| 523 | 524 |
| 524 std::sort(enumerated_modules_->begin(), | 525 std::sort(enumerated_modules_->begin(), |
| 525 enumerated_modules_->end(), ModuleSort); | 526 enumerated_modules_->end(), ModuleSort); |
| 526 | 527 |
| 527 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationInspectionTime", | 528 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationInspectionTime", |
| 528 enumeration_inspection_time_); | 529 enumeration_inspection_time_); |
| 529 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", | 530 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", |
| 530 enumeration_total_time_); | 531 enumeration_total_time_); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 location.substr(prefix.length() - 1); | 688 location.substr(prefix.length() - 1); |
| 688 size_t length = new_location.length() - mapping->second.length(); | 689 size_t length = new_location.length() - mapping->second.length(); |
| 689 if (length < min_length) { | 690 if (length < min_length) { |
| 690 entry->location = new_location; | 691 entry->location = new_location; |
| 691 min_length = length; | 692 min_length = length; |
| 692 } | 693 } |
| 693 } | 694 } |
| 694 } | 695 } |
| 695 } | 696 } |
| 696 | 697 |
| 698 void ModuleEnumerator::AnnotateBadModules() { |
| 699 for (auto& module : *enumerated_modules_) { |
| 700 if (module.name == L"rapportnikko.dll") { |
| 701 base::Version version(base::UTF16ToASCII(module.version)); |
| 702 base::Version good("3.6"); |
| 703 if (version.CompareTo(good) < 0) { |
| 704 module.status = ModuleStatus::CONFIRMED_BAD; |
| 705 module.recommended_action = RecommendedAction::UNINSTALL; |
| 706 } |
| 707 } |
| 708 } |
| 709 } |
| 710 |
| 697 void ModuleEnumerator::ReportThirdPartyMetrics() { | 711 void ModuleEnumerator::ReportThirdPartyMetrics() { |
| 698 static const wchar_t kMicrosoft[] = L"Microsoft "; | 712 static const wchar_t kMicrosoft[] = L"Microsoft "; |
| 699 static const wchar_t kGoogle[] = L"Google Inc"; | 713 static const wchar_t kGoogle[] = L"Google Inc"; |
| 700 | 714 |
| 701 // Used for counting unique certificates that need to be validated. A | 715 // Used for counting unique certificates that need to be validated. A |
| 702 // catalog counts as a single certificate, as does a file with a baked in | 716 // catalog counts as a single certificate, as does a file with a baked in |
| 703 // certificate. | 717 // certificate. |
| 704 std::set<base::FilePath> unique_certificates; | 718 std::set<base::FilePath> unique_certificates; |
| 705 size_t microsoft_certificates = 0; | 719 size_t microsoft_certificates = 0; |
| 706 size_t signed_modules = 0; | 720 size_t signed_modules = 0; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 | 1025 |
| 1012 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 1026 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
| 1013 suspected_bad_modules_detected_); | 1027 suspected_bad_modules_detected_); |
| 1014 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 1028 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
| 1015 confirmed_bad_modules_detected_); | 1029 confirmed_bad_modules_detected_); |
| 1016 | 1030 |
| 1017 // Forward the callback to any registered observers. | 1031 // Forward the callback to any registered observers. |
| 1018 for (Observer& observer : observers_) | 1032 for (Observer& observer : observers_) |
| 1019 observer.OnScanCompleted(); | 1033 observer.OnScanCompleted(); |
| 1020 } | 1034 } |
| OLD | NEW |