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

Side by Side Diff: chrome/browser/policy/asynchronous_policy_provider.cc

Issue 5562002: Refactor FileBasedPolicyProvider, introduce AsynchronousPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with TOT Created 10 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/policy/asynchronous_policy_provider.h"
6
7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/browser/policy/asynchronous_policy_loader.h"
9
10 namespace policy {
11
12 AsynchronousPolicyProvider::AsynchronousPolicyProvider(
13 const PolicyDefinitionList* policy_list,
14 scoped_refptr<AsynchronousPolicyLoader> loader)
15 : ConfigurationPolicyProvider(policy_list),
16 loader_(loader) {
17 // TODO(danno): This explicit registration of the provider shouldn't be
18 // necessary. Instead, the PrefStore should explicitly observe preference
19 // changes that are reported during the policy change.
20 loader_->SetProvider(this);
21 loader_->Init();
22 }
23
24 AsynchronousPolicyProvider::~AsynchronousPolicyProvider() {
25 DCHECK(CalledOnValidThread());
26 loader_->Stop();
27 loader_->SetProvider(NULL);
28 }
29
30 bool AsynchronousPolicyProvider::Provide(
31 ConfigurationPolicyStoreInterface* store) {
32 DCHECK(CalledOnValidThread());
33 DCHECK(loader_->policy());
34 DecodePolicyValueTree(loader_->policy(), store);
35 return true;
36 }
37
38 scoped_refptr<AsynchronousPolicyLoader> AsynchronousPolicyProvider::loader() {
39 return loader_;
40 }
41
42 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/asynchronous_policy_provider.h ('k') | chrome/browser/policy/asynchronous_policy_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698