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

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

Issue 10386097: Refactored ConfigurationPolicyProvider to provide PolicyBundles instead of PolicyMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 7 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 | Annotate | Revision Log
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_CLOUD_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/browser/policy/cloud_policy_cache_base.h" 12 #include "chrome/browser/policy/cloud_policy_cache_base.h"
13 #include "chrome/browser/policy/configuration_policy_provider.h" 13 #include "chrome/browser/policy/configuration_policy_provider.h"
14 #include "chrome/browser/policy/policy_map.h"
15 14
16 namespace policy { 15 namespace policy {
17 16
18 class BrowserPolicyConnector; 17 class BrowserPolicyConnector;
19 18
20 // A policy provider that merges the policies contained in the caches it 19 // A policy provider that merges the policies contained in the caches it
21 // observes. The caches receive their policies by fetching them from the cloud, 20 // observes. The caches receive their policies by fetching them from the cloud,
22 // through the CloudPolicyController. 21 // through the CloudPolicyController.
23 class CloudPolicyProvider : public ConfigurationPolicyProvider, 22 class CloudPolicyProvider : public ConfigurationPolicyProvider,
24 public CloudPolicyCacheBase::Observer { 23 public CloudPolicyCacheBase::Observer {
25 public: 24 public:
26 CloudPolicyProvider(BrowserPolicyConnector* browser_policy_connector, 25 CloudPolicyProvider(BrowserPolicyConnector* browser_policy_connector,
27 const PolicyDefinitionList* policy_list, 26 const PolicyDefinitionList* policy_list,
28 PolicyLevel level); 27 PolicyLevel level);
29 virtual ~CloudPolicyProvider(); 28 virtual ~CloudPolicyProvider();
30 29
31 // Sets the user policy cache. This must be invoked only once, and |cache| 30 // Sets the user policy cache. This must be invoked only once, and |cache|
32 // must not be NULL. 31 // must not be NULL.
33 void SetUserPolicyCache(CloudPolicyCacheBase* cache); 32 void SetUserPolicyCache(CloudPolicyCacheBase* cache);
34 33
35 #if defined(OS_CHROMEOS) 34 #if defined(OS_CHROMEOS)
36 // Sets the device policy cache. This must be invoked only once, and |cache| 35 // Sets the device policy cache. This must be invoked only once, and |cache|
37 // must not be NULL. 36 // must not be NULL.
38 void SetDevicePolicyCache(CloudPolicyCacheBase* cache); 37 void SetDevicePolicyCache(CloudPolicyCacheBase* cache);
39 #endif 38 #endif
40 39
41 // ConfigurationPolicyProvider implementation. 40 // ConfigurationPolicyProvider implementation.
42 virtual bool ProvideInternal(PolicyMap* result) OVERRIDE;
43 virtual bool IsInitializationComplete() const OVERRIDE; 41 virtual bool IsInitializationComplete() const OVERRIDE;
44 virtual void RefreshPolicies() OVERRIDE; 42 virtual void RefreshPolicies() OVERRIDE;
45 43
46 // CloudPolicyCacheBase::Observer implementation. 44 // CloudPolicyCacheBase::Observer implementation.
47 virtual void OnCacheUpdate(CloudPolicyCacheBase* cache) OVERRIDE; 45 virtual void OnCacheUpdate(CloudPolicyCacheBase* cache) OVERRIDE;
48 virtual void OnCacheGoingAway(CloudPolicyCacheBase* cache) OVERRIDE; 46 virtual void OnCacheGoingAway(CloudPolicyCacheBase* cache) OVERRIDE;
49 47
50 private: 48 private:
51 // Indices of the known caches in |caches_|. 49 // Indices of the known caches in |caches_|.
52 enum { 50 enum {
(...skipping 18 matching lines...) Expand all
71 // The policy level published by this provider. 69 // The policy level published by this provider.
72 PolicyLevel level_; 70 PolicyLevel level_;
73 71
74 // Whether all caches are present and fully initialized. 72 // Whether all caches are present and fully initialized.
75 bool initialization_complete_; 73 bool initialization_complete_;
76 74
77 // Used to determine when updates due to a RefreshPolicies() call have been 75 // Used to determine when updates due to a RefreshPolicies() call have been
78 // completed. 76 // completed.
79 std::set<const CloudPolicyCacheBase*> pending_updates_; 77 std::set<const CloudPolicyCacheBase*> pending_updates_;
80 78
81 // The currently valid combination of the caches. ProvideInternal() fills
82 // |results| with a copy of |combined_|.
83 PolicyMap combined_;
84
85 DISALLOW_COPY_AND_ASSIGN(CloudPolicyProvider); 79 DISALLOW_COPY_AND_ASSIGN(CloudPolicyProvider);
86 }; 80 };
87 81
88 } // namespace policy 82 } // namespace policy
89 83
90 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_ 84 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/asynchronous_policy_provider.cc ('k') | chrome/browser/policy/cloud_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698