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

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

Issue 3205007: Remove the default argument from RegKey::Open. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: fix nit Created 10 years, 4 months 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
« no previous file with comments | « chrome/browser/platform_util_win.cc ('k') | webkit/glue/plugins/webplugin_delegate_impl_win.cc » ('j') | 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
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 string16 location = string16(policy::kRegistrySubKey); 66 string16 location = string16(policy::kRegistrySubKey);
67 string16 value_name = name; 67 string16 value_name = name;
68 68
69 if (index > 0) { 69 if (index > 0) {
70 // This is a list value, treat |name| as a subkey. 70 // This is a list value, treat |name| as a subkey.
71 location += ASCIIToUTF16("\\") + name; 71 location += ASCIIToUTF16("\\") + name;
72 value_name = base::IntToString16(index); 72 value_name = base::IntToString16(index);
73 } 73 }
74 74
75 // First try the global policy. 75 // First try the global policy.
76 if (!policy_key.Open(HKEY_LOCAL_MACHINE, location.c_str()) || 76 if (!policy_key.Open(HKEY_LOCAL_MACHINE, location.c_str(), KEY_READ) ||
77 !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) { 77 !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) {
78 policy_key.Close(); 78 policy_key.Close();
79 // Fall back on user-specific policy. 79 // Fall back on user-specific policy.
80 if (!policy_key.Open(HKEY_CURRENT_USER, location.c_str()) || 80 if (!policy_key.Open(HKEY_CURRENT_USER, location.c_str(), KEY_READ) ||
81 !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) { 81 !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) {
82 return false; 82 return false;
83 } 83 }
84 } 84 }
85 85
86 if (key_type != REG_SZ) 86 if (key_type != REG_SZ)
87 return false; 87 return false;
88 88
89 // According to the Microsoft documentation, the string 89 // According to the Microsoft documentation, the string
90 // buffer may not be explicitly 0-terminated. Allocate a 90 // buffer may not be explicitly 0-terminated. Allocate a
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 break; 180 break;
181 } 181 }
182 default: 182 default:
183 NOTREACHED(); 183 NOTREACHED();
184 return false; 184 return false;
185 } 185 }
186 } 186 }
187 187
188 return true; 188 return true;
189 } 189 }
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_win.cc ('k') | webkit/glue/plugins/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698