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

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

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "chrome/browser/policy/configuration_policy_provider.h" 13 #include "chrome/browser/policy/configuration_policy_provider.h"
14 14
15 namespace base { 15 namespace base {
16 class MessageLoopProxy; 16 class MessageLoopProxy;
17 } 17 }
18 18
19 namespace policy { 19 namespace policy {
20 20
21 class AsyncPolicyLoader; 21 class AsyncPolicyLoader;
22 class PolicyBundle; 22 class PolicyBundle;
23 class SchemaRegistry;
23 24
24 // A policy provider that loads its policies asynchronously on a background 25 // A policy provider that loads its policies asynchronously on a background
25 // thread. Platform-specific providers are created by passing an implementation 26 // thread. Platform-specific providers are created by passing an implementation
26 // of AsyncPolicyLoader to a new AsyncPolicyProvider. 27 // of AsyncPolicyLoader to a new AsyncPolicyProvider.
27 class AsyncPolicyProvider : public ConfigurationPolicyProvider, 28 class AsyncPolicyProvider : public ConfigurationPolicyProvider,
28 public base::NonThreadSafe { 29 public base::NonThreadSafe {
29 public: 30 public:
30 explicit AsyncPolicyProvider(scoped_ptr<AsyncPolicyLoader> loader); 31 // The AsyncPolicyProvider does a synchronous load in its constructor, and
32 // therefore it needs the |registry| at construction time. The same |registry|
33 // should be passed later to Init().
34 AsyncPolicyProvider(SchemaRegistry* registry,
35 scoped_ptr<AsyncPolicyLoader> loader);
31 virtual ~AsyncPolicyProvider(); 36 virtual ~AsyncPolicyProvider();
32 37
33 // ConfigurationPolicyProvider implementation. 38 // ConfigurationPolicyProvider implementation.
34 virtual void Init() OVERRIDE; 39 virtual void Init(SchemaRegistry* registry) OVERRIDE;
35 virtual void Shutdown() OVERRIDE; 40 virtual void Shutdown() OVERRIDE;
36 virtual void RefreshPolicies() OVERRIDE; 41 virtual void RefreshPolicies() OVERRIDE;
37 virtual void RegisterPolicyDomain(
38 scoped_refptr<const PolicyDomainDescriptor> descriptor) OVERRIDE;
39 42
40 private: 43 private:
41 // Helper for RefreshPolicies(). 44 // Helper for RefreshPolicies().
42 void ReloadAfterRefreshSync(); 45 void ReloadAfterRefreshSync();
43 46
44 // Invoked with the latest bundle loaded by the |loader_|. 47 // Invoked with the latest bundle loaded by the |loader_|.
45 void OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle); 48 void OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle);
46 49
47 // Callback passed to the loader that it uses to pass back the current policy 50 // Callback passed to the loader that it uses to pass back the current policy
48 // bundle to the provider. This is invoked on the background thread and 51 // bundle to the provider. This is invoked on the background thread and
(...skipping 14 matching lines...) Expand all
63 // Callback used to synchronize RefreshPolicies() calls with the background 66 // Callback used to synchronize RefreshPolicies() calls with the background
64 // thread. See the implementation for the details. 67 // thread. See the implementation for the details.
65 base::CancelableClosure refresh_callback_; 68 base::CancelableClosure refresh_callback_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); 70 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider);
68 }; 71 };
69 72
70 } // namespace policy 73 } // namespace policy
71 74
72 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ 75 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/async_policy_loader.cc ('k') | chrome/browser/policy/async_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698