OLD | NEW |
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_CLOUD_POLICY_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_SERVICE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 18 #include "components/policy/policy_export.h" |
18 | 19 |
19 namespace policy { | 20 namespace policy { |
20 | 21 |
21 // Coordinates cloud policy handling, moving downloaded policy from the client | 22 // Coordinates cloud policy handling, moving downloaded policy from the client |
22 // to the store, and setting up client registrations from cached data in the | 23 // to the store, and setting up client registrations from cached data in the |
23 // store. Also coordinates actions on policy refresh triggers. | 24 // store. Also coordinates actions on policy refresh triggers. |
24 class CloudPolicyService : public CloudPolicyClient::Observer, | 25 class POLICY_EXPORT CloudPolicyService : public CloudPolicyClient::Observer, |
25 public CloudPolicyStore::Observer { | 26 public CloudPolicyStore::Observer { |
26 public: | 27 public: |
27 // Callback invoked once the policy refresh attempt has completed. Passed | 28 // Callback invoked once the policy refresh attempt has completed. Passed |
28 // bool parameter is true if the refresh was successful (no error). | 29 // bool parameter is true if the refresh was successful (no error). |
29 typedef base::Callback<void(bool)> RefreshPolicyCallback; | 30 typedef base::Callback<void(bool)> RefreshPolicyCallback; |
30 | 31 |
31 class Observer { | 32 class POLICY_EXPORT Observer { |
32 public: | 33 public: |
33 // Invoked when CloudPolicyService has finished initializing (any initial | 34 // Invoked when CloudPolicyService has finished initializing (any initial |
34 // policy load activity has completed and the CloudPolicyClient has | 35 // policy load activity has completed and the CloudPolicyClient has |
35 // been registered, if possible). | 36 // been registered, if possible). |
36 virtual void OnInitializationCompleted(CloudPolicyService* service) = 0; | 37 virtual void OnInitializationCompleted(CloudPolicyService* service) = 0; |
37 virtual ~Observer() {} | 38 virtual ~Observer() {} |
38 }; | 39 }; |
39 | 40 |
40 // |client| and |store| must remain valid for the object life time. | 41 // |client| and |store| must remain valid for the object life time. |
41 CloudPolicyService(const PolicyNamespaceKey& policy_ns_key, | 42 CloudPolicyService(const PolicyNamespaceKey& policy_ns_key, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 104 |
104 // Observers who will receive notifications when the service has finished | 105 // Observers who will receive notifications when the service has finished |
105 // initializing. | 106 // initializing. |
106 ObserverList<Observer, true> observers_; | 107 ObserverList<Observer, true> observers_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(CloudPolicyService); | 109 DISALLOW_COPY_AND_ASSIGN(CloudPolicyService); |
109 }; | 110 }; |
110 | 111 |
111 } // namespace policy | 112 } // namespace policy |
112 | 113 |
113 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_SERVICE_H_ | 114 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_SERVICE_H_ |
OLD | NEW |