OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/policy/configuration_policy_provider_win.h" | 5 #include "chrome/browser/policy/configuration_policy_provider_win.h" |
6 | 6 |
7 #include <userenv.h> | 7 #include <userenv.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin() { | 56 ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin() { |
57 watcher_.reset(new GroupPolicyChangeWatcher(this)); | 57 watcher_.reset(new GroupPolicyChangeWatcher(this)); |
58 } | 58 } |
59 | 59 |
60 bool ConfigurationPolicyProviderWin::GetRegistryPolicyString( | 60 bool ConfigurationPolicyProviderWin::GetRegistryPolicyString( |
61 const string16& name, string16* result) { | 61 const string16& name, string16* result) { |
62 string16 path = string16(policy::kRegistrySubKey); | 62 string16 path = string16(policy::kRegistrySubKey); |
63 RegKey policy_key; | 63 RegKey policy_key; |
64 // First try the global policy. | 64 // First try the global policy. |
65 if (policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str(), KEY_READ)) { | 65 if (policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str())) { |
66 if (ReadRegistryStringValue(&policy_key, name, result)) | 66 if (ReadRegistryStringValue(&policy_key, name, result)) |
67 return true; | 67 return true; |
68 policy_key.Close(); | 68 policy_key.Close(); |
69 } | 69 } |
70 // Fall back on user-specific policy. | 70 // Fall back on user-specific policy. |
71 if (!policy_key.Open(HKEY_CURRENT_USER, path.c_str())) | 71 if (!policy_key.Open(HKEY_CURRENT_USER, path.c_str())) |
72 return false; | 72 return false; |
73 return ReadRegistryStringValue(&policy_key, name, result); | 73 return ReadRegistryStringValue(&policy_key, name, result); |
74 } | 74 } |
75 | 75 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 break; | 188 break; |
189 } | 189 } |
190 default: | 190 default: |
191 NOTREACHED(); | 191 NOTREACHED(); |
192 return false; | 192 return false; |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 return true; | 196 return true; |
197 } | 197 } |
OLD | NEW |