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 CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as | 144 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as |
145 // string. Upon success, we will pass a protobuf to the callback. On | 145 // string. Upon success, we will pass a protobuf to the callback. On |
146 // failure, we will pass "". | 146 // failure, we will pass "". |
147 using RetrievePolicyCallback = | 147 using RetrievePolicyCallback = |
148 base::Callback<void(const std::string& protobuf)>; | 148 base::Callback<void(const std::string& protobuf)>; |
149 | 149 |
150 // Fetches the device policy blob stored by the session manager. Upon | 150 // Fetches the device policy blob stored by the session manager. Upon |
151 // completion of the retrieve attempt, we will call the provided callback. | 151 // completion of the retrieve attempt, we will call the provided callback. |
152 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; | 152 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; |
153 | 153 |
| 154 // Same as RetrieveDevicePolicy() but blocks until a reply is received, and |
| 155 // returns the policy synchronously. Returns an empty string if the method |
| 156 // call fails. |
| 157 // This may only be called in situations where blocking the UI thread is |
| 158 // considered acceptable (e.g. restarting the browser after a crash or after |
| 159 // a flag change). |
| 160 // TODO: Get rid of blocking calls (crbug.com/160522). |
| 161 virtual std::string BlockingRetrieveDevicePolicy() = 0; |
| 162 |
154 // Fetches the user policy blob stored by the session manager for the given | 163 // Fetches the user policy blob stored by the session manager for the given |
155 // |cryptohome_id|. Upon completion of the retrieve attempt, we will call the | 164 // |cryptohome_id|. Upon completion of the retrieve attempt, we will call the |
156 // provided callback. | 165 // provided callback. |
157 virtual void RetrievePolicyForUser( | 166 virtual void RetrievePolicyForUser( |
158 const cryptohome::Identification& cryptohome_id, | 167 const cryptohome::Identification& cryptohome_id, |
159 const RetrievePolicyCallback& callback) = 0; | 168 const RetrievePolicyCallback& callback) = 0; |
160 | 169 |
161 // Same as RetrievePolicyForUser() but blocks until a reply is received, and | 170 // Same as RetrievePolicyForUser() but blocks until a reply is received, and |
162 // returns the policy synchronously. Returns an empty string if the method | 171 // returns the policy synchronously. Returns an empty string if the method |
163 // call fails. | 172 // call fails. |
164 // This may only be called in situations where blocking the UI thread is | 173 // This may only be called in situations where blocking the UI thread is |
165 // considered acceptable (e.g. restarting the browser after a crash or after | 174 // considered acceptable (e.g. restarting the browser after a crash or after |
166 // a flag change). | 175 // a flag change). |
| 176 // TODO: Get rid of blocking calls (crbug.com/160522). |
167 virtual std::string BlockingRetrievePolicyForUser( | 177 virtual std::string BlockingRetrievePolicyForUser( |
168 const cryptohome::Identification& cryptohome_id) = 0; | 178 const cryptohome::Identification& cryptohome_id) = 0; |
169 | 179 |
170 // Fetches the policy blob associated with the specified device-local account | 180 // Fetches the policy blob associated with the specified device-local account |
171 // from session manager. |callback| is invoked up on completion. | 181 // from session manager. |callback| is invoked up on completion. |
172 virtual void RetrieveDeviceLocalAccountPolicy( | 182 virtual void RetrieveDeviceLocalAccountPolicy( |
173 const std::string& account_id, | 183 const std::string& account_id, |
174 const RetrievePolicyCallback& callback) = 0; | 184 const RetrievePolicyCallback& callback) = 0; |
175 | 185 |
| 186 // Same as RetrieveDeviceLocalAccountPolicy() but blocks until a reply is |
| 187 // received, and returns the policy synchronously. |
| 188 // Returns an empty string if the method call fails. |
| 189 // This may only be called in situations where blocking the UI thread is |
| 190 // considered acceptable (e.g. restarting the browser after a crash or after |
| 191 // a flag change). |
| 192 // TODO: Get rid of blocking calls (crbug.com/160522). |
| 193 virtual std::string BlockingRetrieveDeviceLocalAccountPolicy( |
| 194 const std::string& account_id) = 0; |
| 195 |
176 // Used for StoreDevicePolicy, StorePolicyForUser and | 196 // Used for StoreDevicePolicy, StorePolicyForUser and |
177 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the | 197 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the |
178 // operation was successful or not. | 198 // operation was successful or not. |
179 using StorePolicyCallback = base::Callback<void(bool success)>; | 199 using StorePolicyCallback = base::Callback<void(bool success)>; |
180 | 200 |
181 // Attempts to asynchronously store |policy_blob| as device policy. Upon | 201 // Attempts to asynchronously store |policy_blob| as device policy. Upon |
182 // completion of the store attempt, we will call callback. | 202 // completion of the store attempt, we will call callback. |
183 virtual void StoreDevicePolicy(const std::string& policy_blob, | 203 virtual void StoreDevicePolicy(const std::string& policy_blob, |
184 const StorePolicyCallback& callback) = 0; | 204 const StorePolicyCallback& callback) = 0; |
185 | 205 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Create() should be used instead. | 313 // Create() should be used instead. |
294 SessionManagerClient(); | 314 SessionManagerClient(); |
295 | 315 |
296 private: | 316 private: |
297 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 317 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
298 }; | 318 }; |
299 | 319 |
300 } // namespace chromeos | 320 } // namespace chromeos |
301 | 321 |
302 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 322 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
OLD | NEW |