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

Side by Side Diff: chrome/browser/configuration_policy_provider.cc

Issue 2027010: Preference provider implementation backed by JSON files in a directory. (Closed)
Patch Set: A few more fixes. Created 10 years, 7 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
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « chrome/browser/configuration_policy_provider.h ('k') | chrome/browser/mock_configuration_policy_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698