Chromium Code Reviews| Index: chrome/browser/conflicts/module_database_win.h |
| diff --git a/chrome/browser/conflicts/module_database_win.h b/chrome/browser/conflicts/module_database_win.h |
| index 73725556ab257f8ee26874544daa6b4e5f55bf9e..9a3ea4b5b50c090c3835d3c21bcfec79c1ce1a54 100644 |
| --- a/chrome/browser/conflicts/module_database_win.h |
| +++ b/chrome/browser/conflicts/module_database_win.h |
| @@ -22,6 +22,36 @@ |
| // be set as the process-wide singleton via SetInstance. |
| class ModuleDatabase { |
| public: |
| + // Used as a unique identifier for a module in a ModuleSet. |
| + using ModuleId = int; |
| + |
| + // The type of certificate found for the module. |
| + enum CertificateType { |
| + // The module is not signed. |
| + NO_CERTIFICATE, |
| + // The module is signed and the certificate is in the module. |
| + CERTIFICATE_IN_FILE, |
| + // The module is signed and the certificate is in an external catalog. |
| + CERTIFICATE_IN_CATALOG, |
| + }; |
| + |
| + // Structures for maintaining information about modules. |
| + struct ModuleInfoKey; |
| + struct CertificateInfo; |
| + struct ModuleInfoData; |
| + using ModuleMap = std::map<ModuleInfoKey, ModuleInfoData>; |
| + using ModuleInfo = ModuleMap::value_type; |
| + |
| + // Used for maintaing a list of modules loaded in a process. Maps module IDs |
| + // to load addresses. |
| + using ModuleLoadAddresses = std::vector<std::pair<ModuleId, uintptr_t>>; |
| + |
| + // Structures for maintaining information about running processes. |
| + struct ProcessInfoKey; |
| + struct ProcessInfoData; |
| + using ProcessMap = std::map<ProcessInfoKey, ProcessInfoData>; |
| + using ProcessInfo = ProcessMap::value_type; |
| + |
| // A ModuleDatabase is by default bound to a provided sequenced task runner. |
| // All calls must be made in the context of this task runner, unless |
| // otherwise noted. For calls from other contexts this task runner is used to |
| @@ -79,25 +109,6 @@ class ModuleDatabase { |
| // been found. |
| static constexpr size_t kInvalidIndex = ~0u; |
| - // Used as a unique identifier for a module in a ModuleSet. |
| - using ModuleId = int; |
| - |
| - // Structures for maintaining information about modules. |
| - struct ModuleInfoKey; |
| - struct ModuleInfoData; |
| - using ModuleMap = std::map<ModuleInfoKey, ModuleInfoData>; |
| - using ModuleInfo = ModuleMap::value_type; |
| - |
| - // Used for maintaing a list of modules loaded in a process. Maps module IDs |
| - // to load addresses. |
| - using ModuleLoadAddresses = std::vector<std::pair<ModuleId, uintptr_t>>; |
| - |
| - // Structures for maintaining information about running processes. |
| - struct ProcessInfoKey; |
| - struct ProcessInfoData; |
| - using ProcessMap = std::map<ProcessInfoKey, ProcessInfoData>; |
| - using ProcessInfo = ProcessMap::value_type; |
| - |
| // Converts a valid |process_type| to a bit for use in a bitmask of process |
| // values. Exposed in the header for testing. |
| static uint32_t ProcessTypeToBit(content::ProcessType process_type); |
| @@ -195,16 +206,59 @@ struct ModuleDatabase::ModuleInfoKey { |
| ModuleId module_id; |
| }; |
| +// Information about the certificate of a file. |
| +struct ModuleDatabase::CertificateInfo { |
| + CertificateInfo(); |
| + |
| + // The type of signature encountered. |
| + CertificateType type; |
| + |
| + // Path to the file containing the certificate. Empty if |type| is |
| + // NO_CERTIFICATE. |
| + base::FilePath path; |
| + |
| + // The "Subject" name of the certificate. This is the signer (ie, |
| + // "Google Inc." or "Microsoft Inc."). |
| + base::string16 subject; |
| +}; |
| + |
| // This is the mutable portion of the module information, and is the storage |
| // type in a std::map. |
| struct ModuleDatabase::ModuleInfoData { |
|
Patrick Monette
2017/01/26 20:49:07
Maybe we should add a more explicit "inspected" or
chrisha
2017/02/06 18:38:45
Yeah, that's a good point. I won't bother with tha
|
| ModuleInfoData(); |
| + ModuleInfoData(const ModuleInfoData& others); |
|
Patrick Monette
2017/01/26 20:49:07
What's the reason for explicitly defining the defa
chrisha
2017/02/06 18:38:45
Because the clang bots complain that this needs to
|
| + ~ModuleInfoData(); |
| // Set of all process types in which this module has been seen (may not be |
| // currently present in a process of that type). This is a conversion of |
| // ProcessType enumeration to a bitfield. See "ProcessTypeToBit" and |
| // "BitIndexToProcessType" for details. |
| uint32_t process_types; |
| + |
| + // The following pieces of information are determined via a detailed |
| + // inspection of the module. This is relatively expensive and uses blocking |
| + // IO, so is performed in a background task. |
| + |
| + // The module path, not including the basename. This is cleaned and normalized |
| + // so that common paths are converted to their environment variable mappings |
| + // (ie, %systemroot%). This makes i18n localized paths easily comparable. |
| + base::string16 location; |
| + |
| + // The basename of the module. |
| + base::string16 basename; |
| + |
| + // The name of the product the module belongs to. |
| + base::string16 product_name; |
| + |
| + // The module file description. |
| + base::string16 description; |
| + |
| + // The module version. This is usually in the form a.b.c.d (where a, b, c and |
| + // d are integers), but may also have fewer than 4 components. |
| + base::string16 version; |
| + |
| + // The certificate info for the module. |
| + CertificateInfo cert_info; |
|
Patrick Monette
2017/01/26 20:49:07
Nit. This is the only name that is truncated. Inco
chrisha
2017/02/06 18:38:45
Done.
|
| }; |
| // Information about a running process. This ties modules in a ModuleSet to |