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

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

Issue 5762002: Policy refresh hits the registry (an I/O operation) on the main thread.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/object_watcher.h" 12 #include "base/object_watcher.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/sys_string_conversions.h" 17 #include "base/sys_string_conversions.h"
18 #include "base/thread_restrictions.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "base/win/registry.h" 21 #include "base/win/registry.h"
21 #include "chrome/common/policy_constants.h" 22 #include "chrome/common/policy_constants.h"
22 23
23 using base::win::RegKey; 24 using base::win::RegKey;
24 25
25 namespace policy { 26 namespace policy {
26 27
27 namespace { 28 namespace {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 RegKey hklm_policy_key(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ); 235 RegKey hklm_policy_key(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ);
235 if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) { 236 if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) {
236 *result = value; 237 *result = value;
237 return true; 238 return true;
238 } 239 }
239 return false; 240 return false;
240 } 241 }
241 242
242 bool ConfigurationPolicyProviderWin::Provide( 243 bool ConfigurationPolicyProviderWin::Provide(
243 ConfigurationPolicyStoreInterface* store) { 244 ConfigurationPolicyStoreInterface* store) {
245 // This function calls GetRegistryPolicy* which hit up the registry. Those
246 // are I/O functions not allowed to be called on the main thread.
247 // http://crbug.com/66453
248 base::ThreadRestrictions::ScopedAllowIO allow_io;
danno 2010/12/10 22:19:56 I don't think this is needed. Provide only gets ca
244 const PolicyDefinitionList* policy_list(policy_definition_list()); 249 const PolicyDefinitionList* policy_list(policy_definition_list());
245 for (const PolicyDefinitionList::Entry* current = policy_list->begin; 250 for (const PolicyDefinitionList::Entry* current = policy_list->begin;
246 current != policy_list->end; ++current) { 251 current != policy_list->end; ++current) {
247 std::wstring name = UTF8ToWide(current->name); 252 std::wstring name = UTF8ToWide(current->name);
248 switch (current->value_type) { 253 switch (current->value_type) {
249 case Value::TYPE_STRING: { 254 case Value::TYPE_STRING: {
250 std::wstring string_value; 255 std::wstring string_value;
251 if (GetRegistryPolicyString(name.c_str(), &string_value)) { 256 if (GetRegistryPolicyString(name.c_str(), &string_value)) {
252 store->Apply(current->policy_type, 257 store->Apply(current->policy_type,
253 Value::CreateStringValue(string_value)); 258 Value::CreateStringValue(string_value));
(...skipping 25 matching lines...) Expand all
279 default: 284 default:
280 NOTREACHED(); 285 NOTREACHED();
281 return false; 286 return false;
282 } 287 }
283 } 288 }
284 289
285 return true; 290 return true;
286 } 291 }
287 292
288 } // namespace policy 293 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698