1 // Copyright 2014 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.
5 #include "components/policy/core/common/policy_provider_android.h"
6 #include "components/policy/core/common/policy_provider_android_delegate.h"
12 bool g_wait_for_policies
= false;
16 PolicyProviderAndroid::PolicyProviderAndroid()
18 initialized_(!g_wait_for_policies
) {}
20 PolicyProviderAndroid::~PolicyProviderAndroid() {}
23 void PolicyProviderAndroid::SetShouldWaitForPolicy(
24 bool should_wait_for_policy
) {
25 g_wait_for_policies
= should_wait_for_policy
;
28 void PolicyProviderAndroid::SetDelegate(
29 PolicyProviderAndroidDelegate
* delegate
) {
33 void PolicyProviderAndroid::SetPolicies(scoped_ptr
<PolicyBundle
> policy
) {
35 UpdatePolicy(policy
.Pass());
38 void PolicyProviderAndroid::Shutdown() {
40 delegate_
->PolicyProviderShutdown();
42 ConfigurationPolicyProvider::Shutdown();
45 bool PolicyProviderAndroid::IsInitializationComplete(
46 PolicyDomain domain
) const {
50 void PolicyProviderAndroid::RefreshPolicies() {
52 delegate_
->RefreshPolicies();
54 // If we don't have a delegate, pass a copy of the current policies.
55 scoped_ptr
<PolicyBundle
> bundle(new PolicyBundle());
56 bundle
->CopyFrom(policies());
57 UpdatePolicy(bundle
.Pass());