| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 5 #ifndef CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| 6 #define CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 6 #define CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 // Builds up a vector of path values mapping to environment variable, | 180 // Builds up a vector of path values mapping to environment variable, |
| 181 // with pairs like [c:\windows\, %systemroot%]. This is later used to | 181 // with pairs like [c:\windows\, %systemroot%]. This is later used to |
| 182 // collapse paths like c:\windows\system32 into %systemroot%\system32, which | 182 // collapse paths like c:\windows\system32 into %systemroot%\system32, which |
| 183 // we can use for comparison against our blacklist (which uses only env vars). | 183 // we can use for comparison against our blacklist (which uses only env vars). |
| 184 // NOTE: The vector will not contain an exhaustive list of environment | 184 // NOTE: The vector will not contain an exhaustive list of environment |
| 185 // variables, only the ones currently found on the blacklist or ones that are | 185 // variables, only the ones currently found on the blacklist or ones that are |
| 186 // likely to appear there. | 186 // likely to appear there. |
| 187 void PreparePathMappings(); | 187 void PreparePathMappings(); |
| 188 | 188 |
| 189 // For a given |module|, collapse the path from c:\windows to %systemroot%, | |
| 190 // based on the |path_mapping_| vector. | |
| 191 void CollapsePath(Module* module); | |
| 192 | |
| 193 // Reports (via UMA) a handful of high-level metrics regarding third party | 189 // Reports (via UMA) a handful of high-level metrics regarding third party |
| 194 // modules in this process. Called by ScanImplFinish. | 190 // modules in this process. Called by ScanImplFinish. |
| 195 void ReportThirdPartyMetrics(); | 191 void ReportThirdPartyMetrics(); |
| 196 | 192 |
| 197 // The typedef for the vector that maps a regular file path to %env_var%. | |
| 198 typedef std::vector<std::pair<base::string16, base::string16>> PathMapping; | |
| 199 | |
| 200 // The TaskRunner to perform work in the background. | 193 // The TaskRunner to perform work in the background. |
| 201 const scoped_refptr<base::TaskRunner> background_task_runner_; | 194 const scoped_refptr<base::TaskRunner> background_task_runner_; |
| 202 | 195 |
| 203 // The vector of paths to %env_var%, used to account for differences in | 196 // The vector of paths to %env_var%, used to account for differences in |
| 204 // where people keep there files, c:\windows vs. d:\windows, etc. | 197 // where people keep there files, c:\windows vs. d:\windows, etc. |
| 205 PathMapping path_mapping_; | 198 StringMapping path_mapping_; |
| 206 | 199 |
| 207 // The vector containing all the enumerated modules (loaded and modules of | 200 // The vector containing all the enumerated modules (loaded and modules of |
| 208 // interest). | 201 // interest). |
| 209 ModulesVector* enumerated_modules_; | 202 ModulesVector* enumerated_modules_; |
| 210 | 203 |
| 211 // The observer, which needs to be notified when the scan is complete. | 204 // The observer, which needs to be notified when the scan is complete. |
| 212 EnumerateModulesModel* observer_; | 205 EnumerateModulesModel* observer_; |
| 213 | 206 |
| 214 // The delay that is observed between module inspection tasks. This is | 207 // The delay that is observed between module inspection tasks. This is |
| 215 // currently 1 second, which means it takes several minutes to iterate over | 208 // currently 1 second, which means it takes several minutes to iterate over |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // The number of suspected bad modules (not including confirmed bad ones) | 347 // The number of suspected bad modules (not including confirmed bad ones) |
| 355 // found during last scan. Only modified on the UI thread. | 348 // found during last scan. Only modified on the UI thread. |
| 356 int suspected_bad_modules_detected_; | 349 int suspected_bad_modules_detected_; |
| 357 | 350 |
| 358 base::ObserverList<Observer> observers_; | 351 base::ObserverList<Observer> observers_; |
| 359 | 352 |
| 360 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); | 353 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); |
| 361 }; | 354 }; |
| 362 | 355 |
| 363 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 356 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| OLD | NEW |