Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ | 5 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ |
| 6 #define CHROME_BROWSER_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ | 6 #define CHROME_BROWSER_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ |
| 7 | 7 |
| 8 #include <utility> | |
| 9 #include <vector> | |
| 10 | |
| 8 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 9 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 10 | 13 |
| 11 // The type of certificate found for the module. | 14 // The type of certificate found for the module. |
| 12 enum class CertificateType { | 15 enum class CertificateType { |
| 13 // The module is not signed. | 16 // The module is not signed. |
| 14 NO_CERTIFICATE, | 17 NO_CERTIFICATE, |
| 15 // The module is signed and the certificate is in the module. | 18 // The module is signed and the certificate is in the module. |
| 16 CERTIFICATE_IN_FILE, | 19 CERTIFICATE_IN_FILE, |
| 17 // The module is signed and the certificate is in an external catalog. | 20 // The module is signed and the certificate is in an external catalog. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 33 // "Google Inc." or "Microsoft Inc."). | 36 // "Google Inc." or "Microsoft Inc."). |
| 34 base::string16 subject; | 37 base::string16 subject; |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 // Extracts information about the certificate of the given |file|, populating | 40 // Extracts information about the certificate of the given |file|, populating |
| 38 // |certificate_info|. It is expected that |certificate_info| be freshly | 41 // |certificate_info|. It is expected that |certificate_info| be freshly |
| 39 // constructed. | 42 // constructed. |
| 40 void GetCertificateInfo(const base::FilePath& file, | 43 void GetCertificateInfo(const base::FilePath& file, |
| 41 CertificateInfo* certificate_info); | 44 CertificateInfo* certificate_info); |
| 42 | 45 |
| 46 // Returns a mapping of the value of an environment variable to its name. | |
| 47 // Removes any existing trailing backslash in the values. | |
| 48 // | |
| 49 // e.g. c:\windows\system32\ -> %systemroot% | |
| 50 using StringMapping = std::vector<std::pair<base::string16, base::string16>>; | |
| 51 StringMapping GetEnvironmentVariablesMapping( | |
| 52 const std::vector<base::string16>& environment_variables); | |
| 53 | |
| 54 // If |prefix_mapping| contains a matching prefix with |string|, substitutes | |
| 55 // that prefix with its associated value. If multiple matches are found, the | |
| 56 // longest prefix is chosen. Unmodified if no matches were found. | |
| 57 // | |
| 58 // This function expects |prefix_mapping| and |string| to contain lowercase | |
| 59 // strings. | |
|
chrisha
2017/03/01 15:45:43
Can you document expectations about trailing slash
Patrick Monette
2017/03/02 20:27:07
Done.
| |
| 60 void CollapseMatchingPrefixInString(const StringMapping& prefix_mapping, | |
| 61 base::string16* string); | |
| 62 | |
| 43 #endif // CHROME_BROWSER_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ | 63 #endif // CHROME_BROWSER_CONFLICTS_MODULE_INFO_UTIL_WIN_H_ |
| OLD | NEW |