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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 machine_policy_watcher_failed_ = true; | 107 machine_policy_watcher_failed_ = true; |
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 std::wstring value_name_wide = UTF8ToWide(value_name); | 118 std::wstring value_name_wide = UTF8ToWide(value_name); |
119 // presubmit: allow wstring | |
118 std::wstring value; | 120 std::wstring value; |
119 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); | 121 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); |
120 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == | 122 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == |
121 ERROR_SUCCESS) { | 123 ERROR_SUCCESS) { |
122 *result = WideToUTF8(value); | 124 *result = WideToUTF8(value); |
Wez
2012/08/06 18:33:18
Here.
alexeypa (please no reviews)
2012/08/06 19:31:54
RegKey's using wchar_t*.
| |
123 return true; | 125 return true; |
124 } | 126 } |
125 | 127 |
126 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == | 128 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == |
127 ERROR_SUCCESS) { | 129 ERROR_SUCCESS) { |
128 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == | 130 if (policy_key.ReadValue(value_name_wide.c_str(), &value) == |
129 ERROR_SUCCESS) { | 131 ERROR_SUCCESS) { |
130 *result = WideToUTF8(value); | 132 *result = WideToUTF8(value); |
Wez
2012/08/06 18:33:18
Here.
alexeypa (please no reviews)
2012/08/06 19:31:54
RegKey's using wchar_t*.
| |
131 return true; | 133 return true; |
132 } | 134 } |
133 } | 135 } |
134 return false; | 136 return false; |
135 } | 137 } |
136 | 138 |
137 bool GetRegistryPolicyInteger(const std::string& value_name, | 139 bool GetRegistryPolicyInteger(const std::string& value_name, |
138 uint32* result) const { | 140 uint32* result) const { |
141 // presubmit: allow wstring | |
139 std::wstring value_name_wide = UTF8ToWide(value_name); | 142 std::wstring value_name_wide = UTF8ToWide(value_name); |
Wez
2012/08/06 18:33:18
Here.
alexeypa (please no reviews)
2012/08/06 19:31:54
RegKey's using wchar_t*.
| |
140 DWORD value = 0; | 143 DWORD value = 0; |
141 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); | 144 RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ); |
142 if (policy_key.ReadValueDW(value_name_wide.c_str(), &value) == | 145 if (policy_key.ReadValueDW(value_name_wide.c_str(), &value) == |
143 ERROR_SUCCESS) { | 146 ERROR_SUCCESS) { |
144 *result = value; | 147 *result = value; |
145 return true; | 148 return true; |
146 } | 149 } |
147 | 150 |
148 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == | 151 if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) == |
149 ERROR_SUCCESS) { | 152 ERROR_SUCCESS) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 bool machine_policy_watcher_failed_; | 214 bool machine_policy_watcher_failed_; |
212 }; | 215 }; |
213 | 216 |
214 PolicyWatcher* PolicyWatcher::Create( | 217 PolicyWatcher* PolicyWatcher::Create( |
215 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 218 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
216 return new PolicyWatcherWin(task_runner); | 219 return new PolicyWatcherWin(task_runner); |
217 } | 220 } |
218 | 221 |
219 } // namespace policy_hack | 222 } // namespace policy_hack |
220 } // namespace remoting | 223 } // namespace remoting |
OLD | NEW |