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

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

Issue 6409040: New policy protobuf protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review! Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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.h" 5 #include "chrome/browser/policy/configuration_policy_provider.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 namespace policy { 9 namespace policy {
10 10
(...skipping 18 matching lines...) Expand all
29 i != policy_list->end; ++i) { 29 i != policy_list->end; ++i) {
30 Value* value; 30 Value* value;
31 if (policies->Get(i->name, &value) && value->IsType(i->value_type)) 31 if (policies->Get(i->name, &value) && value->IsType(i->value_type))
32 store->Apply(i->policy_type, value->DeepCopy()); 32 store->Apply(i->policy_type, value->DeepCopy());
33 } 33 }
34 34
35 // TODO(mnissler): Handle preference overrides once |ConfigurationPolicyStore| 35 // TODO(mnissler): Handle preference overrides once |ConfigurationPolicyStore|
36 // supports it. 36 // supports it.
37 } 37 }
38 38
39 void ConfigurationPolicyProvider::ApplyPolicyMap(
40 const PolicyMapType* policies,
41 ConfigurationPolicyStoreInterface* store) {
42 const PolicyDefinitionList* policy_list(policy_definition_list());
43 for (const PolicyDefinitionList::Entry* i = policy_list->begin;
44 i != policy_list->end; ++i) {
45 PolicyMapType::const_iterator it =
46 policies->find(i->policy_type);
47 if (it != policies->end() && it->second->IsType(i->value_type))
48 store->Apply(i->policy_type, it->second->DeepCopy());
49 }
50 }
51
39 // Class ConfigurationPolicyObserverRegistrar. 52 // Class ConfigurationPolicyObserverRegistrar.
40 53
41 ConfigurationPolicyObserverRegistrar::ConfigurationPolicyObserverRegistrar() 54 ConfigurationPolicyObserverRegistrar::ConfigurationPolicyObserverRegistrar()
42 : provider_(NULL), 55 : provider_(NULL),
43 observer_(NULL) {} 56 observer_(NULL) {}
44 57
45 ConfigurationPolicyObserverRegistrar::~ConfigurationPolicyObserverRegistrar() { 58 ConfigurationPolicyObserverRegistrar::~ConfigurationPolicyObserverRegistrar() {
46 if (provider_) 59 if (provider_)
47 provider_->RemoveObserver(this); 60 provider_->RemoveObserver(this);
48 } 61 }
(...skipping 10 matching lines...) Expand all
59 observer_->OnUpdatePolicy(); 72 observer_->OnUpdatePolicy();
60 } 73 }
61 74
62 void ConfigurationPolicyObserverRegistrar::OnProviderGoingAway() { 75 void ConfigurationPolicyObserverRegistrar::OnProviderGoingAway() {
63 observer_->OnProviderGoingAway(); 76 observer_->OnProviderGoingAway();
64 provider_->RemoveObserver(this); 77 provider_->RemoveObserver(this);
65 provider_ = NULL; 78 provider_ = NULL;
66 } 79 }
67 80
68 } // namespace policy 81 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698