| 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(); | |
| 522 | 521 |
| 523 ReportThirdPartyMetrics(); | 522 ReportThirdPartyMetrics(); |
| 524 | 523 |
| 525 std::sort(enumerated_modules_->begin(), | 524 std::sort(enumerated_modules_->begin(), |
| 526 enumerated_modules_->end(), ModuleSort); | 525 enumerated_modules_->end(), ModuleSort); |
| 527 | 526 |
| 528 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationInspectionTime", | 527 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationInspectionTime", |
| 529 enumeration_inspection_time_); | 528 enumeration_inspection_time_); |
| 530 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", | 529 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", |
| 531 enumeration_total_time_); | 530 enumeration_total_time_); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 base::CompareCase::SENSITIVE)) { | 685 base::CompareCase::SENSITIVE)) { |
| 687 base::string16 new_location = mapping->second + | 686 base::string16 new_location = mapping->second + |
| 688 location.substr(prefix.length() - 1); | 687 location.substr(prefix.length() - 1); |
| 689 size_t length = new_location.length() - mapping->second.length(); | 688 size_t length = new_location.length() - mapping->second.length(); |
| 690 if (length < min_length) { | 689 if (length < min_length) { |
| 691 entry->location = new_location; | 690 entry->location = new_location; |
| 692 min_length = length; | 691 min_length = length; |
| 693 } | 692 } |
| 694 } | 693 } |
| 695 } | 694 } |
| 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 } | 695 } |
| 710 | 696 |
| 711 void ModuleEnumerator::ReportThirdPartyMetrics() { | 697 void ModuleEnumerator::ReportThirdPartyMetrics() { |
| 712 static const wchar_t kMicrosoft[] = L"Microsoft "; | 698 static const wchar_t kMicrosoft[] = L"Microsoft "; |
| 713 static const wchar_t kGoogle[] = L"Google Inc"; | 699 static const wchar_t kGoogle[] = L"Google Inc"; |
| 714 | 700 |
| 715 // Used for counting unique certificates that need to be validated. A | 701 // Used for counting unique certificates that need to be validated. A |
| 716 // catalog counts as a single certificate, as does a file with a baked in | 702 // catalog counts as a single certificate, as does a file with a baked in |
| 717 // certificate. | 703 // certificate. |
| 718 std::set<base::FilePath> unique_certificates; | 704 std::set<base::FilePath> unique_certificates; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 | 1011 |
| 1026 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 1012 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
| 1027 suspected_bad_modules_detected_); | 1013 suspected_bad_modules_detected_); |
| 1028 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 1014 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
| 1029 confirmed_bad_modules_detected_); | 1015 confirmed_bad_modules_detected_); |
| 1030 | 1016 |
| 1031 // Forward the callback to any registered observers. | 1017 // Forward the callback to any registered observers. |
| 1032 for (Observer& observer : observers_) | 1018 for (Observer& observer : observers_) |
| 1033 observer.OnScanCompleted(); | 1019 observer.OnScanCompleted(); |
| 1034 } | 1020 } |
| OLD | NEW |