OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_delegate_win.h" | 5 #include "chrome/browser/policy/configuration_policy_provider_delegate_win.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 key->ReadValue(name.c_str(), buffer.get(), &value_size, NULL); | 39 key->ReadValue(name.c_str(), buffer.get(), &value_size, NULL); |
40 result->assign(reinterpret_cast<const wchar_t*>(buffer.get())); | 40 result->assign(reinterpret_cast<const wchar_t*>(buffer.get())); |
41 return true; | 41 return true; |
42 } | 42 } |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 namespace policy { | 46 namespace policy { |
47 | 47 |
48 ConfigurationPolicyProviderDelegateWin::ConfigurationPolicyProviderDelegateWin( | 48 ConfigurationPolicyProviderDelegateWin::ConfigurationPolicyProviderDelegateWin( |
49 const ConfigurationPolicyProvider::PolicyDefinitionList* | 49 const PolicyDefinitionList* policy_definition_list) |
50 policy_definition_list) | |
51 : policy_definition_list_(policy_definition_list) { | 50 : policy_definition_list_(policy_definition_list) { |
52 } | 51 } |
53 | 52 |
54 DictionaryValue* ConfigurationPolicyProviderDelegateWin::Load() { | 53 DictionaryValue* ConfigurationPolicyProviderDelegateWin::Load() { |
55 DictionaryValue* result = new DictionaryValue(); | 54 DictionaryValue* result = new DictionaryValue(); |
56 const ConfigurationPolicyProvider::PolicyDefinitionList::Entry* current; | 55 const PolicyDefinitionList::Entry* current; |
57 for (current = policy_definition_list_->begin; | 56 for (current = policy_definition_list_->begin; |
58 current != policy_definition_list_->end; | 57 current != policy_definition_list_->end; |
59 ++current) { | 58 ++current) { |
60 const string16 name(ASCIIToUTF16(current->name)); | 59 const string16 name(ASCIIToUTF16(current->name)); |
61 switch (current->value_type) { | 60 switch (current->value_type) { |
62 case Value::TYPE_STRING: { | 61 case Value::TYPE_STRING: { |
63 string16 string_value; | 62 string16 string_value; |
64 if (GetRegistryPolicyString(name, &string_value)) { | 63 if (GetRegistryPolicyString(name, &string_value)) { |
65 result->SetString(current->name, string_value); | 64 result->SetString(current->name, string_value); |
66 } | 65 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ERROR_SUCCESS) { | 149 ERROR_SUCCESS) { |
151 if (policy_key.ReadValueDW(value_name.c_str(), &value) == ERROR_SUCCESS) { | 150 if (policy_key.ReadValueDW(value_name.c_str(), &value) == ERROR_SUCCESS) { |
152 *result = value; | 151 *result = value; |
153 return true; | 152 return true; |
154 } | 153 } |
155 } | 154 } |
156 return false; | 155 return false; |
157 } | 156 } |
158 | 157 |
159 } // namespace policy | 158 } // namespace policy |
OLD | NEW |