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

Unified Diff: components/policy/core/common/policy_provider_android.cc

Issue 155923002: Add a platform policy provider for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 6 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 side-by-side diff with in-line comments
Download patch
Index: components/policy/core/common/policy_provider_android.cc
diff --git a/components/policy/core/common/policy_provider_android.cc b/components/policy/core/common/policy_provider_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..43f69606310d115c9f1fb6e5b72f79e6b71960f2
--- /dev/null
+++ b/components/policy/core/common/policy_provider_android.cc
@@ -0,0 +1,54 @@
+// Copyright 2014 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 "components/policy/core/common/policy_provider_android.h"
+#include "components/policy/core/common/policy_provider_android_delegate.h"
+
+namespace policy {
+
+namespace {
+
+bool g_wait_for_policies = false;
+
+} // namespace
+
+PolicyProviderAndroid::PolicyProviderAndroid()
+ : delegate_(NULL),
+ initialized_(!g_wait_for_policies) {}
+PolicyProviderAndroid::~PolicyProviderAndroid() {}
Joao da Silva 2014/02/05 20:22:26 nit: newline above this one
Bernhard Bauer 2014/02/06 15:00:18 Done.
+
+// static
+void PolicyProviderAndroid::SetShouldWaitForPolicy(
+ bool should_wait_for_policy) {
+ g_wait_for_policies = should_wait_for_policy;
+}
+
+void PolicyProviderAndroid::SetDelegate(
+ PolicyProviderAndroidDelegate* delegate) {
+ delegate_ = delegate;
+}
+
+void PolicyProviderAndroid::SetPolicies(scoped_ptr<PolicyBundle> policy) {
+ initialized_ = true;
+ UpdatePolicy(policy.Pass());
+}
+
+void PolicyProviderAndroid::Shutdown() {
+ if (delegate_)
+ delegate_->PolicyProviderShutdown();
+
+ ConfigurationPolicyProvider::Shutdown();
+}
+
+bool PolicyProviderAndroid::IsInitializationComplete(
+ PolicyDomain domain) const {
+ return initialized_;
Joao da Silva 2014/02/05 20:22:26 Other than the behavior of this flag, this class i
Bernhard Bauer 2014/02/05 22:20:19 Hm, so then downstream I would implement another C
+}
+
+void PolicyProviderAndroid::RefreshPolicies() {
+ if (delegate_)
+ delegate_->RefreshPolicies();
+}
Joao da Silva 2014/02/05 20:22:26 else { call UpdatePolicy() with a copy of the cu
Bernhard Bauer 2014/02/05 22:20:19 Oh, good catch! Yeah, I will do that.
Bernhard Bauer 2014/02/06 15:00:18 Done.
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698