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 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/dbus/dbus_client.h" | 14 #include "chromeos/dbus/dbus_client.h" |
15 #include "chromeos/dbus/dbus_client_implementation_type.h" | 15 #include "chromeos/dbus/dbus_client_implementation_type.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // SessionManagerClient is used to communicate with the session manager. | 19 // SessionManagerClient is used to communicate with the session manager. |
20 class CHROMEOS_EXPORT SessionManagerClient : public DBusClient { | 20 class CHROMEOS_EXPORT SessionManagerClient : public DBusClient { |
21 public: | 21 public: |
22 // Interface for observing changes from the session manager. | 22 // Interface for observing changes from the session manager. |
23 class Observer { | 23 class Observer { |
24 public: | 24 public: |
| 25 virtual ~Observer() {} |
| 26 |
25 // Called when the owner key is set. | 27 // Called when the owner key is set. |
26 virtual void OwnerKeySet(bool success) {} | 28 virtual void OwnerKeySet(bool success) {} |
27 | 29 |
28 // Called when the property change is complete. | 30 // Called when the property change is complete. |
29 virtual void PropertyChangeComplete(bool success) {} | 31 virtual void PropertyChangeComplete(bool success) {} |
30 | 32 |
31 // Called when the session manager requests that the lock screen be | |
32 // displayed. NotifyLockScreenShown() is called after the lock screen | |
33 // is shown (the canonical "is the screen locked?" state lives in the | |
34 // session manager). | |
35 // TODO(derat): Delete this once the session manager is calling the | |
36 // "LockScreen" method instead. | |
37 virtual void LockScreen() {} | |
38 | |
39 // Called when the session manager announces that the screen has been locked | 33 // Called when the session manager announces that the screen has been locked |
40 // successfully (i.e. after NotifyLockScreenShown() has been called). | 34 // successfully (i.e. after NotifyLockScreenShown() has been called). |
41 virtual void ScreenIsLocked() {} | 35 virtual void ScreenIsLocked() {} |
42 | 36 |
43 // Called when the session manager announces that the screen has been | 37 // Called when the session manager announces that the screen has been |
44 // unlocked successfully (i.e. after NotifyLockScreenDismissed() has | 38 // unlocked successfully (i.e. after NotifyLockScreenDismissed() has |
45 // been called). | 39 // been called). |
46 virtual void ScreenIsUnlocked() {} | 40 virtual void ScreenIsUnlocked() {} |
47 | 41 |
48 // Called after EmitLoginPromptVisible is called. | 42 // Called after EmitLoginPromptVisible is called. |
49 virtual void EmitLoginPromptVisibleCalled() {} | 43 virtual void EmitLoginPromptVisibleCalled() {} |
50 }; | 44 }; |
51 | 45 |
| 46 // Interface for performing actions on behalf of the stub implementation. |
| 47 class StubDelegate { |
| 48 public: |
| 49 virtual ~StubDelegate() {} |
| 50 |
| 51 // Locks the screen. Invoked by the stub when RequestLockScreen() is called. |
| 52 // In the real implementation of SessionManagerClient::RequestLockScreen(), |
| 53 // a lock request is forwarded to the session manager; in the stub, this is |
| 54 // short-circuited and the screen is locked immediately. |
| 55 virtual void LockScreenForStub() = 0; |
| 56 }; |
| 57 |
| 58 // Sets the delegate used by the stub implementation. Ownership of |delegate| |
| 59 // remains with the caller. |
| 60 virtual void SetStubDelegate(StubDelegate* delegate) = 0; |
| 61 |
52 // Adds and removes the observer. | 62 // Adds and removes the observer. |
53 virtual void AddObserver(Observer* observer) = 0; | 63 virtual void AddObserver(Observer* observer) = 0; |
54 virtual void RemoveObserver(Observer* observer) = 0; | 64 virtual void RemoveObserver(Observer* observer) = 0; |
55 virtual bool HasObserver(Observer* observer) = 0; | 65 virtual bool HasObserver(Observer* observer) = 0; |
56 | 66 |
57 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. | 67 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. |
58 virtual void EmitLoginPromptVisible() = 0; | 68 virtual void EmitLoginPromptVisible() = 0; |
59 | 69 |
60 // Restarts a job referenced by |pid| with the provided command line. | 70 // Restarts a job referenced by |pid| with the provided command line. |
61 virtual void RestartJob(int pid, const std::string& command_line) = 0; | 71 virtual void RestartJob(int pid, const std::string& command_line) = 0; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Create() should be used instead. | 179 // Create() should be used instead. |
170 SessionManagerClient(); | 180 SessionManagerClient(); |
171 | 181 |
172 private: | 182 private: |
173 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 183 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
174 }; | 184 }; |
175 | 185 |
176 } // namespace chromeos | 186 } // namespace chromeos |
177 | 187 |
178 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 188 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
OLD | NEW |