Chromium Code Reviews| 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 virtual std::string BlockingRetrieveDevicePolicy() = 0; | |
|
stevenjb
2017/02/22 16:40:19
Since there is precedence for this already for use
Sergey Poromov
2017/02/28 14:01:17
Done.
| |
| 161 | |
| 154 // Fetches the user policy blob stored by the session manager for the given | 162 // 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 | 163 // |cryptohome_id|. Upon completion of the retrieve attempt, we will call the |
| 156 // provided callback. | 164 // provided callback. |
| 157 virtual void RetrievePolicyForUser( | 165 virtual void RetrievePolicyForUser( |
| 158 const cryptohome::Identification& cryptohome_id, | 166 const cryptohome::Identification& cryptohome_id, |
| 159 const RetrievePolicyCallback& callback) = 0; | 167 const RetrievePolicyCallback& callback) = 0; |
| 160 | 168 |
| 161 // Same as RetrievePolicyForUser() but blocks until a reply is received, and | 169 // Same as RetrievePolicyForUser() but blocks until a reply is received, and |
| 162 // returns the policy synchronously. Returns an empty string if the method | 170 // returns the policy synchronously. Returns an empty string if the method |
| 163 // call fails. | 171 // call fails. |
| 164 // This may only be called in situations where blocking the UI thread is | 172 // 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 | 173 // considered acceptable (e.g. restarting the browser after a crash or after |
| 166 // a flag change). | 174 // a flag change). |
| 167 virtual std::string BlockingRetrievePolicyForUser( | 175 virtual std::string BlockingRetrievePolicyForUser( |
| 168 const cryptohome::Identification& cryptohome_id) = 0; | 176 const cryptohome::Identification& cryptohome_id) = 0; |
| 169 | 177 |
| 170 // Fetches the policy blob associated with the specified device-local account | 178 // Fetches the policy blob associated with the specified device-local account |
| 171 // from session manager. |callback| is invoked up on completion. | 179 // from session manager. |callback| is invoked up on completion. |
| 172 virtual void RetrieveDeviceLocalAccountPolicy( | 180 virtual void RetrieveDeviceLocalAccountPolicy( |
| 173 const std::string& account_id, | 181 const std::string& account_id, |
| 174 const RetrievePolicyCallback& callback) = 0; | 182 const RetrievePolicyCallback& callback) = 0; |
| 175 | 183 |
| 184 // Same as RetrieveDeviceLocalAccountPolicy() but blocks until a reply is | |
| 185 // received, and | |
|
emaxx
2017/02/22 17:24:34
nit: Please reformat the comment.
Sergey Poromov
2017/02/28 14:01:17
Done.
| |
| 186 // returns the policy synchronously. Returns an empty string if the method | |
| 187 // call fails. | |
|
stevenjb
2017/02/22 16:40:19
combine lines
Sergey Poromov
2017/02/28 14:01:17
Done.
| |
| 188 // This may only be called in situations where blocking the UI thread is | |
| 189 // considered acceptable (e.g. restarting the browser after a crash or after | |
| 190 // a flag change). | |
| 191 virtual std::string BlockingRetrieveDeviceLocalAccountPolicy( | |
| 192 const std::string& account_id) = 0; | |
| 193 | |
| 176 // Used for StoreDevicePolicy, StorePolicyForUser and | 194 // Used for StoreDevicePolicy, StorePolicyForUser and |
| 177 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the | 195 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the |
| 178 // operation was successful or not. | 196 // operation was successful or not. |
| 179 using StorePolicyCallback = base::Callback<void(bool success)>; | 197 using StorePolicyCallback = base::Callback<void(bool success)>; |
| 180 | 198 |
| 181 // Attempts to asynchronously store |policy_blob| as device policy. Upon | 199 // Attempts to asynchronously store |policy_blob| as device policy. Upon |
| 182 // completion of the store attempt, we will call callback. | 200 // completion of the store attempt, we will call callback. |
| 183 virtual void StoreDevicePolicy(const std::string& policy_blob, | 201 virtual void StoreDevicePolicy(const std::string& policy_blob, |
| 184 const StorePolicyCallback& callback) = 0; | 202 const StorePolicyCallback& callback) = 0; |
| 185 | 203 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 // Create() should be used instead. | 311 // Create() should be used instead. |
| 294 SessionManagerClient(); | 312 SessionManagerClient(); |
| 295 | 313 |
| 296 private: | 314 private: |
| 297 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 315 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
| 298 }; | 316 }; |
| 299 | 317 |
| 300 } // namespace chromeos | 318 } // namespace chromeos |
| 301 | 319 |
| 302 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 320 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
| OLD | NEW |