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

Side by Side Diff: components/policy/core/common/policy_provider_android.cc

Issue 1129323005: Check that only a single delegate for the Android PolicyProvider exists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698