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

Side by Side Diff: chrome/install_static/install_util.h

Issue 2017853002: Add functionality to the install_static library to tokenize strings and compare versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows gn builder redness Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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>
grt (UTC plus 2) 2016/05/27 14:13:20 #include <string>
grt (UTC plus 2) 2016/05/27 20:18:03 ping
ananta 2016/05/27 20:42:13 We get that through string16.h
grt (UTC plus 2) 2016/05/27 20:47:35 i think the rules of iwyu say that you shouldn't c
ananta 2016/05/27 21:38:54 ok. Added include
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
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 utf8_to_utf16(const std::string &source);
grt (UTC plus 2) 2016/05/27 14:13:20 UTF8ToUTF16 (https://google.github.io/styleguide/c
ananta 2016/05/27 20:05:26 Done.
163
164 std::string utf16_to_utf8(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 const char delimiter,
grt (UTC plus 2) 2016/05/27 14:13:20 nit: omit "const" for fundamental types
ananta 2016/05/27 20:05:26 Done.
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 < version 2.
scottmg 2016/05/27 17:27:22 version 2 -> version2
ananta 2016/05/27 20:05:26 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698