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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/proxy_policy_provider.cc
diff --git a/chrome/browser/policy/proxy_policy_provider.cc b/chrome/browser/policy/proxy_policy_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a019b08856af7396ab578415bc74c34e459242bd
--- /dev/null
+++ b/chrome/browser/policy/proxy_policy_provider.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/policy/proxy_policy_provider.h"
+
+#include "policy/policy_constants.h"
+
+namespace policy {
+
+ProxyPolicyProvider::ProxyPolicyProvider()
+ : ConfigurationPolicyProvider(GetChromePolicyDefinitionList()) {}
+
+ProxyPolicyProvider::~ProxyPolicyProvider() {}
+
+void ProxyPolicyProvider::SetDelegate(ConfigurationPolicyProvider* delegate) {
+ if (delegate) {
+ registrar_.reset(new ConfigurationPolicyObserverRegistrar());
+ registrar_->Init(delegate, this);
+ OnUpdatePolicy(delegate);
+ } else {
+ registrar_.reset();
+ UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
+ }
+}
+
+void ProxyPolicyProvider::RefreshPolicies() {
+ if (registrar_.get())
+ registrar_->provider()->RefreshPolicies();
+ else
+ UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
+}
+
+void ProxyPolicyProvider::OnUpdatePolicy(
+ ConfigurationPolicyProvider* provider) {
+ DCHECK_EQ(registrar_->provider(), provider);
+ scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
+ bundle->CopyFrom(registrar_->provider()->policies());
+ UpdatePolicy(bundle.Pass());
+}
+
+void ProxyPolicyProvider::OnProviderGoingAway(
+ ConfigurationPolicyProvider* provider) {
+ registrar_.reset();
+ UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
+}
+
+} // namespace policy
« 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