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

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

Issue 10449071: Enable user policy handling through the new cloud policy stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 6 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
(Empty)
1 // Copyright (c) 2012 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/policy/proxy_policy_provider.h"
6
7 #include "policy/policy_constants.h"
8
9 namespace policy {
10
11 ProxyPolicyProvider::ProxyPolicyProvider()
12 : ConfigurationPolicyProvider(GetChromePolicyDefinitionList()) {}
13
14 ProxyPolicyProvider::~ProxyPolicyProvider() {}
15
16 void ProxyPolicyProvider::SetDelegate(ConfigurationPolicyProvider* delegate) {
17 if (delegate) {
18 registrar_.reset(new ConfigurationPolicyObserverRegistrar());
19 registrar_->Init(delegate, this);
20 OnUpdatePolicy(delegate);
21 } else {
22 registrar_.reset();
23 UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
24 }
25 }
26
27 void ProxyPolicyProvider::RefreshPolicies() {
28 if (registrar_.get())
29 registrar_->provider()->RefreshPolicies();
30 else
31 UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
32 }
33
34 void ProxyPolicyProvider::OnUpdatePolicy(
35 ConfigurationPolicyProvider* provider) {
36 DCHECK_EQ(registrar_->provider(), provider);
37 scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
38 bundle->CopyFrom(registrar_->provider()->policies());
39 UpdatePolicy(bundle.Pass());
40 }
41
42 void ProxyPolicyProvider::OnProviderGoingAway(
43 ConfigurationPolicyProvider* provider) {
44 registrar_.reset();
45 UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
46 }
47
48 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/proxy_policy_provider.h ('k') | chrome/browser/policy/proxy_policy_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698