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

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

Issue 5562002: Refactor FileBasedPolicyProvider, introduce AsynchronousPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback 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 #ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
7 #pragma once
8
9 #include "base/ref_counted.h"
10 #include "base/weak_ptr.h"
11 #include "chrome/browser/policy/configuration_policy_provider.h"
12
13 namespace policy {
14
15 class AsynchronousPolicyLoader;
16
17 // Policy provider that loads policy asynchronously. Providers should subclass
18 // from this class if loading the policy requires disk access or must for some
19 // other reason be performed on the file thread. The actual logic for loading
20 // policy is handled by a delegate passed at construction time.
21 class AsynchronousPolicyProvider
22 : public ConfigurationPolicyProvider,
23 public base::SupportsWeakPtr<AsynchronousPolicyProvider> {
24 public:
25 // Must be implemented by subclasses of the asynchronous policy provider to
26 // provide the implementation details of how policy is loaded.
27 class Delegate {
28 public:
29 virtual ~Delegate() {}
30
31 virtual DictionaryValue* Load() = 0;
32 };
33
34 // Assumes ownership of |loader|.
35 AsynchronousPolicyProvider(
36 const PolicyDefinitionList* policy_list,
37 scoped_refptr<AsynchronousPolicyLoader> loader);
38 virtual ~AsynchronousPolicyProvider();
39
40 // ConfigurationPolicyProvider implementation.
41 virtual bool Provide(ConfigurationPolicyStoreInterface* store);
42
43 // For tests to trigger reloads.
44 scoped_refptr<AsynchronousPolicyLoader> loader();
45
46 protected:
47 // The loader object used internally.
48 scoped_refptr<AsynchronousPolicyLoader> loader_;
49
50 private:
51 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider);
52 };
53
54 } // namespace policy
55
56 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698