OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/policy/core/common/policy_provider_android.h" | 5 #include "components/policy/core/common/policy_provider_android.h" |
6 #include "components/policy/core/common/policy_provider_android_delegate.h" | 6 #include "components/policy/core/common/policy_provider_android_delegate.h" |
7 | 7 |
8 namespace policy { | 8 namespace policy { |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 // static | 27 // static |
28 void PolicyProviderAndroid::SetShouldWaitForPolicy( | 28 void PolicyProviderAndroid::SetShouldWaitForPolicy( |
29 bool should_wait_for_policy) { | 29 bool should_wait_for_policy) { |
30 g_wait_for_policies = should_wait_for_policy; | 30 g_wait_for_policies = should_wait_for_policy; |
31 } | 31 } |
32 | 32 |
33 void PolicyProviderAndroid::SetDelegate( | 33 void PolicyProviderAndroid::SetDelegate( |
34 PolicyProviderAndroidDelegate* delegate) { | 34 PolicyProviderAndroidDelegate* delegate) { |
| 35 DCHECK(!delegate || !delegate_); |
35 delegate_ = delegate; | 36 delegate_ = delegate; |
36 } | 37 } |
37 | 38 |
38 void PolicyProviderAndroid::SetPolicies(scoped_ptr<PolicyBundle> policy) { | 39 void PolicyProviderAndroid::SetPolicies(scoped_ptr<PolicyBundle> policy) { |
39 initialized_ = true; | 40 initialized_ = true; |
40 UpdatePolicy(policy.Pass()); | 41 UpdatePolicy(policy.Pass()); |
41 } | 42 } |
42 | 43 |
43 void PolicyProviderAndroid::Shutdown() { | 44 void PolicyProviderAndroid::Shutdown() { |
44 if (delegate_) | 45 if (delegate_) |
(...skipping 12 matching lines...) Expand all Loading... |
57 delegate_->RefreshPolicies(); | 58 delegate_->RefreshPolicies(); |
58 } else { | 59 } else { |
59 // If we don't have a delegate, pass a copy of the current policies. | 60 // If we don't have a delegate, pass a copy of the current policies. |
60 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 61 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
61 bundle->CopyFrom(policies()); | 62 bundle->CopyFrom(policies()); |
62 UpdatePolicy(bundle.Pass()); | 63 UpdatePolicy(bundle.Pass()); |
63 } | 64 } |
64 } | 65 } |
65 | 66 |
66 } // namespace policy | 67 } // namespace policy |
OLD | NEW |