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" |
11 #include "chromeos/dbus/dbus_client_implementation_type.h" | 11 #include "chromeos/dbus/dbus_client_implementation_type.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 namespace dbus { | 15 namespace dbus { |
16 class Bus; | 16 class Bus; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 // SessionManagerClient is used to communicate with the session manager. | 21 // SessionManagerClient is used to communicate with the session manager. |
22 class CHROMEOS_EXPORT SessionManagerClient { | 22 class CHROMEOS_EXPORT SessionManagerClient { |
23 public: | 23 public: |
24 // Interface for observing changes from the session manager. | 24 // Interface for observing changes from the session manager. |
25 class Observer { | 25 class Observer { |
26 public: | 26 public: |
27 // Called when the owner key is set. | 27 // Called when the owner key is set. |
28 virtual void OwnerKeySet(bool success) {} | 28 virtual void OwnerKeySet(bool success) {} |
| 29 |
29 // Called when the property change is complete. | 30 // Called when the property change is complete. |
30 virtual void PropertyChangeComplete(bool success) {} | 31 virtual void PropertyChangeComplete(bool success) {} |
| 32 |
| 33 // Called when the screen is locked. |
| 34 virtual void LockScreen() {} |
| 35 |
| 36 // Called when the screen is unlocked. |
| 37 virtual void UnlockScreen() {} |
| 38 |
31 }; | 39 }; |
32 | 40 |
33 // Adds and removes the observer. | 41 // Adds and removes the observer. |
34 virtual void AddObserver(Observer* observer) = 0; | 42 virtual void AddObserver(Observer* observer) = 0; |
35 virtual void RemoveObserver(Observer* observer) = 0; | 43 virtual void RemoveObserver(Observer* observer) = 0; |
| 44 virtual bool HasObserver(Observer* observer) = 0; |
36 | 45 |
37 // Kicks off an attempt to emit the "login-prompt-ready" upstart signal. | 46 // Kicks off an attempt to emit the "login-prompt-ready" upstart signal. |
38 virtual void EmitLoginPromptReady() = 0; | 47 virtual void EmitLoginPromptReady() = 0; |
39 | 48 |
40 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. | 49 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. |
41 virtual void EmitLoginPromptVisible() = 0; | 50 virtual void EmitLoginPromptVisible() = 0; |
42 | 51 |
43 // Restarts a job referenced by |pid| with the provided command line. | 52 // Restarts a job referenced by |pid| with the provided command line. |
44 virtual void RestartJob(int pid, const std::string& command_line) = 0; | 53 virtual void RestartJob(int pid, const std::string& command_line) = 0; |
45 | 54 |
46 // Restarts entd (the enterprise daemon). | 55 // Restarts entd (the enterprise daemon). |
47 // DEPRECATED: will be deleted soon. | 56 // DEPRECATED: will be deleted soon. |
48 virtual void RestartEntd() = 0; | 57 virtual void RestartEntd() = 0; |
49 | 58 |
50 // Starts the session for the user. | 59 // Starts the session for the user. |
51 virtual void StartSession(const std::string& user_email) = 0; | 60 virtual void StartSession(const std::string& user_email) = 0; |
52 | 61 |
53 // Stops the current session. | 62 // Stops the current session. |
54 virtual void StopSession() = 0; | 63 virtual void StopSession() = 0; |
55 | 64 |
| 65 // Locks the screen. |
| 66 virtual void RequestLockScreen() = 0; |
| 67 |
| 68 // Unlocks the screen. |
| 69 virtual void RequestUnlockScreen() = 0; |
| 70 |
| 71 // Returns whether or not the screen is locked. Implementation should cache |
| 72 // this state so that it can return immediately. Useful for observers that |
| 73 // need to know the current screen lock state when they are added. |
| 74 virtual bool GetIsScreenLocked() = 0; |
| 75 |
56 // Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized | 76 // Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized |
57 // protocol buffer as string. Upon success, we will pass a protobuf to the | 77 // protocol buffer as string. Upon success, we will pass a protobuf to the |
58 // callback. On failure, we will pass "". | 78 // callback. On failure, we will pass "". |
59 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; | 79 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; |
60 | 80 |
61 // Fetches the device policy blob stored by the session manager. Upon | 81 // Fetches the device policy blob stored by the session manager. Upon |
62 // completion of the retrieve attempt, we will call the provided callback. | 82 // completion of the retrieve attempt, we will call the provided callback. |
63 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; | 83 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; |
64 | 84 |
65 // Fetches the user policy blob stored by the session manager for the | 85 // Fetches the user policy blob stored by the session manager for the |
(...skipping 26 matching lines...) Expand all Loading... |
92 // Create() should be used instead. | 112 // Create() should be used instead. |
93 SessionManagerClient(); | 113 SessionManagerClient(); |
94 | 114 |
95 private: | 115 private: |
96 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 116 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
97 }; | 117 }; |
98 | 118 |
99 } // namespace chromeos | 119 } // namespace chromeos |
100 | 120 |
101 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 121 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
OLD | NEW |