| 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_SETTINGS_SESSION_MANAGER_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.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 "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 13 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
| 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 15 #include "chromeos/dbus/session_manager_client.h" | |
| 16 #include "net/cert/x509_util_nss.h" | 15 #include "net/cert/x509_util_nss.h" |
| 17 | 16 |
| 18 namespace enterprise_management { | 17 namespace enterprise_management { |
| 19 class ChromeDeviceSettingsProto; | 18 class ChromeDeviceSettingsProto; |
| 20 class PolicyData; | 19 class PolicyData; |
| 21 class PolicyFetchResponse; | 20 class PolicyFetchResponse; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace ownership { | 23 namespace ownership { |
| 25 class OwnerKeyUtil; | 24 class OwnerKeyUtil; |
| 26 class PublicKey; | 25 class PublicKey; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace chromeos { | 28 namespace chromeos { |
| 30 | 29 |
| 30 class SessionManagerClient; |
| 31 |
| 31 // Handles a single transaction with session manager. This is a virtual base | 32 // Handles a single transaction with session manager. This is a virtual base |
| 32 // class that contains common infrastructure for key and policy loading. There | 33 // class that contains common infrastructure for key and policy loading. There |
| 33 // are subclasses for loading, storing and signing policy blobs. | 34 // are subclasses for loading, storing and signing policy blobs. |
| 34 class SessionManagerOperation { | 35 class SessionManagerOperation { |
| 35 public: | 36 public: |
| 36 typedef base::Callback<void(SessionManagerOperation*, | 37 typedef base::Callback<void(SessionManagerOperation*, |
| 37 DeviceSettingsService::Status)> Callback; | 38 DeviceSettingsService::Status)> Callback; |
| 38 | 39 |
| 39 // Creates a new load operation. | 40 // Creates a new load operation. |
| 40 explicit SessionManagerOperation(const Callback& callback); | 41 explicit SessionManagerOperation(const Callback& callback); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void StorePublicKey(const base::Closure& callback, | 104 void StorePublicKey(const base::Closure& callback, |
| 104 scoped_refptr<ownership::PublicKey> new_key); | 105 scoped_refptr<ownership::PublicKey> new_key); |
| 105 | 106 |
| 106 // Triggers a device settings load. | 107 // Triggers a device settings load. |
| 107 void RetrieveDeviceSettings(); | 108 void RetrieveDeviceSettings(); |
| 108 | 109 |
| 109 // Same as RetrieveDeviceSettings, but loads synchronously. | 110 // Same as RetrieveDeviceSettings, but loads synchronously. |
| 110 void BlockingRetrieveDeviceSettings(); | 111 void BlockingRetrieveDeviceSettings(); |
| 111 | 112 |
| 112 // Validates device settings after retrieval from session_manager. | 113 // Validates device settings after retrieval from session_manager. |
| 113 void ValidateDeviceSettings( | 114 void ValidateDeviceSettings(const std::string& policy_blob); |
| 114 const std::string& policy_blob, | |
| 115 SessionManagerClient::RetrievePolicyResponseType response_type); | |
| 116 | 115 |
| 117 // Extracts status and device settings from the validator and reports them. | 116 // Extracts status and device settings from the validator and reports them. |
| 118 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator); | 117 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator); |
| 119 | 118 |
| 120 SessionManagerClient* session_manager_client_ = nullptr; | 119 SessionManagerClient* session_manager_client_ = nullptr; |
| 121 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; | 120 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; |
| 122 | 121 |
| 123 Callback callback_; | 122 Callback callback_; |
| 124 | 123 |
| 125 scoped_refptr<ownership::PublicKey> public_key_; | 124 scoped_refptr<ownership::PublicKey> public_key_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_; | 176 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_; |
| 178 | 177 |
| 179 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; | 178 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; |
| 180 | 179 |
| 181 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); | 180 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); |
| 182 }; | 181 }; |
| 183 | 182 |
| 184 } // namespace chromeos | 183 } // namespace chromeos |
| 185 | 184 |
| 186 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ | 185 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ |
| OLD | NEW |