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