| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #include "chrome/browser/configuration_policy_provider.h" | 
|  | 6 | 
|  | 7 #include "base/values.h" | 
|  | 8 #include "chrome/browser/configuration_policy_store.h" | 
|  | 9 | 
|  | 10 namespace { | 
|  | 11 | 
|  | 12 struct PolicyValueTreeMappingEntry { | 
|  | 13   ConfigurationPolicyStore::PolicyType policy_type; | 
|  | 14   Value::ValueType value_type; | 
|  | 15   const wchar_t* const name; | 
|  | 16 }; | 
|  | 17 | 
|  | 18 const PolicyValueTreeMappingEntry kPolicyValueTreeMapping[] = { | 
|  | 19   { ConfigurationPolicyStore::kPolicyHomePage, | 
|  | 20     Value::TYPE_STRING, L"homepage" }, | 
|  | 21   { ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage, | 
|  | 22     Value::TYPE_BOOLEAN, L"homepage_is_newtabpage" }, | 
|  | 23   { ConfigurationPolicyStore::kPolicyCookiesEnabled, | 
|  | 24     Value::TYPE_BOOLEAN, L"cookies_enabled" } | 
|  | 25 }; | 
|  | 26 | 
|  | 27 } | 
|  | 28 | 
|  | 29 void DecodePolicyValueTree(DictionaryValue* policies, | 
|  | 30                            ConfigurationPolicyStore* store) { | 
|  | 31   for (size_t i = 0; i < arraysize(kPolicyValueTreeMapping); ++i) { | 
|  | 32     const PolicyValueTreeMappingEntry& entry(kPolicyValueTreeMapping[i]); | 
|  | 33     Value* value; | 
|  | 34     if (policies->Get(entry.name, &value) && value->IsType(entry.value_type)) | 
|  | 35       store->Apply(entry.policy_type, value->DeepCopy()); | 
|  | 36   } | 
|  | 37 | 
|  | 38   // TODO (mnissler) Handle preference overrides once |ConfigurationPolicyStore| | 
|  | 39   // supports it. | 
|  | 40 } | 
| OLD | NEW | 
|---|