| 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..d70fbe6904bdb6194646117cb348c6b181788495
|
| --- /dev/null
|
| +++ b/components/policy/core/common/policy_provider_android.cc
|
| @@ -0,0 +1,61 @@
|
| +// 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() {}
|
| +
|
| +// 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_;
|
| +}
|
| +
|
| +void PolicyProviderAndroid::RefreshPolicies() {
|
| + if (delegate_) {
|
| + delegate_->RefreshPolicies();
|
| + } else {
|
| + // If we don't have a delegate, pass a copy of the current policies.
|
| + scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
|
| + bundle->CopyFrom(policies());
|
| + UpdatePolicy(bundle.Pass());
|
| + }
|
| +}
|
| +
|
| +} // namespace policy
|
|
|