Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3854)

Unified Diff: chrome/browser/conflicts/module_info_win.h

Issue 2720513005: Add InspectModule() that returns a populated ModuleInspectionResult struct (Closed)
Patch Set: Addressing comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/conflicts/module_info_win.h
diff --git a/chrome/browser/conflicts/module_info_win.h b/chrome/browser/conflicts/module_info_win.h
index 368bfd79f956b730d1c700565d793825967d9e7b..2008ae2feb401bb9b692c71c1d9db52be978d0de 100644
--- a/chrome/browser/conflicts/module_info_win.h
+++ b/chrome/browser/conflicts/module_info_win.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_CONFLICTS_MODULE_INFO_WIN_H_
#define CHROME_BROWSER_CONFLICTS_MODULE_INFO_WIN_H_
+#include <memory>
+
#include "base/files/file_path.h"
#include "chrome/browser/conflicts/module_info_util_win.h"
@@ -43,22 +45,12 @@ struct ModuleInfoKey {
ModuleId module_id;
};
-// Holds more detailed information about a given module. Because most of this
+// Holds more detailed information about a given module. Because all of this
// information is expensive to gather and require disk access, it should be
chrisha 2017/03/04 15:54:17 requires*
Patrick Monette 2017/03/06 16:39:48 Done.
-// collected on a task runner that allow blocking.
-struct ModuleInfoData {
- ModuleInfoData();
- ModuleInfoData(const ModuleInfoData& others);
- ~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.
+// collected via InspectModule() on a task runner that allow blocking.
+struct ModuleInspectionResult {
+ ModuleInspectionResult();
+ ~ModuleInspectionResult();
// The module path, not including the basename. This is cleaned and normalized
// so that common paths are converted to their environment variable mappings
@@ -82,4 +74,42 @@ struct ModuleInfoData {
CertificateInfo certificate_info;
};
+// Contains the inspection result of a module and additional information that is
+// useful to the ModuleDatabase.
+struct ModuleInfoData {
+ ModuleInfoData();
+ ~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 inspection result obtained via InspectModule().
+ std::unique_ptr<ModuleInspectionResult> inspection_result;
+};
+
+// Given a module identified by |module_key|, returns a populated
+// ModuleInspectionResult that contains detailed information about the module on
+// disk. This is a blocking task that requires access to disk.
+std::unique_ptr<ModuleInspectionResult> InspectModule(
+ const StringMapping& env_variable_mapping,
+ const ModuleInfoKey& module_key);
+
+namespace internal {
+
+// Normalizes the information already contained in |inspection_result|. In
+// particular,
chrisha 2017/03/04 15:54:17 particular:
Patrick Monette 2017/03/06 16:39:47 Done.
+// - The path is split in 2 parts: The basename and the location.
+// - If it uses commas, the version string is modified to use periods.
+// - If there is one, the version string suffix is removed.
+// - If there is one, the trailing null character in the subject string of the
+// certificate info is removed.
+//
+// Exposed for testing.
+void NormalizeInspectionResult(ModuleInspectionResult* inspection_result);
+
+} // namespace internal
+
#endif // CHROME_BROWSER_CONFLICTS_MODULE_INFO_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698