| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions", | 438 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions", |
| 439 checkpoint2 - checkpoint); | 439 checkpoint2 - checkpoint); |
| 440 | 440 |
| 441 checkpoint = checkpoint2; | 441 checkpoint = checkpoint2; |
| 442 EnumerateWinsockModules(); | 442 EnumerateWinsockModules(); |
| 443 checkpoint2 = base::TimeTicks::Now(); | 443 checkpoint2 = base::TimeTicks::Now(); |
| 444 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules", | 444 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules", |
| 445 checkpoint2 - checkpoint); | 445 checkpoint2 - checkpoint); |
| 446 | 446 |
| 447 // TODO(chrisha): Annotate any modules that are suspicious/bad. | 447 // TODO(chrisha): Annotate any modules that are suspicious/bad. |
| 448 AnnotateBadModules(); | |
| 449 | 448 |
| 450 ReportThirdPartyMetrics(); | 449 ReportThirdPartyMetrics(); |
| 451 | 450 |
| 452 std::sort(enumerated_modules_->begin(), | 451 std::sort(enumerated_modules_->begin(), |
| 453 enumerated_modules_->end(), ModuleSort); | 452 enumerated_modules_->end(), ModuleSort); |
| 454 | 453 |
| 455 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", | 454 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", |
| 456 base::TimeTicks::Now() - start_time); | 455 base::TimeTicks::Now() - start_time); |
| 457 | 456 |
| 458 // Send a reply back on the UI thread. The |observer_| outlives this | 457 // Send a reply back on the UI thread. The |observer_| outlives this |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 location.substr(prefix.length() - 1); | 627 location.substr(prefix.length() - 1); |
| 629 size_t length = new_location.length() - mapping->second.length(); | 628 size_t length = new_location.length() - mapping->second.length(); |
| 630 if (length < min_length) { | 629 if (length < min_length) { |
| 631 entry->location = new_location; | 630 entry->location = new_location; |
| 632 min_length = length; | 631 min_length = length; |
| 633 } | 632 } |
| 634 } | 633 } |
| 635 } | 634 } |
| 636 } | 635 } |
| 637 | 636 |
| 638 void ModuleEnumerator::AnnotateBadModules() { | |
| 639 for (auto& module : *enumerated_modules_) { | |
| 640 if (module.name == L"rapportnikko.dll") { | |
| 641 base::Version version(base::UTF16ToASCII(module.version)); | |
| 642 base::Version good("3.6"); | |
| 643 if (version.CompareTo(good) < 0) { | |
| 644 module.status = ModuleStatus::CONFIRMED_BAD; | |
| 645 module.recommended_action = RecommendedAction::UNINSTALL; | |
| 646 } | |
| 647 } | |
| 648 } | |
| 649 } | |
| 650 | |
| 651 void ModuleEnumerator::ReportThirdPartyMetrics() { | 637 void ModuleEnumerator::ReportThirdPartyMetrics() { |
| 652 static const wchar_t kMicrosoft[] = L"Microsoft "; | 638 static const wchar_t kMicrosoft[] = L"Microsoft "; |
| 653 | 639 |
| 654 // Used for counting unique certificates that need to be validated. A | 640 // Used for counting unique certificates that need to be validated. A |
| 655 // catalog counts as a single certificate, as does a file with a baked in | 641 // catalog counts as a single certificate, as does a file with a baked in |
| 656 // certificate. | 642 // certificate. |
| 657 std::set<base::FilePath> unique_certificates; | 643 std::set<base::FilePath> unique_certificates; |
| 658 size_t microsoft_certificates = 0; | 644 size_t microsoft_certificates = 0; |
| 659 size_t signed_modules = 0; | 645 size_t signed_modules = 0; |
| 660 size_t microsoft_modules = 0; | 646 size_t microsoft_modules = 0; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 module_enumerator_.reset(); | 912 module_enumerator_.reset(); |
| 927 | 913 |
| 928 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 914 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
| 929 suspected_bad_modules_detected_); | 915 suspected_bad_modules_detected_); |
| 930 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 916 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
| 931 confirmed_bad_modules_detected_); | 917 confirmed_bad_modules_detected_); |
| 932 | 918 |
| 933 // Forward the callback to any registered observers. | 919 // Forward the callback to any registered observers. |
| 934 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted()); | 920 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted()); |
| 935 } | 921 } |
| OLD | NEW |