| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Notifies that the lock screen is shown. | 83 // Notifies that the lock screen is shown. |
| 84 virtual void NotifyLockScreenShown() = 0; | 84 virtual void NotifyLockScreenShown() = 0; |
| 85 | 85 |
| 86 // Unlocks the screen. | 86 // Unlocks the screen. |
| 87 virtual void RequestUnlockScreen() = 0; | 87 virtual void RequestUnlockScreen() = 0; |
| 88 | 88 |
| 89 // Notifies that the lock screen is dismissed. | 89 // Notifies that the lock screen is dismissed. |
| 90 virtual void NotifyLockScreenDismissed() = 0; | 90 virtual void NotifyLockScreenDismissed() = 0; |
| 91 | 91 |
| 92 // Used for RetrieveDevicePolicy, RetrieveUserPolicy and | 92 // Used for RetrieveDevicePolicy, RetrievePolicyForUser and |
| 93 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as | 93 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as |
| 94 // string. Upon success, we will pass a protobuf to the callback. On | 94 // string. Upon success, we will pass a protobuf to the callback. On |
| 95 // failure, we will pass "". | 95 // failure, we will pass "". |
| 96 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; | 96 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; |
| 97 | 97 |
| 98 // Fetches the device policy blob stored by the session manager. Upon | 98 // Fetches the device policy blob stored by the session manager. Upon |
| 99 // completion of the retrieve attempt, we will call the provided callback. | 99 // completion of the retrieve attempt, we will call the provided callback. |
| 100 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; | 100 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; |
| 101 | 101 |
| 102 // Fetches the user policy blob stored by the session manager for the | 102 // Fetches the user policy blob stored by the session manager for the given |
| 103 // currently signed-in user. Upon completion of the retrieve attempt, we will | 103 // |username|. Upon completion of the retrieve attempt, we will call the |
| 104 // call the provided callback. | 104 // provided callback. |
| 105 virtual void RetrieveUserPolicy(const RetrievePolicyCallback& callback) = 0; | 105 virtual void RetrievePolicyForUser( |
| 106 const std::string& username, |
| 107 const RetrievePolicyCallback& callback) = 0; |
| 106 | 108 |
| 107 // Fetches the policy blob associated with the specified device-local account | 109 // Fetches the policy blob associated with the specified device-local account |
| 108 // from session manager. |callback| is invoked up on completion. | 110 // from session manager. |callback| is invoked up on completion. |
| 109 virtual void RetrieveDeviceLocalAccountPolicy( | 111 virtual void RetrieveDeviceLocalAccountPolicy( |
| 110 const std::string& account_id, | 112 const std::string& account_id, |
| 111 const RetrievePolicyCallback& callback) = 0; | 113 const RetrievePolicyCallback& callback) = 0; |
| 112 | 114 |
| 113 // Used for StoreDevicePolicy, StoreUserPolicy and | 115 // Used for StoreDevicePolicy, StorePolicyForUser and |
| 114 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the | 116 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the |
| 115 // operation was successful or not. | 117 // operation was successful or not. |
| 116 typedef base::Callback<void(bool)> StorePolicyCallback; | 118 typedef base::Callback<void(bool)> StorePolicyCallback; |
| 117 | 119 |
| 118 // Attempts to asynchronously store |policy_blob| as device policy. Upon | 120 // Attempts to asynchronously store |policy_blob| as device policy. Upon |
| 119 // completion of the store attempt, we will call callback. | 121 // completion of the store attempt, we will call callback. |
| 120 virtual void StoreDevicePolicy(const std::string& policy_blob, | 122 virtual void StoreDevicePolicy(const std::string& policy_blob, |
| 121 const StorePolicyCallback& callback) = 0; | 123 const StorePolicyCallback& callback) = 0; |
| 122 | 124 |
| 123 // Attempts to asynchronously store |policy_blob| as user policy for the | 125 // Attempts to asynchronously store |policy_blob| as user policy for the given |
| 124 // currently signed-in user. Upon completion of the store attempt, we will | 126 // |username|. Upon completion of the store attempt, we will call callback. |
| 125 // call callback. | 127 // The |policy_key| argument is not sent to the session manager, but is used |
| 126 virtual void StoreUserPolicy(const std::string& policy_blob, | 128 // by the stub implementation to enable policy validation on desktop builds. |
| 127 const StorePolicyCallback& callback) = 0; | 129 virtual void StorePolicyForUser(const std::string& username, |
| 130 const std::string& policy_blob, |
| 131 const std::string& policy_key, |
| 132 const StorePolicyCallback& callback) = 0; |
| 128 | 133 |
| 129 // Sends a request to store a policy blob for the specified device-local | 134 // Sends a request to store a policy blob for the specified device-local |
| 130 // account. The result of the operation is reported through |callback|. | 135 // account. The result of the operation is reported through |callback|. |
| 131 virtual void StoreDeviceLocalAccountPolicy( | 136 virtual void StoreDeviceLocalAccountPolicy( |
| 132 const std::string& account_id, | 137 const std::string& account_id, |
| 133 const std::string& policy_blob, | 138 const std::string& policy_blob, |
| 134 const StorePolicyCallback& callback) = 0; | 139 const StorePolicyCallback& callback) = 0; |
| 135 | 140 |
| 136 // Creates the instance. | 141 // Creates the instance. |
| 137 static SessionManagerClient* Create(DBusClientImplementationType type, | 142 static SessionManagerClient* Create(DBusClientImplementationType type, |
| 138 dbus::Bus* bus); | 143 dbus::Bus* bus); |
| 139 | 144 |
| 140 virtual ~SessionManagerClient(); | 145 virtual ~SessionManagerClient(); |
| 141 | 146 |
| 142 protected: | 147 protected: |
| 143 // Create() should be used instead. | 148 // Create() should be used instead. |
| 144 SessionManagerClient(); | 149 SessionManagerClient(); |
| 145 | 150 |
| 146 private: | 151 private: |
| 147 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 152 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 } // namespace chromeos | 155 } // namespace chromeos |
| 151 | 156 |
| 152 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 157 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
| OLD | NEW |