| OLD | NEW |
| (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 |
| OLD | NEW |