| 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 <stddef.h> |
| 6 #include <wtsapi32.h> | 7 #include <wtsapi32.h> |
| 7 #pragma comment(lib, "wtsapi32.lib") | 8 #pragma comment(lib, "wtsapi32.lib") |
| 8 | 9 |
| 9 #include "chrome/browser/policy/policy_path_parser.h" | 10 #include "chrome/browser/policy/policy_path_parser.h" |
| 10 | 11 |
| 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/win/registry.h" | 15 #include "base/win/registry.h" |
| 14 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 15 #include "policy/policy_constants.h" | 17 #include "policy/policy_constants.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 // Checks if the key exists in the given hive and expands any string variables. | 21 // Checks if the key exists in the given hive and expands any string variables. |
| 20 bool LoadUserDataDirPolicyFromRegistry(HKEY hive, base::FilePath* dir) { | 22 bool LoadUserDataDirPolicyFromRegistry(HKEY hive, base::FilePath* dir) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void CheckUserDataDirPolicy(base::FilePath* user_data_dir) { | 147 void CheckUserDataDirPolicy(base::FilePath* user_data_dir) { |
| 146 DCHECK(user_data_dir); | 148 DCHECK(user_data_dir); |
| 147 // Policy from the HKLM hive has precedence over HKCU. | 149 // Policy from the HKLM hive has precedence over HKCU. |
| 148 if (!LoadUserDataDirPolicyFromRegistry(HKEY_LOCAL_MACHINE, user_data_dir)) | 150 if (!LoadUserDataDirPolicyFromRegistry(HKEY_LOCAL_MACHINE, user_data_dir)) |
| 149 LoadUserDataDirPolicyFromRegistry(HKEY_CURRENT_USER, user_data_dir); | 151 LoadUserDataDirPolicyFromRegistry(HKEY_CURRENT_USER, user_data_dir); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace path_parser | 154 } // namespace path_parser |
| 153 | 155 |
| 154 } // namespace policy | 156 } // namespace policy |
| OLD | NEW |