| 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> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
| 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 15 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace enterprise_management { | 22 namespace enterprise_management { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 const enterprise_management::PolicyFetchResponse& policy); | 52 const enterprise_management::PolicyFetchResponse& policy); |
| 52 | 53 |
| 53 // chromeos::DeviceSettingsService::Observer: | 54 // chromeos::DeviceSettingsService::Observer: |
| 54 void OwnershipStatusChanged() override; | 55 void OwnershipStatusChanged() override; |
| 55 void DeviceSettingsUpdated() override; | 56 void DeviceSettingsUpdated() override; |
| 56 void OnDeviceSettingsServiceShutdown() override; | 57 void OnDeviceSettingsServiceShutdown() override; |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 // Create a validator for |policy| with basic device policy configuration and | 60 // Create a validator for |policy| with basic device policy configuration and |
| 60 // OnPolicyStored() as the completion callback. | 61 // OnPolicyStored() as the completion callback. |
| 61 scoped_ptr<DeviceCloudPolicyValidator> CreateValidator( | 62 std::unique_ptr<DeviceCloudPolicyValidator> CreateValidator( |
| 62 const enterprise_management::PolicyFetchResponse& policy); | 63 const enterprise_management::PolicyFetchResponse& policy); |
| 63 | 64 |
| 64 // Called on completion on the policy validation prior to storing policy. | 65 // Called on completion on the policy validation prior to storing policy. |
| 65 // Starts the actual store operation. | 66 // Starts the actual store operation. |
| 66 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator); | 67 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator); |
| 67 | 68 |
| 68 // Handles store completion operations updates status. | 69 // Handles store completion operations updates status. |
| 69 void OnPolicyStored(); | 70 void OnPolicyStored(); |
| 70 | 71 |
| 71 // Re-syncs policy and status from |device_settings_service_|. | 72 // Re-syncs policy and status from |device_settings_service_|. |
| 72 void UpdateFromService(); | 73 void UpdateFromService(); |
| 73 | 74 |
| 74 chromeos::DeviceSettingsService* device_settings_service_; | 75 chromeos::DeviceSettingsService* device_settings_service_; |
| 75 EnterpriseInstallAttributes* install_attributes_; | 76 EnterpriseInstallAttributes* install_attributes_; |
| 76 | 77 |
| 77 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 78 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 78 | 79 |
| 79 // Whether enterprise enrollment validation has yet been done. | 80 // Whether enterprise enrollment validation has yet been done. |
| 80 bool enrollment_validation_done_; | 81 bool enrollment_validation_done_; |
| 81 | 82 |
| 82 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_; | 83 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_; |
| 83 | 84 |
| 84 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS); | 85 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace policy | 88 } // namespace policy |
| 88 | 89 |
| 89 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| OLD | NEW |