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

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

Issue 1692011: Implementation of managed policy: Policy Abstraction (Closed)
Patch Set: check no changes 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_pref_store.h"
6
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "chrome/browser/configuration_policy_provider.h"
10 #include "chrome/common/pref_names.h"
11
12 const ConfigurationPolicyPrefStore::PolicyToPreferenceMapEntry
13 ConfigurationPolicyPrefStore::simple_policy_map_[] = {
14 { Value::TYPE_STRING, kPolicyHomePage, prefs::kHomePage },
15 { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage,
16 prefs::kHomePageIsNewTabPage },
17 { Value::TYPE_INTEGER, kPolicyCookiesEnabled, prefs::kCookieBehavior }
18 };
19
20 ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
21 ConfigurationPolicyProvider* provider)
22 : provider_(provider),
23 prefs_(new DictionaryValue()) {
24 }
25
26 PrefStore::PrefReadError ConfigurationPolicyPrefStore::ReadPrefs() {
27 return provider_->Provide(this) ? PrefStore::PREF_READ_ERROR_NONE :
28 PrefStore::PREF_READ_ERROR_OTHER;
29 }
30
31 void ConfigurationPolicyPrefStore::Apply(PolicyType policy, Value* value) {
32 const PolicyToPreferenceMapEntry* end =
33 simple_policy_map_ + arraysize(simple_policy_map_);
34 for (const PolicyToPreferenceMapEntry* current = simple_policy_map_;
35 current != end; ++current) {
36 if (current->policy_type == policy) {
37 DCHECK(current->value_type == value->GetType());
38 prefs_->Set(current->preference_path, value);
39 return;
40 }
41 }
42
43 // Other policy implementations go here.
44 NOTIMPLEMENTED();
45 }
46
OLDNEW
« no previous file with comments | « chrome/browser/configuration_policy_pref_store.h ('k') | chrome/browser/configuration_policy_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698