Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: chrome/browser/policy/configuration_policy_provider_win.cc

Issue 4062002: Dynamic policy refresh support for the Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/map/list/, nits. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 Reload(); 149 Reload();
150 } 150 }
151 151
152 void ConfigurationPolicyProviderWin::GroupPolicyChangeWatcher:: 152 void ConfigurationPolicyProviderWin::GroupPolicyChangeWatcher::
153 WillDestroyCurrentMessageLoop() { 153 WillDestroyCurrentMessageLoop() {
154 reload_task_ = NULL; 154 reload_task_ = NULL;
155 MessageLoop::current()->RemoveDestructionObserver(this); 155 MessageLoop::current()->RemoveDestructionObserver(this);
156 } 156 }
157 157
158 ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin( 158 ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin(
159 const StaticPolicyValueMap& policy_map) 159 const PolicyDefinitionList* policy_list)
160 : ConfigurationPolicyProvider(policy_map) { 160 : ConfigurationPolicyProvider(policy_list) {
161 watcher_ = new GroupPolicyChangeWatcher(this->AsWeakPtr(), 161 watcher_ = new GroupPolicyChangeWatcher(this->AsWeakPtr(),
162 kReloadIntervalMinutes); 162 kReloadIntervalMinutes);
163 watcher_->Start(); 163 watcher_->Start();
164 } 164 }
165 165
166 ConfigurationPolicyProviderWin::~ConfigurationPolicyProviderWin() { 166 ConfigurationPolicyProviderWin::~ConfigurationPolicyProviderWin() {
167 watcher_->Stop(); 167 watcher_->Stop();
168 } 168 }
169 169
170 bool ConfigurationPolicyProviderWin::GetRegistryPolicyString( 170 bool ConfigurationPolicyProviderWin::GetRegistryPolicyString(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 RegKey hklm_policy_key(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ); 232 RegKey hklm_policy_key(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ);
233 if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) { 233 if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) {
234 *result = value; 234 *result = value;
235 return true; 235 return true;
236 } 236 }
237 return false; 237 return false;
238 } 238 }
239 239
240 bool ConfigurationPolicyProviderWin::Provide( 240 bool ConfigurationPolicyProviderWin::Provide(
241 ConfigurationPolicyStore* store) { 241 ConfigurationPolicyStore* store) {
242 const PolicyValueMap& mapping(policy_value_map()); 242 const PolicyDefinitionList* policy_list(policy_definition_list());
243 for (PolicyValueMap::const_iterator current = mapping.begin(); 243 for (const PolicyDefinitionList::Entry* current = policy_list->begin;
244 current != mapping.end(); ++current) { 244 current != policy_list->end; ++current) {
245 std::wstring name = UTF8ToWide(current->name); 245 std::wstring name = UTF8ToWide(current->name);
246 switch (current->value_type) { 246 switch (current->value_type) {
247 case Value::TYPE_STRING: { 247 case Value::TYPE_STRING: {
248 std::wstring string_value; 248 std::wstring string_value;
249 if (GetRegistryPolicyString(name.c_str(), &string_value)) { 249 if (GetRegistryPolicyString(name.c_str(), &string_value)) {
250 store->Apply(current->policy_type, 250 store->Apply(current->policy_type,
251 Value::CreateStringValue(string_value)); 251 Value::CreateStringValue(string_value));
252 } 252 }
253 break; 253 break;
254 } 254 }
(...skipping 22 matching lines...) Expand all
277 default: 277 default:
278 NOTREACHED(); 278 NOTREACHED();
279 return false; 279 return false;
280 } 280 }
281 } 281 }
282 282
283 return true; 283 return true;
284 } 284 }
285 285
286 } // namespace policy 286 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698