OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Most of this code is copied from various classes in | 5 // Most of this code is copied from various classes in |
6 // src/chrome/browser/policy. In particular, look at | 6 // src/chrome/browser/policy. In particular, look at |
7 // | 7 // |
8 // configuration_policy_provider_delegate_win.{h,cc} | 8 // configuration_policy_provider_delegate_win.{h,cc} |
9 // configuration_policy_loader_win.{h,cc} | 9 // configuration_policy_loader_win.{h,cc} |
10 // | 10 // |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 if (user_policy_watcher_failed_ || machine_policy_watcher_failed_) { | 110 if (user_policy_watcher_failed_ || machine_policy_watcher_failed_) { |
111 ScheduleFallbackReloadTask(); | 111 ScheduleFallbackReloadTask(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 bool GetRegistryPolicyString(const std::string& value_name, | 115 bool GetRegistryPolicyString(const std::string& value_name, |
116 std::string* result) const { | 116 std::string* result) const { |
117 // presubmit: allow wstring | 117 // presubmit: allow wstring |
118 std::wstring value_name_wide = UTF8ToWide(value_name); | 118 std::wstring value_name_wide = base::UTF8ToWide(value_name); |
119 // presubmit: allow wstring | 119 // presubmit: allow wstring |
120 std::wstring value; | 120 std::wstring value; |
121 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); | 121 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); |
122 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == | 122 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == |
123 ERROR_SUCCESS) { | 123 ERROR_SUCCESS) { |
124 *result = WideToUTF8(value); | 124 *result = base::WideToUTF8(value); |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == | 128 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == |
129 ERROR_SUCCESS) { | 129 ERROR_SUCCESS) { |
130 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == | 130 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == |
131 ERROR_SUCCESS) { | 131 ERROR_SUCCESS) { |
132 *result = WideToUTF8(value); | 132 *result = base::WideToUTF8(value); |
133 return true; | 133 return true; |
134 } | 134 } |
135 } | 135 } |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 bool GetRegistryPolicyInteger(const std::string& value_name, | 139 bool GetRegistryPolicyInteger(const std::string& value_name, |
140 uint32* result) const { | 140 uint32* result) const { |
141 // presubmit: allow wstring | 141 // presubmit: allow wstring |
142 std::wstring value_name_wide = UTF8ToWide(value_name); | 142 std::wstring value_name_wide = base::UTF8ToWide(value_name); |
143 DWORD value = 0; | 143 DWORD value = 0; |
144 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); | 144 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); |
145 if (policy_key.ReadValueDW(value_name_wide.c_str(), &value) == | 145 if (policy_key.ReadValueDW(value_name_wide.c_str(), &value) == |
146 ERROR_SUCCESS) { | 146 ERROR_SUCCESS) { |
147 *result = value; | 147 *result = value; |
148 return true; | 148 return true; |
149 } | 149 } |
150 | 150 |
151 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == | 151 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == |
152 ERROR_SUCCESS) { | 152 ERROR_SUCCESS) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 bool machine_policy_watcher_failed_; | 216 bool machine_policy_watcher_failed_; |
217 }; | 217 }; |
218 | 218 |
219 PolicyWatcher* PolicyWatcher::Create( | 219 PolicyWatcher* PolicyWatcher::Create( |
220 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 220 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
221 return new PolicyWatcherWin(task_runner); | 221 return new PolicyWatcherWin(task_runner); |
222 } | 222 } |
223 | 223 |
224 } // namespace policy_hack | 224 } // namespace policy_hack |
225 } // namespace remoting | 225 } // namespace remoting |
OLD | NEW |