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