| 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 | 4 |
| 5 // This file contains helper functions which provide information about the | 5 // This file contains helper functions which provide information about the |
| 6 // current version of Chrome. This includes channel information, version | 6 // current version of Chrome. This includes channel information, version |
| 7 // information etc. This functionality is provided by using functions in | 7 // information etc. This functionality is provided by using functions in |
| 8 // kernel32 and advapi32. No other dependencies are allowed in this file. | 8 // kernel32 and advapi32. No other dependencies are allowed in this file. |
| 9 | 9 |
| 10 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 10 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Tokenizes a string |str| based on single character delimiter. | 157 // Tokenizes a string |str| based on single character delimiter. |
| 158 // The tokens are returned in a vector. The |trim_spaces| parameter indicates | 158 // The tokens are returned in a vector. The |trim_spaces| parameter indicates |
| 159 // whether the function should optionally trim spaces throughout the string. | 159 // whether the function should optionally trim spaces throughout the string. |
| 160 std::vector<std::string> TokenizeString(const std::string& str, | 160 std::vector<std::string> TokenizeString(const std::string& str, |
| 161 char delimiter, | 161 char delimiter, |
| 162 bool trim_spaces); | 162 bool trim_spaces); |
| 163 std::vector<std::wstring> TokenizeString16(const std::wstring& str, | 163 std::vector<std::wstring> TokenizeString16(const std::wstring& str, |
| 164 wchar_t delimiter, | 164 wchar_t delimiter, |
| 165 bool trim_spaces); | 165 bool trim_spaces); |
| 166 | 166 |
| 167 // Tokenizes |command_line| in the same way as CommandLineToArgvW() in |
| 168 // shell32.dll, handling quoting, spacing etc. Normally only used from |
| 169 // GetSwitchValueFromCommandLine(), but exposed for testing. |
| 170 std::vector<std::wstring> TokenizeCommandLineToArray( |
| 171 const std::wstring& command_line); |
| 172 |
| 167 // We assume that the command line |command_line| contains multiple switches | 173 // We assume that the command line |command_line| contains multiple switches |
| 168 // with the format --<switch name>=<switch value>. This function returns the | 174 // with the format --<switch name>=<switch value>. This function returns the |
| 169 // value of the |switch_name| passed in. | 175 // value of the |switch_name| passed in. |
| 170 std::wstring GetSwitchValueFromCommandLine(const std::wstring& command_line, | 176 std::wstring GetSwitchValueFromCommandLine(const std::wstring& command_line, |
| 171 const std::wstring& switch_name); | 177 const std::wstring& switch_name); |
| 172 | 178 |
| 173 // Ensures that the given |full_path| exists, and that the tail component is a | 179 // Ensures that the given |full_path| exists, and that the tail component is a |
| 174 // directory. If the directory does not already exist, it will be created. | 180 // directory. If the directory does not already exist, it will be created. |
| 175 // Returns false if the final component exists but is not a directory, or on | 181 // Returns false if the final component exists but is not a directory, or on |
| 176 // failure to create a directory. | 182 // failure to create a directory. |
| 177 bool RecursiveDirectoryCreate(const std::wstring& full_path); | 183 bool RecursiveDirectoryCreate(const std::wstring& full_path); |
| 178 | 184 |
| 179 // Returns the unadorned channel name based on the channel strategy for the | 185 // Returns the unadorned channel name based on the channel strategy for the |
| 180 // install mode. | 186 // install mode. |
| 181 std::wstring DetermineChannel(const InstallConstants& mode, | 187 std::wstring DetermineChannel(const InstallConstants& mode, |
| 182 bool system_level, | 188 bool system_level, |
| 183 bool multi_install); | 189 bool multi_install); |
| 184 | 190 |
| 185 // Caches the |ProcessType| of the current process. | 191 // Caches the |ProcessType| of the current process. |
| 186 extern ProcessType g_process_type; | 192 extern ProcessType g_process_type; |
| 187 | 193 |
| 188 } // namespace install_static | 194 } // namespace install_static |
| 189 | 195 |
| 190 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 196 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
| OLD | NEW |