OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_COMPONENT_CLOUD_POLICY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace base { | 22 namespace base { |
23 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
28 } | 28 } |
29 | 29 |
30 namespace policy { | 30 namespace policy { |
31 | 31 |
| 32 class PolicyDomainDescriptor; |
32 class ResourceCache; | 33 class ResourceCache; |
33 | 34 |
34 // Manages cloud policy for components. | 35 // Manages cloud policy for components. |
35 // | 36 // |
36 // This class takes care of fetching, validating, storing and updating policy | 37 // This class takes care of fetching, validating, storing and updating policy |
37 // for components. The components to manage have to be explicitly registered. | 38 // for components. The components to manage have to be explicitly registered. |
38 class ComponentCloudPolicyService : public CloudPolicyClient::Observer, | 39 class ComponentCloudPolicyService : public CloudPolicyClient::Observer, |
39 public CloudPolicyStore::Observer { | 40 public CloudPolicyStore::Observer { |
40 public: | 41 public: |
41 // Key for the ResourceCache where the list of known components is cached. | 42 // Key for the ResourceCache where the list of known components is cached. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // this object. Only cached policies will be served until a |client| is | 77 // this object. Only cached policies will be served until a |client| is |
77 // connected. | 78 // connected. |
78 // |request_context| is used with the URLFetchers triggered by the updater. | 79 // |request_context| is used with the URLFetchers triggered by the updater. |
79 void Connect(CloudPolicyClient* client, | 80 void Connect(CloudPolicyClient* client, |
80 scoped_refptr<net::URLRequestContextGetter> request_context); | 81 scoped_refptr<net::URLRequestContextGetter> request_context); |
81 | 82 |
82 // Disconnects from the cloud policy service and stops trying to download | 83 // Disconnects from the cloud policy service and stops trying to download |
83 // remote policy data. | 84 // remote policy data. |
84 void Disconnect(); | 85 void Disconnect(); |
85 | 86 |
86 // |component_ids| is the complete set of components to track for the given | 87 // |descriptor| lists the complete set of components to track for its domain. |
87 // |domain|. This purges unused components from the cache, and starts | 88 // This purges unused components from the cache, and starts updating the |
88 // updating the components in |component_ids|. | 89 // components listed in the descriptor. It's only valid to call this for |
89 // It's only valid to call this for domains that are supported, i.e. | 90 // domains that are supported, i.e. SupportsDomain(domain) is true. |
90 // SupportsDomain(domain) is true. | 91 void RegisterPolicyDomain( |
91 void RegisterPolicyDomain(PolicyDomain domain, | 92 scoped_refptr<const PolicyDomainDescriptor> descriptor); |
92 const std::set<std::string>& component_ids); | |
93 | 93 |
94 // CloudPolicyClient::Observer implementation: | 94 // CloudPolicyClient::Observer implementation: |
95 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; | 95 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; |
96 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; | 96 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; |
97 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; | 97 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; |
98 | 98 |
99 // CloudPolicyStore::Observer implementation: | 99 // CloudPolicyStore::Observer implementation: |
100 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; | 100 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; |
101 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE; | 101 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE; |
102 | 102 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 bool is_initialized_; | 144 bool is_initialized_; |
145 base::WeakPtrFactory<ComponentCloudPolicyService> weak_ptr_factory_; | 145 base::WeakPtrFactory<ComponentCloudPolicyService> weak_ptr_factory_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyService); | 147 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyService); |
148 }; | 148 }; |
149 | 149 |
150 } // namespace policy | 150 } // namespace policy |
151 | 151 |
152 #endif // CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ | 152 #endif // CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
OLD | NEW |