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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // This operation loads the public owner key from disk if appropriate, fetches | 135 // This operation loads the public owner key from disk if appropriate, fetches |
136 // the policy blob from session manager, and validates the loaded policy blob. | 136 // the policy blob from session manager, and validates the loaded policy blob. |
137 class LoadSettingsOperation : public SessionManagerOperation { | 137 class LoadSettingsOperation : public SessionManagerOperation { |
138 public: | 138 public: |
139 // Creates a new load operation. | 139 // Creates a new load operation. |
140 explicit LoadSettingsOperation(const Callback& callback); | 140 explicit LoadSettingsOperation(const Callback& callback); |
141 virtual ~LoadSettingsOperation(); | 141 virtual ~LoadSettingsOperation(); |
142 | 142 |
143 protected: | 143 protected: |
144 // SessionManagerOperation: | 144 // SessionManagerOperation: |
145 virtual void Run() OVERRIDE; | 145 virtual void Run() override; |
146 | 146 |
147 private: | 147 private: |
148 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); | 148 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); |
149 }; | 149 }; |
150 | 150 |
151 // Stores a pre-generated policy blob and reloads the device settings from | 151 // Stores a pre-generated policy blob and reloads the device settings from |
152 // session_manager. | 152 // session_manager. |
153 class StoreSettingsOperation : public SessionManagerOperation { | 153 class StoreSettingsOperation : public SessionManagerOperation { |
154 public: | 154 public: |
155 // Creates a new store operation. | 155 // Creates a new store operation. |
156 StoreSettingsOperation( | 156 StoreSettingsOperation( |
157 const Callback& callback, | 157 const Callback& callback, |
158 scoped_ptr<enterprise_management::PolicyFetchResponse> policy); | 158 scoped_ptr<enterprise_management::PolicyFetchResponse> policy); |
159 virtual ~StoreSettingsOperation(); | 159 virtual ~StoreSettingsOperation(); |
160 | 160 |
161 protected: | 161 protected: |
162 // SessionManagerOperation: | 162 // SessionManagerOperation: |
163 virtual void Run() OVERRIDE; | 163 virtual void Run() override; |
164 | 164 |
165 private: | 165 private: |
166 // Handles the result of the store operation and triggers the load. | 166 // Handles the result of the store operation and triggers the load. |
167 void HandleStoreResult(bool success); | 167 void HandleStoreResult(bool success); |
168 | 168 |
169 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; | 169 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; |
170 | 170 |
171 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; | 171 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); | 173 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); |
174 }; | 174 }; |
175 | 175 |
176 // Signs device settings and stores the resulting blob to session_manager. | 176 // Signs device settings and stores the resulting blob to session_manager. |
177 class SignAndStoreSettingsOperation : public SessionManagerOperation { | 177 class SignAndStoreSettingsOperation : public SessionManagerOperation { |
178 public: | 178 public: |
179 // Creates a new sign-and-store operation. | 179 // Creates a new sign-and-store operation. |
180 SignAndStoreSettingsOperation( | 180 SignAndStoreSettingsOperation( |
181 const Callback& callback, | 181 const Callback& callback, |
182 scoped_ptr<enterprise_management::PolicyData> new_policy); | 182 scoped_ptr<enterprise_management::PolicyData> new_policy); |
183 virtual ~SignAndStoreSettingsOperation(); | 183 virtual ~SignAndStoreSettingsOperation(); |
184 | 184 |
185 // SessionManagerOperation: | 185 // SessionManagerOperation: |
186 virtual void Run() OVERRIDE; | 186 virtual void Run() override; |
187 | 187 |
188 private: | 188 private: |
189 void StartSigning(bool has_private_key); | 189 void StartSigning(bool has_private_key); |
190 | 190 |
191 // Stores the signed device settings blob. | 191 // Stores the signed device settings blob. |
192 void StoreDeviceSettingsBlob(std::string device_settings_blob); | 192 void StoreDeviceSettingsBlob(std::string device_settings_blob); |
193 | 193 |
194 // Handles the result of the store operation and triggers the load. | 194 // Handles the result of the store operation and triggers the load. |
195 void HandleStoreResult(bool success); | 195 void HandleStoreResult(bool success); |
196 | 196 |
197 scoped_ptr<enterprise_management::PolicyData> new_policy_; | 197 scoped_ptr<enterprise_management::PolicyData> new_policy_; |
198 | 198 |
199 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_; | 199 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation); | 201 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation); |
202 }; | 202 }; |
203 | 203 |
204 } // namespace chromeos | 204 } // namespace chromeos |
205 | 205 |
206 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ |
OLD | NEW |