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

Side by Side 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: review 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "components/policy/core/common/policy_provider_android.h"
6 #include "components/policy/core/common/policy_provider_android_delegate.h"
7
8 namespace policy {
9
10 namespace {
11
12 bool g_wait_for_policies = false;
13
14 } // namespace
15
16 PolicyProviderAndroid::PolicyProviderAndroid()
17 : delegate_(NULL),
18 initialized_(!g_wait_for_policies) {}
19
20 PolicyProviderAndroid::~PolicyProviderAndroid() {}
21
22 // static
23 void PolicyProviderAndroid::SetShouldWaitForPolicy(
24 bool should_wait_for_policy) {
25 g_wait_for_policies = should_wait_for_policy;
26 }
27
28 void PolicyProviderAndroid::SetDelegate(
29 PolicyProviderAndroidDelegate* delegate) {
30 delegate_ = delegate;
31 }
32
33 void PolicyProviderAndroid::SetPolicies(scoped_ptr<PolicyBundle> policy) {
34 initialized_ = true;
35 UpdatePolicy(policy.Pass());
36 }
37
38 void PolicyProviderAndroid::Shutdown() {
39 if (delegate_)
40 delegate_->PolicyProviderShutdown();
41
42 ConfigurationPolicyProvider::Shutdown();
43 }
44
45 bool PolicyProviderAndroid::IsInitializationComplete(
46 PolicyDomain domain) const {
47 return initialized_;
48 }
49
50 void PolicyProviderAndroid::RefreshPolicies() {
51 if (delegate_) {
52 delegate_->RefreshPolicies();
53 } else {
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());
58 }
59 }
60
61 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698