| 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> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "chrome/browser/conflicts/module_info_util_win.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 class EnumerateModulesModel; | 22 class EnumerateModulesModel; |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class ListValue; | 25 class ListValue; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // A helper class that implements the enumerate module functionality on the FILE | 28 // A helper class that implements the enumerate module functionality on the FILE |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 SEE_LINK = 1 << 4, | 67 SEE_LINK = 1 << 4, |
| 67 NOTIFY_USER = 1 << 5, | 68 NOTIFY_USER = 1 << 5, |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 // Which Windows OS is affected. | 71 // Which Windows OS is affected. |
| 71 enum OperatingSystem { | 72 enum OperatingSystem { |
| 72 ALL = -1, | 73 ALL = -1, |
| 73 XP = 1 << 0, | 74 XP = 1 << 0, |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 // The type of certificate found for the module. | |
| 77 enum CertificateType { | |
| 78 NO_CERTIFICATE, | |
| 79 CERTIFICATE_IN_FILE, | |
| 80 CERTIFICATE_IN_CATALOG, | |
| 81 }; | |
| 82 | |
| 83 // Information about the certificate of a file. | |
| 84 struct CertificateInfo { | |
| 85 CertificateInfo(); | |
| 86 | |
| 87 // The type of signature encountered. | |
| 88 CertificateType type; | |
| 89 // Path to the file containing the certificate. Empty if NO_CERTIFICATE. | |
| 90 base::FilePath path; | |
| 91 // The "Subject" name of the certificate. | |
| 92 base::string16 subject; | |
| 93 }; | |
| 94 | |
| 95 // The structure we populate when enumerating modules. | 77 // The structure we populate when enumerating modules. |
| 96 struct Module { | 78 struct Module { |
| 97 Module(); | 79 Module(); |
| 98 Module(const Module& rhs); | 80 Module(const Module& rhs); |
| 99 // Constructor exposed for unittesting. | 81 // Constructor exposed for unittesting. |
| 100 Module(ModuleType type, | 82 Module(ModuleType type, |
| 101 ModuleStatus status, | 83 ModuleStatus status, |
| 102 const base::string16& location, | 84 const base::string16& location, |
| 103 const base::string16& name, | 85 const base::string16& name, |
| 104 const base::string16& product_name, | 86 const base::string16& product_name, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 119 base::string16 product_name; | 101 base::string16 product_name; |
| 120 // The module file description. | 102 // The module file description. |
| 121 base::string16 description; | 103 base::string16 description; |
| 122 // The module version. | 104 // The module version. |
| 123 base::string16 version; | 105 base::string16 version; |
| 124 // The help tips bitmask. | 106 // The help tips bitmask. |
| 125 RecommendedAction recommended_action; | 107 RecommendedAction recommended_action; |
| 126 // The duplicate count within each category of modules. | 108 // The duplicate count within each category of modules. |
| 127 int duplicate_count; | 109 int duplicate_count; |
| 128 // The certificate info for the module. | 110 // The certificate info for the module. |
| 129 CertificateInfo cert_info; | 111 ModuleDatabase::CertificateInfo cert_info; |
| 130 }; | 112 }; |
| 131 | 113 |
| 132 // A vector typedef of all modules enumerated. | 114 // A vector typedef of all modules enumerated. |
| 133 typedef std::vector<Module> ModulesVector; | 115 typedef std::vector<Module> ModulesVector; |
| 134 | 116 |
| 135 // A static function that normalizes the module information in the |module| | 117 // A static function that normalizes the module information in the |module| |
| 136 // struct. Module information needs to be normalized before comparing against | 118 // struct. Module information needs to be normalized before comparing against |
| 137 // the blacklist. This is because the same module can be described in many | 119 // the blacklist. This is because the same module can be described in many |
| 138 // different ways, ie. file paths can be presented in long/short name form, | 120 // different ways, ie. file paths can be presented in long/short name form, |
| 139 // and are not case sensitive on Windows. Also, the version string returned | 121 // and are not case sensitive on Windows. Also, the version string returned |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // The number of suspected bad modules (not including confirmed bad ones) | 365 // The number of suspected bad modules (not including confirmed bad ones) |
| 384 // found during last scan. Only modified on the UI thread. | 366 // found during last scan. Only modified on the UI thread. |
| 385 int suspected_bad_modules_detected_; | 367 int suspected_bad_modules_detected_; |
| 386 | 368 |
| 387 base::ObserverList<Observer> observers_; | 369 base::ObserverList<Observer> observers_; |
| 388 | 370 |
| 389 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); | 371 DISALLOW_COPY_AND_ASSIGN(EnumerateModulesModel); |
| 390 }; | 372 }; |
| 391 | 373 |
| 392 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ | 374 #endif // CHROME_BROWSER_WIN_ENUMERATE_MODULES_MODEL_H_ |
| OLD | NEW |