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_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
16 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
20 } | 20 } |
21 | 21 |
| 22 namespace chromeos { |
| 23 class InstallAttributes; |
| 24 } |
| 25 |
22 namespace enterprise_management { | 26 namespace enterprise_management { |
23 class PolicyFetchResponse; | 27 class PolicyFetchResponse; |
24 } | 28 } |
25 | 29 |
26 namespace policy { | 30 namespace policy { |
27 | 31 |
28 class EnterpriseInstallAttributes; | |
29 | |
30 // CloudPolicyStore implementation for device policy on Chrome OS. Policy is | 32 // CloudPolicyStore implementation for device policy on Chrome OS. Policy is |
31 // stored/loaded via DBus to/from session_manager. | 33 // stored/loaded via DBus to/from session_manager. |
32 class DeviceCloudPolicyStoreChromeOS | 34 class DeviceCloudPolicyStoreChromeOS |
33 : public CloudPolicyStore, | 35 : public CloudPolicyStore, |
34 public chromeos::DeviceSettingsService::Observer { | 36 public chromeos::DeviceSettingsService::Observer { |
35 public: | 37 public: |
36 DeviceCloudPolicyStoreChromeOS( | 38 DeviceCloudPolicyStoreChromeOS( |
37 chromeos::DeviceSettingsService* device_settings_service, | 39 chromeos::DeviceSettingsService* device_settings_service, |
38 EnterpriseInstallAttributes* install_attributes, | 40 chromeos::InstallAttributes* install_attributes, |
39 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 41 scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
40 ~DeviceCloudPolicyStoreChromeOS() override; | 42 ~DeviceCloudPolicyStoreChromeOS() override; |
41 | 43 |
42 // CloudPolicyStore: | 44 // CloudPolicyStore: |
43 void Store(const enterprise_management::PolicyFetchResponse& policy) override; | 45 void Store(const enterprise_management::PolicyFetchResponse& policy) override; |
44 void Load() override; | 46 void Load() override; |
45 | 47 |
46 // Installs initial policy. This is different from Store() in that it skips | 48 // Installs initial policy. This is different from Store() in that it skips |
47 // the signature validation step against already-installed policy. The checks | 49 // the signature validation step against already-installed policy. The checks |
48 // against installation-time attributes are performed nevertheless. The result | 50 // against installation-time attributes are performed nevertheless. The result |
(...skipping 17 matching lines...) Expand all Loading... |
66 // Starts the actual store operation. | 68 // Starts the actual store operation. |
67 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator); | 69 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator); |
68 | 70 |
69 // Handles store completion operations updates status. | 71 // Handles store completion operations updates status. |
70 void OnPolicyStored(); | 72 void OnPolicyStored(); |
71 | 73 |
72 // Re-syncs policy and status from |device_settings_service_|. | 74 // Re-syncs policy and status from |device_settings_service_|. |
73 void UpdateFromService(); | 75 void UpdateFromService(); |
74 | 76 |
75 chromeos::DeviceSettingsService* device_settings_service_; | 77 chromeos::DeviceSettingsService* device_settings_service_; |
76 EnterpriseInstallAttributes* install_attributes_; | 78 chromeos::InstallAttributes* install_attributes_; |
77 | 79 |
78 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 80 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
79 | 81 |
80 // Whether enterprise enrollment validation has yet been done. | 82 // Whether enterprise enrollment validation has yet been done. |
81 bool enrollment_validation_done_; | 83 bool enrollment_validation_done_; |
82 | 84 |
83 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_; | 85 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS); | 87 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace policy | 90 } // namespace policy |
89 | 91 |
90 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ |
OLD | NEW |