OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This file contains helper functions which provide information about the | 4 // This file contains helper functions which provide information about the |
5 // current version of Chrome. This includes channel information, version | 5 // current version of Chrome. This includes channel information, version |
6 // information etc. This functionality is provided by using functions in | 6 // information etc. This functionality is provided by using functions in |
7 // kernel32 and advapi32. No other dependencies are allowed in this file. | 7 // kernel32 and advapi32. No other dependencies are allowed in this file. |
8 | 8 |
9 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 9 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
10 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 10 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
11 | 11 |
| 12 #include <string> |
| 13 #include <vector> |
| 14 |
12 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
13 | 16 |
14 namespace install_static { | 17 namespace install_static { |
15 | 18 |
16 enum class ProcessType { | 19 enum class ProcessType { |
17 UNINITIALIZED, | 20 UNINITIALIZED, |
18 NON_BROWSER_PROCESS, | 21 NON_BROWSER_PROCESS, |
19 BROWSER_PROCESS, | 22 BROWSER_PROCESS, |
20 }; | 23 }; |
21 | 24 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 base::string16 GetBrowserCrashDumpAttemptsRegistryPath(); | 152 base::string16 GetBrowserCrashDumpAttemptsRegistryPath(); |
150 | 153 |
151 // Returns true if the |source| string matches the |pattern|. The pattern | 154 // Returns true if the |source| string matches the |pattern|. The pattern |
152 // may contain wildcards like '?', which matches one character or a '*' | 155 // may contain wildcards like '?', which matches one character or a '*' |
153 // which matches 0 or more characters. | 156 // which matches 0 or more characters. |
154 // Please note that pattern matches the whole string. If you want to find | 157 // Please note that pattern matches the whole string. If you want to find |
155 // something in the middle of the string then you need to specify the pattern | 158 // something in the middle of the string then you need to specify the pattern |
156 // as '*xyz*'. | 159 // as '*xyz*'. |
157 bool MatchPattern(const base::string16& source, const base::string16& pattern); | 160 bool MatchPattern(const base::string16& source, const base::string16& pattern); |
158 | 161 |
| 162 // UTF8 to UTF16 and vice versa conversion helpers. |
| 163 base::string16 UTF8ToUTF16(const std::string& source); |
| 164 |
| 165 std::string UTF16ToUTF8(const base::string16& source); |
| 166 |
| 167 // Tokenizes a string |str| based on single character delimiter. |
| 168 // The tokens are returned in a vector. The |trim_spaces| parameter indicates |
| 169 // whether the function should optionally trim spaces throughout the string. |
| 170 std::vector<std::string> TokenizeString(const std::string& str, |
| 171 char delimiter, |
| 172 bool trim_spaces); |
| 173 |
| 174 // Compares version strings of the form "X.X.X.X" and returns the result of the |
| 175 // comparison in the |result| parameter. The result is as below: |
| 176 // 0 if the versions are equal. |
| 177 // -1 if version1 < version2. |
| 178 // 1 if version1 > version2. |
| 179 // Returns true on success, false on invalid strings being passed, etc. |
| 180 bool CompareVersionStrings(const std::string& version1, |
| 181 const std::string& version2, |
| 182 int* result); |
| 183 |
159 // Caches the |ProcessType| of the current process. | 184 // Caches the |ProcessType| of the current process. |
160 extern ProcessType g_process_type; | 185 extern ProcessType g_process_type; |
161 | 186 |
162 } // namespace install_static | 187 } // namespace install_static |
163 | 188 |
164 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 189 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
OLD | NEW |