| 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 #include "chrome/install_static/policy_path_parser.h" | 5 #include "chrome/install_static/policy_path_parser.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| 11 #include <wtsapi32.h> | 11 #include <wtsapi32.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const WCHAR* kMachineNamePolicyVarName = L"${machine_name}"; | 17 constexpr WCHAR kMachineNamePolicyVarName[] = L"${machine_name}"; |
| 18 const WCHAR* kUserNamePolicyVarName = L"${user_name}"; | 18 constexpr WCHAR kUserNamePolicyVarName[] = L"${user_name}"; |
| 19 const WCHAR* kWinDocumentsFolderVarName = L"${documents}"; | 19 constexpr WCHAR kWinDocumentsFolderVarName[] = L"${documents}"; |
| 20 const WCHAR* kWinLocalAppDataFolderVarName = L"${local_app_data}"; | 20 constexpr WCHAR kWinLocalAppDataFolderVarName[] = L"${local_app_data}"; |
| 21 const WCHAR* kWinRoamingAppDataFolderVarName = L"${roaming_app_data}"; | 21 constexpr WCHAR kWinRoamingAppDataFolderVarName[] = L"${roaming_app_data}"; |
| 22 const WCHAR* kWinProfileFolderVarName = L"${profile}"; | 22 constexpr WCHAR kWinProfileFolderVarName[] = L"${profile}"; |
| 23 const WCHAR* kWinProgramDataFolderVarName = L"${global_app_data}"; | 23 constexpr WCHAR kWinProgramDataFolderVarName[] = L"${global_app_data}"; |
| 24 const WCHAR* kWinProgramFilesFolderVarName = L"${program_files}"; | 24 constexpr WCHAR kWinProgramFilesFolderVarName[] = L"${program_files}"; |
| 25 const WCHAR* kWinWindowsFolderVarName = L"${windows}"; | 25 constexpr WCHAR kWinWindowsFolderVarName[] = L"${windows}"; |
| 26 const WCHAR* kWinClientName = L"${client_name}"; | 26 constexpr WCHAR kWinClientName[] = L"${client_name}"; |
| 27 const WCHAR* kWinSessionName = L"${session_name}"; | 27 constexpr WCHAR kWinSessionName[] = L"${session_name}"; |
| 28 | 28 |
| 29 struct WinFolderNamesToCSIDLMapping { | 29 struct WinFolderNamesToCSIDLMapping { |
| 30 const WCHAR* name; | 30 const WCHAR* name; |
| 31 int id; | 31 int id; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Mapping from variable names to Windows CSIDL ids. | 34 // Mapping from variable names to Windows CSIDL ids. |
| 35 const WinFolderNamesToCSIDLMapping kWinFolderMapping[] = { | 35 constexpr WinFolderNamesToCSIDLMapping kWinFolderMapping[] = { |
| 36 { kWinWindowsFolderVarName, CSIDL_WINDOWS}, | 36 { kWinWindowsFolderVarName, CSIDL_WINDOWS}, |
| 37 { kWinProgramFilesFolderVarName, CSIDL_PROGRAM_FILES}, | 37 { kWinProgramFilesFolderVarName, CSIDL_PROGRAM_FILES}, |
| 38 { kWinProgramDataFolderVarName, CSIDL_COMMON_APPDATA}, | 38 { kWinProgramDataFolderVarName, CSIDL_COMMON_APPDATA}, |
| 39 { kWinProfileFolderVarName, CSIDL_PROFILE}, | 39 { kWinProfileFolderVarName, CSIDL_PROFILE}, |
| 40 { kWinLocalAppDataFolderVarName, CSIDL_LOCAL_APPDATA}, | 40 { kWinLocalAppDataFolderVarName, CSIDL_LOCAL_APPDATA}, |
| 41 { kWinRoamingAppDataFolderVarName, CSIDL_APPDATA}, | 41 { kWinRoamingAppDataFolderVarName, CSIDL_APPDATA}, |
| 42 { kWinDocumentsFolderVarName, CSIDL_PERSONAL} | 42 { kWinDocumentsFolderVarName, CSIDL_PERSONAL} |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 template <class FunctionType> | 45 template <class FunctionType> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 // TODO(pastarmovj): Consider reorganizing this code once there are even more | 166 // TODO(pastarmovj): Consider reorganizing this code once there are even more |
| 167 // variables to be supported. The search for the var and its replacement can | 167 // variables to be supported. The search for the var and its replacement can |
| 168 // be extracted as common functionality. | 168 // be extracted as common functionality. |
| 169 | 169 |
| 170 return result; | 170 return result; |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace install_static | 173 } // namespace install_static |
| OLD | NEW |