Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/browser/chromeos/settings/session_manager_operation.h

Issue 270663002: Implemented profile-aware owner key loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fix: removed redundant check. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/policy/device_cloud_policy_validator.h" 12 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h"
13 #include "chrome/browser/chromeos/settings/device_settings_service.h" 13 #include "chrome/browser/chromeos/settings/device_settings_service.h"
14 #include "crypto/scoped_nss_types.h"
Mattias Nissler (ping if slow) 2014/05/15 11:21:29 Shouldn't this also be x509_util_nss.h?
ygorshenin1 2014/05/15 11:58:37 Done.
14 15
15 namespace enterprise_management { 16 namespace enterprise_management {
16 class ChromeDeviceSettingsProto; 17 class ChromeDeviceSettingsProto;
17 class PolicyData; 18 class PolicyData;
18 class PolicyFetchResponse; 19 class PolicyFetchResponse;
19 } 20 }
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 class OwnerKeyUtil; 24 class OwnerKeyUtil;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 60
60 // Whether the load operation is underway. 61 // Whether the load operation is underway.
61 bool is_loading() const { 62 bool is_loading() const {
62 return is_loading_; 63 return is_loading_;
63 } 64 }
64 65
65 void set_force_key_load(bool force_key_load) { 66 void set_force_key_load(bool force_key_load) {
66 force_key_load_ = force_key_load; 67 force_key_load_ = force_key_load;
67 } 68 }
68 69
70 void set_username(const std::string& username) { username_ = username; }
71 void set_slot(PK11SlotInfo* slot) { slot_ = slot; }
72
69 protected: 73 protected:
70 // Runs the operation. The result is reported through |callback_|. 74 // Runs the operation. The result is reported through |callback_|.
71 virtual void Run() = 0; 75 virtual void Run() = 0;
72 76
73 // Ensures the owner key is loaded. 77 // Ensures the owner key is loaded.
74 void EnsureOwnerKey(const base::Closure& callback); 78 void EnsureOwnerKey(const base::Closure& callback);
75 79
76 // Starts a load operation. 80 // Starts a load operation.
77 void StartLoading(); 81 void StartLoading();
78 82
79 // Reports the result status of the operation. Once this gets called, the 83 // Reports the result status of the operation. Once this gets called, the
80 // operation should not perform further processing or trigger callbacks. 84 // operation should not perform further processing or trigger callbacks.
81 void ReportResult(DeviceSettingsService::Status status); 85 void ReportResult(DeviceSettingsService::Status status);
82 86
83 SessionManagerClient* session_manager_client() { 87 SessionManagerClient* session_manager_client() {
84 return session_manager_client_; 88 return session_manager_client_;
85 } 89 }
86 90
87 private: 91 private:
88 // Loads the owner key from disk. Must be run on a thread that can do I/O. 92 // Loads the owner key from disk. Must be run on a thread that can do I/O.
89 static scoped_refptr<OwnerKey> LoadOwnerKey( 93 static scoped_refptr<OwnerKey> LoadOwnerKey(
90 scoped_refptr<OwnerKeyUtil> util, 94 scoped_refptr<OwnerKeyUtil> util,
91 scoped_refptr<OwnerKey> current_key); 95 scoped_refptr<OwnerKey> current_key,
96 PK11SlotInfo* slot);
92 97
93 // Stores the owner key loaded by LoadOwnerKey and calls |callback|. 98 // Stores the owner key loaded by LoadOwnerKey and calls |callback|.
94 void StoreOwnerKey(const base::Closure& callback, 99 void StoreOwnerKey(const base::Closure& callback,
95 scoped_refptr<OwnerKey> new_key); 100 scoped_refptr<OwnerKey> new_key);
96 101
97 // Triggers a device settings load. 102 // Triggers a device settings load.
98 void RetrieveDeviceSettings(); 103 void RetrieveDeviceSettings();
99 104
100 // Validates device settings after retrieval from session_manager. 105 // Validates device settings after retrieval from session_manager.
101 void ValidateDeviceSettings(const std::string& policy_blob); 106 void ValidateDeviceSettings(const std::string& policy_blob);
102 107
103 // Extracts status and device settings from the validator and reports them. 108 // Extracts status and device settings from the validator and reports them.
104 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator); 109 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator);
105 110
106 SessionManagerClient* session_manager_client_; 111 SessionManagerClient* session_manager_client_;
107 scoped_refptr<OwnerKeyUtil> owner_key_util_; 112 scoped_refptr<OwnerKeyUtil> owner_key_util_;
108 113
109 base::WeakPtrFactory<SessionManagerOperation> weak_factory_; 114 base::WeakPtrFactory<SessionManagerOperation> weak_factory_;
110 115
111 Callback callback_; 116 Callback callback_;
112 117
113 scoped_refptr<OwnerKey> owner_key_; 118 scoped_refptr<OwnerKey> owner_key_;
114 bool force_key_load_; 119 bool force_key_load_;
120 std::string username_;
121 PK11SlotInfo* slot_;
115 122
116 bool is_loading_; 123 bool is_loading_;
117 scoped_ptr<enterprise_management::PolicyData> policy_data_; 124 scoped_ptr<enterprise_management::PolicyData> policy_data_;
118 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; 125 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_;
119 126
120 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation); 127 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation);
121 }; 128 };
122 129
123 // This operation loads the public owner key from disk if appropriate, fetches 130 // This operation loads the public owner key from disk if appropriate, fetches
124 // the policy blob from session manager, and validates the loaded policy blob. 131 // the policy blob from session manager, and validates the loaded policy blob.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 scoped_ptr<enterprise_management::PolicyData> new_policy_; 198 scoped_ptr<enterprise_management::PolicyData> new_policy_;
192 199
193 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_; 200 base::WeakPtrFactory<SignAndStoreSettingsOperation> weak_factory_;
194 201
195 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation); 202 DISALLOW_COPY_AND_ASSIGN(SignAndStoreSettingsOperation);
196 }; 203 };
197 204
198 } // namespace chromeos 205 } // namespace chromeos
199 206
200 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ 207 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698