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

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

Issue 22493010: policy: load JSON schema into domain descriptor at start time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments and clean up includes Created 7 years, 3 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
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"
(...skipping 12 matching lines...) Expand all
23 23
24 // A policy provider that loads its policies asynchronously on a background 24 // A policy provider that loads its policies asynchronously on a background
25 // thread. Platform-specific providers are created by passing an implementation 25 // thread. Platform-specific providers are created by passing an implementation
26 // of AsyncPolicyLoader to a new AsyncPolicyProvider. 26 // of AsyncPolicyLoader to a new AsyncPolicyProvider.
27 class AsyncPolicyProvider : public ConfigurationPolicyProvider, 27 class AsyncPolicyProvider : public ConfigurationPolicyProvider,
28 public base::NonThreadSafe { 28 public base::NonThreadSafe {
29 public: 29 public:
30 explicit AsyncPolicyProvider(scoped_ptr<AsyncPolicyLoader> loader); 30 explicit AsyncPolicyProvider(scoped_ptr<AsyncPolicyLoader> loader);
31 virtual ~AsyncPolicyProvider(); 31 virtual ~AsyncPolicyProvider();
32 32
33 // Perform a synchronous load after construction.
34 virtual void InitialLoad() OVERRIDE;
35
33 // ConfigurationPolicyProvider implementation. 36 // ConfigurationPolicyProvider implementation.
34 virtual void Init() OVERRIDE; 37 virtual void Init() OVERRIDE;
35 virtual void Shutdown() OVERRIDE; 38 virtual void Shutdown() OVERRIDE;
36 virtual void RefreshPolicies() OVERRIDE; 39 virtual void RefreshPolicies() OVERRIDE;
37 virtual void RegisterPolicyDomain( 40 virtual void RegisterPolicyDomain(
38 scoped_refptr<const PolicyDomainDescriptor> descriptor) OVERRIDE; 41 scoped_refptr<const PolicyDomainDescriptor> descriptor) OVERRIDE;
42 virtual void InitialRegisterPolicyDomain(
43 scoped_refptr<const PolicyDomainDescriptor> descriptor) OVERRIDE;
39 44
40 private: 45 private:
41 // Helper for RefreshPolicies(). 46 // Helper for RefreshPolicies().
42 void ReloadAfterRefreshSync(); 47 void ReloadAfterRefreshSync();
43 48
44 // Invoked with the latest bundle loaded by the |loader_|. 49 // Invoked with the latest bundle loaded by the |loader_|.
45 void OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle); 50 void OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle);
46 51
47 // Callback passed to the loader that it uses to pass back the current policy 52 // 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 53 // 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 68 // Callback used to synchronize RefreshPolicies() calls with the background
64 // thread. See the implementation for the details. 69 // thread. See the implementation for the details.
65 base::CancelableClosure refresh_callback_; 70 base::CancelableClosure refresh_callback_;
66 71
67 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); 72 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider);
68 }; 73 };
69 74
70 } // namespace policy 75 } // namespace policy
71 76
72 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ 77 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698