| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 12 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 13 | 13 |
| 14 namespace enterprise_management { | 14 namespace enterprise_management { |
| 15 class ChromeDeviceSettingsProto; | 15 class ChromeDeviceSettingsProto; |
| 16 class PolicyData; | 16 class PolicyData; |
| 17 class PolicyFetchResponse; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 class OwnerKeyUtil; | 22 class OwnerKeyUtil; |
| 22 class SessionManagerClient; | 23 class SessionManagerClient; |
| 23 | 24 |
| 24 // Handles a single transaction with session manager. This is a virtual base | 25 // Handles a single transaction with session manager. This is a virtual base |
| 25 // class that contains common infrastructure for key and policy loading. There | 26 // class that contains common infrastructure for key and policy loading. There |
| 26 // are subclasses for loading, storing and signing policy blobs. | 27 // are subclasses for loading, storing and signing policy blobs. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 133 |
| 133 private: | 134 private: |
| 134 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); | 135 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 // Stores a pre-generated policy blob and reloads the device settings from | 138 // Stores a pre-generated policy blob and reloads the device settings from |
| 138 // session_manager. | 139 // session_manager. |
| 139 class StoreSettingsOperation : public SessionManagerOperation { | 140 class StoreSettingsOperation : public SessionManagerOperation { |
| 140 public: | 141 public: |
| 141 // Creates a new store operation. | 142 // Creates a new store operation. |
| 142 StoreSettingsOperation(const Callback& callback, | 143 StoreSettingsOperation( |
| 143 const std::string& policy_blob); | 144 const Callback& callback, |
| 145 scoped_ptr<enterprise_management::PolicyFetchResponse> policy); |
| 144 virtual ~StoreSettingsOperation(); | 146 virtual ~StoreSettingsOperation(); |
| 145 | 147 |
| 146 protected: | 148 protected: |
| 147 // SessionManagerOperation: | 149 // SessionManagerOperation: |
| 148 virtual void Run() OVERRIDE; | 150 virtual void Run() OVERRIDE; |
| 149 | 151 |
| 150 private: | 152 private: |
| 151 // Handles the result of the store operation and triggers the load. | 153 // Handles the result of the store operation and triggers the load. |
| 152 void HandleStoreResult(bool success); | 154 void HandleStoreResult(bool success); |
| 153 | 155 |
| 154 std::string policy_blob_; | 156 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; |
| 155 | 157 |
| 156 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; | 158 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; |
| 157 | 159 |
| 158 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); | 160 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); |
| 159 }; | 161 }; |
| 160 | 162 |
| 161 // Signs device settings and stores the resulting blob to session_manager. | 163 // Signs device settings and stores the resulting blob to session_manager. |
| 162 class SignAndStoreSettingsOperation : public SessionManagerOperation { | 164 class SignAndStoreSettingsOperation : public SessionManagerOperation { |
| 163 public: | 165 public: |
| 164 // Creates a new sign-and-store operation. | 166 // Creates a new sign-and-store operation. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 191 std::string username_; | 193 std::string username_; |
| 192 | 194 |
| 193 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_; | 195 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_; |
| 194 | 196 |
| 195 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation); | 197 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation); |
| 196 }; | 198 }; |
| 197 | 199 |
| 198 } // namespace | 200 } // namespace |
| 199 | 201 |
| 200 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ | 202 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ |
| OLD | NEW |