OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/policy/asynchronous_policy_provider.h" | 5 #include "chrome/browser/policy/asynchronous_policy_provider.h" |
6 | 6 |
7 #include "chrome/browser/policy/asynchronous_policy_loader.h" | 7 #include "chrome/browser/policy/asynchronous_policy_loader.h" |
8 | 8 |
9 namespace policy { | 9 namespace policy { |
10 | 10 |
11 AsynchronousPolicyProvider::AsynchronousPolicyProvider( | 11 AsynchronousPolicyProvider::AsynchronousPolicyProvider( |
12 const PolicyDefinitionList* policy_list, | 12 const PolicyDefinitionList* policy_list, |
13 scoped_refptr<AsynchronousPolicyLoader> loader) | 13 scoped_refptr<AsynchronousPolicyLoader> loader) |
14 : ConfigurationPolicyProvider(policy_list), | 14 : ConfigurationPolicyProvider(policy_list), |
15 loader_(loader) { | 15 loader_(loader) { |
16 loader_->Init(); | 16 loader_->Init(); |
17 } | 17 } |
18 | 18 |
19 AsynchronousPolicyProvider::~AsynchronousPolicyProvider() { | 19 AsynchronousPolicyProvider::~AsynchronousPolicyProvider() { |
20 DCHECK(CalledOnValidThread()); | 20 DCHECK(CalledOnValidThread()); |
21 loader_->Stop(); | 21 loader_->Stop(); |
22 } | 22 } |
23 | 23 |
24 bool AsynchronousPolicyProvider::Provide( | 24 bool AsynchronousPolicyProvider::Provide( |
25 ConfigurationPolicyStoreInterface* store) { | 25 ConfigurationPolicyStoreInterface* store) { |
26 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
27 DCHECK(loader_->policy()); | 27 DCHECK(loader_->policy()); |
28 DecodePolicyValueTree(loader_->policy(), store); | 28 ApplyPolicyValueTree(loader_->policy(), store); |
29 return true; | 29 return true; |
30 } | 30 } |
31 | 31 |
32 void AsynchronousPolicyProvider::AddObserver( | 32 void AsynchronousPolicyProvider::AddObserver( |
33 ConfigurationPolicyProvider::Observer* observer) { | 33 ConfigurationPolicyProvider::Observer* observer) { |
34 loader_->AddObserver(observer); | 34 loader_->AddObserver(observer); |
35 } | 35 } |
36 | 36 |
37 void AsynchronousPolicyProvider::RemoveObserver( | 37 void AsynchronousPolicyProvider::RemoveObserver( |
38 ConfigurationPolicyProvider::Observer* observer) { | 38 ConfigurationPolicyProvider::Observer* observer) { |
39 loader_->RemoveObserver(observer); | 39 loader_->RemoveObserver(observer); |
40 } | 40 } |
41 | 41 |
42 scoped_refptr<AsynchronousPolicyLoader> AsynchronousPolicyProvider::loader() { | 42 scoped_refptr<AsynchronousPolicyLoader> AsynchronousPolicyProvider::loader() { |
43 return loader_; | 43 return loader_; |
44 } | 44 } |
45 | 45 |
46 } // namespace policy | 46 } // namespace policy |
OLD | NEW |