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

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

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

Powered by Google App Engine
This is Rietveld 408576698