blob: aed121ee45c494fd420fb8803b75f5137d08cfeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_
#define CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_
#include "base/callback.h"
#include "base/observer_list.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/dbus_client_implementation_type.h"
#include <string>
namespace dbus {
class Bus;
} // namespace
namespace chromeos {
// SessionManagerClient is used to communicate with the session manager.
class CHROMEOS_EXPORT SessionManagerClient {
public:
// Interface for observing changes from the session manager.
class Observer {
public:
// Called when the owner key is set.
virtual void OwnerKeySet(bool success) {}
// Called when the property change is complete.
virtual void PropertyChangeComplete(bool success) {}
// Called when the screen is locked.
virtual void LockScreen() {}
// Called when the screen is unlocked.
virtual void UnlockScreen() {}
};
// Adds and removes the observer.
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
virtual bool HasObserver(Observer* observer) = 0;
// Kicks off an attempt to emit the "login-prompt-ready" upstart signal.
virtual void EmitLoginPromptReady() = 0;
// Kicks off an attempt to emit the "login-prompt-visible" upstart signal.
virtual void EmitLoginPromptVisible() = 0;
// Restarts a job referenced by |pid| with the provided command line.
virtual void RestartJob(int pid, const std::string& command_line) = 0;
// Restarts entd (the enterprise daemon).
// DEPRECATED: will be deleted soon.
virtual void RestartEntd() = 0;
// Starts the session for the user.
virtual void StartSession(const std::string& user_email) = 0;
// Stops the current session.
virtual void StopSession() = 0;
// Locks the screen.
virtual void RequestLockScreen() = 0;
// Unlocks the screen.
virtual void RequestUnlockScreen() = 0;
// Returns whether or not the screen is locked. Implementation should cache
// this state so that it can return immediately. Useful for observers that
// need to know the current screen lock state when they are added.
virtual bool GetIsScreenLocked() = 0;
// Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized
// protocol buffer as string. Upon success, we will pass a protobuf to the
// callback. On failure, we will pass "".
typedef base::Callback<void(const std::string&)> RetrievePolicyCallback;
// Fetches the device policy blob stored by the session manager. Upon
// completion of the retrieve attempt, we will call the provided callback.
virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0;
// Fetches the user policy blob stored by the session manager for the
// currently signed-in user. Upon completion of the retrieve attempt, we will
// call the provided callback.
virtual void RetrieveUserPolicy(const RetrievePolicyCallback& callback) = 0;
// Used for StoreDevicePolicy and StoreUserPolicy. Takes a boolean indicating
// whether the operation was successful or not.
typedef base::Callback<void(bool)> StorePolicyCallback;
// Attempts to asynchronously store |policy_blob| as device policy. Upon
// completion of the store attempt, we will call callback.
virtual void StoreDevicePolicy(const std::string& policy_blob,
const StorePolicyCallback& callback) = 0;
// Attempts to asynchronously store |policy_blob| as user policy for the
// currently signed-in user. Upon completion of the store attempt, we will
// call callback.
virtual void StoreUserPolicy(const std::string& policy_blob,
const StorePolicyCallback& callback) = 0;
// Creates the instance.
static SessionManagerClient* Create(DBusClientImplementationType type,
dbus::Bus* bus);
virtual ~SessionManagerClient();
protected:
// Create() should be used instead.
SessionManagerClient();
private:
DISALLOW_COPY_AND_ASSIGN(SessionManagerClient);
};
} // namespace chromeos
#endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_
|