| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <shlobj.h> | 5 #include <shlobj.h> |
| 6 #include <wtsapi32.h> | 6 #include <wtsapi32.h> |
| 7 #pragma comment(lib, "wtsapi32.lib") | 7 #pragma comment(lib, "wtsapi32.lib") |
| 8 | 8 |
| 9 #include "chrome/browser/policy/policy_path_parser.h" | 9 #include "chrome/browser/policy/policy_path_parser.h" |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "policy/policy_constants.h" | 16 #include "policy/policy_constants.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Checks if the registry key exists in the given hive and expands any | 20 // Checks if the registry key exists in the given hive and expands any |
| 21 // variables in the string. | 21 // variables in the string. |
| 22 bool LoadUserDataDirPolicyFromRegistry(HKEY hive, | 22 bool LoadUserDataDirPolicyFromRegistry(HKEY hive, |
| 23 const std::wstring& key_name, | 23 const std::wstring& key_name, |
| 24 base::FilePath* user_data_dir) { | 24 base::FilePath* user_data_dir) { |
| 25 std::wstring value; | 25 std::wstring value; |
| 26 | 26 |
| 27 base::win::RegKey policy_key(hive, | 27 base::win::RegKey policy_key(hive, |
| 28 policy::kRegistryMandatorySubKey, | 28 policy::kRegistryChromePolicyKey, |
| 29 KEY_READ); | 29 KEY_READ); |
| 30 if (policy_key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) { | 30 if (policy_key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) { |
| 31 *user_data_dir = | 31 *user_data_dir = |
| 32 base::FilePath(policy::path_parser::ExpandPathVariables(value)); | 32 base::FilePath(policy::path_parser::ExpandPathVariables(value)); |
| 33 return true; | 33 return true; |
| 34 } | 34 } |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 const WCHAR* kMachineNamePolicyVarName = L"${machine_name}"; | 38 const WCHAR* kMachineNamePolicyVarName = L"${machine_name}"; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // A Group Policy value was loaded. Append the Chrome Frame host directory | 162 // A Group Policy value was loaded. Append the Chrome Frame host directory |
| 163 // if relevant. | 163 // if relevant. |
| 164 if (is_chrome_frame) | 164 if (is_chrome_frame) |
| 165 *user_data_dir = user_data_dir->Append(cf_host_dir); | 165 *user_data_dir = user_data_dir->Append(cf_host_dir); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace path_parser | 169 } // namespace path_parser |
| 170 | 170 |
| 171 } // namespace policy | 171 } // namespace policy |
| OLD | NEW |