| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 module->version = module->version.substr(0, first_space); | 160 module->version = module->version.substr(0, first_space); |
| 161 | 161 |
| 162 // The signer may be returned with trailing nulls. | 162 // The signer may be returned with trailing nulls. |
| 163 size_t first_null = module->cert_info.subject.find(L'\0'); | 163 size_t first_null = module->cert_info.subject.find(L'\0'); |
| 164 if (first_null != base::string16::npos) | 164 if (first_null != base::string16::npos) |
| 165 module->cert_info.subject.resize(first_null); | 165 module->cert_info.subject.resize(first_null); |
| 166 } | 166 } |
| 167 | 167 |
| 168 ModuleEnumerator::ModuleEnumerator(EnumerateModulesModel* observer) | 168 ModuleEnumerator::ModuleEnumerator(EnumerateModulesModel* observer) |
| 169 : background_task_runner_(base::CreateTaskRunnerWithTraits( | 169 : background_task_runner_(base::CreateTaskRunnerWithTraits( |
| 170 base::TaskTraits() | 170 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 171 .MayBlock() | 171 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), |
| 172 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 173 .WithShutdownBehavior( | |
| 174 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN))), | |
| 175 enumerated_modules_(nullptr), | 172 enumerated_modules_(nullptr), |
| 176 observer_(observer), | 173 observer_(observer), |
| 177 per_module_delay_(kDefaultPerModuleDelay) {} | 174 per_module_delay_(kDefaultPerModuleDelay) {} |
| 178 | 175 |
| 179 ModuleEnumerator::~ModuleEnumerator() { | 176 ModuleEnumerator::~ModuleEnumerator() { |
| 180 } | 177 } |
| 181 | 178 |
| 182 void ModuleEnumerator::ScanNow(ModulesVector* list) { | 179 void ModuleEnumerator::ScanNow(ModulesVector* list) { |
| 183 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 180 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 184 enumerated_modules_ = list; | 181 enumerated_modules_ = list; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 718 |
| 722 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 719 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
| 723 suspected_bad_modules_detected_); | 720 suspected_bad_modules_detected_); |
| 724 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 721 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
| 725 confirmed_bad_modules_detected_); | 722 confirmed_bad_modules_detected_); |
| 726 | 723 |
| 727 // Forward the callback to any registered observers. | 724 // Forward the callback to any registered observers. |
| 728 for (Observer& observer : observers_) | 725 for (Observer& observer : observers_) |
| 729 observer.OnScanCompleted(); | 726 observer.OnScanCompleted(); |
| 730 } | 727 } |
| OLD | NEW |