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