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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // call. | 71 // call. |
72 virtual bool IsScreenLocked() const = 0; | 72 virtual bool IsScreenLocked() const = 0; |
73 | 73 |
74 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. | 74 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. |
75 virtual void EmitLoginPromptVisible() = 0; | 75 virtual void EmitLoginPromptVisible() = 0; |
76 | 76 |
77 // Restarts the browser job, passing |argv| as the updated command line. | 77 // Restarts the browser job, passing |argv| as the updated command line. |
78 virtual void RestartJob(const std::vector<std::string>& argv) = 0; | 78 virtual void RestartJob(const std::vector<std::string>& argv) = 0; |
79 | 79 |
80 // Starts the session for the user. | 80 // Starts the session for the user. |
81 virtual void StartSession(const std::string& user_email) = 0; | 81 virtual void StartSession(const std::string& user_id) = 0; |
82 | 82 |
83 // Stops the current session. | 83 // Stops the current session. |
84 virtual void StopSession() = 0; | 84 virtual void StopSession() = 0; |
85 | 85 |
86 // Starts the factory reset. | 86 // Starts the factory reset. |
87 virtual void StartDeviceWipe() = 0; | 87 virtual void StartDeviceWipe() = 0; |
88 | 88 |
89 // Locks the screen. | 89 // Locks the screen. |
90 virtual void RequestLockScreen() = 0; | 90 virtual void RequestLockScreen() = 0; |
91 | 91 |
92 // Notifies that the lock screen is shown. | 92 // Notifies that the lock screen is shown. |
93 virtual void NotifyLockScreenShown() = 0; | 93 virtual void NotifyLockScreenShown() = 0; |
94 | 94 |
95 // Notifies that the lock screen is dismissed. | 95 // Notifies that the lock screen is dismissed. |
96 virtual void NotifyLockScreenDismissed() = 0; | 96 virtual void NotifyLockScreenDismissed() = 0; |
97 | 97 |
98 // Notifies that supervised user creation have started. | 98 // Notifies that supervised user creation have started. |
99 virtual void NotifySupervisedUserCreationStarted() = 0; | 99 virtual void NotifySupervisedUserCreationStarted() = 0; |
100 | 100 |
101 // Notifies that supervised user creation have finished. | 101 // Notifies that supervised user creation have finished. |
102 virtual void NotifySupervisedUserCreationFinished() = 0; | 102 virtual void NotifySupervisedUserCreationFinished() = 0; |
103 | 103 |
104 // Map that is used to describe the set of active user sessions where |key| | 104 // Map that is used to describe the set of active user sessions where |key| |
105 // is user_id and |value| is user_id_hash. | 105 // is cryptohome id and |value| is user_id_hash. |
106 typedef std::map<std::string, std::string> ActiveSessionsMap; | 106 typedef std::map<std::string, std::string> ActiveSessionsMap; |
107 | 107 |
108 // The ActiveSessionsCallback is used for the RetrieveActiveSessions() | 108 // The ActiveSessionsCallback is used for the RetrieveActiveSessions() |
109 // method. It receives |sessions| argument where the keys are user_ids for | 109 // method. It receives |sessions| argument where the keys are user_ids for |
110 // all users that are currently active and |success| argument which indicates | 110 // all users that are currently active and |success| argument which indicates |
111 // whether or not the request succeded. | 111 // whether or not the request succeded. |
112 typedef base::Callback<void(const ActiveSessionsMap& sessions, | 112 typedef base::Callback<void(const ActiveSessionsMap& sessions, |
113 bool success)> ActiveSessionsCallback; | 113 bool success)> ActiveSessionsCallback; |
114 | 114 |
115 // Enumerates active user sessions. Usually Chrome naturally keeps track of | 115 // Enumerates active user sessions. Usually Chrome naturally keeps track of |
116 // active users when they are added into current session. When Chrome is | 116 // active users when they are added into current session. When Chrome is |
117 // restarted after crash by session_manager it only receives user_id and | 117 // restarted after crash by session_manager it only receives user_id and |
118 // user_id_hash for one user. This method is used to retrieve list of all | 118 // user_id_hash for one user. This method is used to retrieve list of all |
119 // active users. | 119 // active users. |
120 virtual void RetrieveActiveSessions( | 120 virtual void RetrieveActiveSessions( |
121 const ActiveSessionsCallback& callback) = 0; | 121 const ActiveSessionsCallback& callback) = 0; |
122 | 122 |
123 // Used for RetrieveDevicePolicy, RetrievePolicyForUser and | 123 // Used for RetrieveDevicePolicy, RetrievePolicyForUser and |
124 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as | 124 // RetrieveDeviceLocalAccountPolicy. Takes a serialized protocol buffer as |
125 // string. Upon success, we will pass a protobuf to the callback. On | 125 // string. Upon success, we will pass a protobuf to the callback. On |
126 // failure, we will pass "". | 126 // failure, we will pass "". |
127 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; | 127 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; |
128 | 128 |
129 // Fetches the device policy blob stored by the session manager. Upon | 129 // Fetches the device policy blob stored by the session manager. Upon |
130 // completion of the retrieve attempt, we will call the provided callback. | 130 // completion of the retrieve attempt, we will call the provided callback. |
131 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; | 131 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; |
132 | 132 |
133 // Fetches the user policy blob stored by the session manager for the given | 133 // Fetches the user policy blob stored by the session manager for the given |
134 // |username|. Upon completion of the retrieve attempt, we will call the | 134 // |user_id|. Upon completion of the retrieve attempt, we will call the |
135 // provided callback. | 135 // provided callback. |
136 virtual void RetrievePolicyForUser( | 136 virtual void RetrievePolicyForUser( |
137 const std::string& username, | 137 const std::string& user_id, |
138 const RetrievePolicyCallback& callback) = 0; | 138 const RetrievePolicyCallback& callback) = 0; |
139 | 139 |
140 // Same as RetrievePolicyForUser() but blocks until a reply is received, and | 140 // Same as RetrievePolicyForUser() but blocks until a reply is received, and |
141 // returns the policy synchronously. Returns an empty string if the method | 141 // returns the policy synchronously. Returns an empty string if the method |
142 // call fails. | 142 // call fails. |
143 // This may only be called in situations where blocking the UI thread is | 143 // This may only be called in situations where blocking the UI thread is |
144 // considered acceptable (e.g. restarting the browser after a crash or after | 144 // considered acceptable (e.g. restarting the browser after a crash or after |
145 // a flag change). | 145 // a flag change). |
146 virtual std::string BlockingRetrievePolicyForUser( | 146 virtual std::string BlockingRetrievePolicyForUser( |
147 const std::string& username) = 0; | 147 const std::string& user_id) = 0; |
148 | 148 |
149 // Fetches the policy blob associated with the specified device-local account | 149 // Fetches the policy blob associated with the specified device-local account |
150 // from session manager. |callback| is invoked up on completion. | 150 // from session manager. |callback| is invoked up on completion. |
151 virtual void RetrieveDeviceLocalAccountPolicy( | 151 virtual void RetrieveDeviceLocalAccountPolicy( |
152 const std::string& account_id, | 152 const std::string& account_id, |
153 const RetrievePolicyCallback& callback) = 0; | 153 const RetrievePolicyCallback& callback) = 0; |
154 | 154 |
155 // Used for StoreDevicePolicy, StorePolicyForUser and | 155 // Used for StoreDevicePolicy, StorePolicyForUser and |
156 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the | 156 // StoreDeviceLocalAccountPolicy. Takes a boolean indicating whether the |
157 // operation was successful or not. | 157 // operation was successful or not. |
158 typedef base::Callback<void(bool)> StorePolicyCallback; | 158 typedef base::Callback<void(bool)> StorePolicyCallback; |
159 | 159 |
160 // Attempts to asynchronously store |policy_blob| as device policy. Upon | 160 // Attempts to asynchronously store |policy_blob| as device policy. Upon |
161 // completion of the store attempt, we will call callback. | 161 // completion of the store attempt, we will call callback. |
162 virtual void StoreDevicePolicy(const std::string& policy_blob, | 162 virtual void StoreDevicePolicy(const std::string& policy_blob, |
163 const StorePolicyCallback& callback) = 0; | 163 const StorePolicyCallback& callback) = 0; |
164 | 164 |
165 // Attempts to asynchronously store |policy_blob| as user policy for the given | 165 // Attempts to asynchronously store |policy_blob| as user policy for the given |
166 // |username|. Upon completion of the store attempt, we will call callback. | 166 // |user_id|. Upon completion of the store attempt, we will call callback. |
167 virtual void StorePolicyForUser(const std::string& username, | 167 virtual void StorePolicyForUser(const std::string& user_id, |
168 const std::string& policy_blob, | 168 const std::string& policy_blob, |
169 const StorePolicyCallback& callback) = 0; | 169 const StorePolicyCallback& callback) = 0; |
170 | 170 |
171 // Sends a request to store a policy blob for the specified device-local | 171 // Sends a request to store a policy blob for the specified device-local |
172 // account. The result of the operation is reported through |callback|. | 172 // account. The result of the operation is reported through |callback|. |
173 virtual void StoreDeviceLocalAccountPolicy( | 173 virtual void StoreDeviceLocalAccountPolicy( |
174 const std::string& account_id, | 174 const std::string& account_id, |
175 const std::string& policy_blob, | 175 const std::string& policy_blob, |
176 const StorePolicyCallback& callback) = 0; | 176 const StorePolicyCallback& callback) = 0; |
177 | 177 |
178 // Sets the flags to be applied next time by the session manager when Chrome | 178 // Sets the flags to be applied next time by the session manager when Chrome |
179 // is restarted inside an already started session for a particular user. | 179 // is restarted inside an already started session for a particular user. |
180 virtual void SetFlagsForUser(const std::string& username, | 180 virtual void SetFlagsForUser(const std::string& user_id, |
181 const std::vector<std::string>& flags) = 0; | 181 const std::vector<std::string>& flags) = 0; |
182 | 182 |
183 typedef base::Callback<void(const std::vector<std::string>& state_keys)> | 183 typedef base::Callback<void(const std::vector<std::string>& state_keys)> |
184 StateKeysCallback; | 184 StateKeysCallback; |
185 | 185 |
186 // Get the currently valid server-backed state keys for the device. | 186 // Get the currently valid server-backed state keys for the device. |
187 // Server-backed state keys are opaque, device-unique, time-dependent, | 187 // Server-backed state keys are opaque, device-unique, time-dependent, |
188 // client-determined identifiers that are used for keying state in the cloud | 188 // client-determined identifiers that are used for keying state in the cloud |
189 // for the device to retrieve after a device factory reset. | 189 // for the device to retrieve after a device factory reset. |
190 // | 190 // |
(...skipping 28 matching lines...) Expand all Loading... |
219 // Create() should be used instead. | 219 // Create() should be used instead. |
220 SessionManagerClient(); | 220 SessionManagerClient(); |
221 | 221 |
222 private: | 222 private: |
223 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 223 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
224 }; | 224 }; |
225 | 225 |
226 } // namespace chromeos | 226 } // namespace chromeos |
227 | 227 |
228 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 228 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
OLD | NEW |