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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Stops the current session. | 53 // Stops the current session. |
54 virtual void StopSession() = 0; | 54 virtual void StopSession() = 0; |
55 | 55 |
56 // Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized | 56 // Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized |
57 // protocol buffer as string. Upon success, we will pass a protobuf to the | 57 // protocol buffer as string. Upon success, we will pass a protobuf to the |
58 // callback. On failure, we will pass "". | 58 // callback. On failure, we will pass "". |
59 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; | 59 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; |
60 | 60 |
61 // Fetches the device policy blob stored by the session manager. Upon | 61 // Fetches the device policy blob stored by the session manager. Upon |
62 // completion of the retrieve attempt, we will call the provided callback. | 62 // completion of the retrieve attempt, we will call the provided callback. |
63 virtual void RetrieveDevicePolicy(RetrievePolicyCallback callback) = 0; | 63 virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0; |
64 | 64 |
65 // Fetches the user policy blob stored by the session manager for the | 65 // Fetches the user policy blob stored by the session manager for the |
66 // currently signed-in user. Upon completion of the retrieve attempt, we will | 66 // currently signed-in user. Upon completion of the retrieve attempt, we will |
67 // call the provided callback. | 67 // call the provided callback. |
68 virtual void RetrieveUserPolicy(RetrievePolicyCallback callback) = 0; | 68 virtual void RetrieveUserPolicy(const RetrievePolicyCallback& callback) = 0; |
69 | 69 |
70 // Used for StoreDevicePolicy and StoreUserPolicy. Takes a boolean indicating | 70 // Used for StoreDevicePolicy and StoreUserPolicy. Takes a boolean indicating |
71 // whether the operation was successful or not. | 71 // whether the operation was successful or not. |
72 typedef base::Callback<void(bool)> StorePolicyCallback; | 72 typedef base::Callback<void(bool)> StorePolicyCallback; |
73 | 73 |
74 // Attempts to asynchronously store |policy_blob| as device policy. Upon | 74 // Attempts to asynchronously store |policy_blob| as device policy. Upon |
75 // completion of the store attempt, we will call callback. | 75 // completion of the store attempt, we will call callback. |
76 virtual void StoreDevicePolicy(const std::string& policy_blob, | 76 virtual void StoreDevicePolicy(const std::string& policy_blob, |
77 StorePolicyCallback callback) = 0; | 77 const StorePolicyCallback& callback) = 0; |
78 | 78 |
79 // Attempts to asynchronously store |policy_blob| as user policy for the | 79 // Attempts to asynchronously store |policy_blob| as user policy for the |
80 // currently signed-in user. Upon completion of the store attempt, we will | 80 // currently signed-in user. Upon completion of the store attempt, we will |
81 // call callback. | 81 // call callback. |
82 virtual void StoreUserPolicy(const std::string& policy_blob, | 82 virtual void StoreUserPolicy(const std::string& policy_blob, |
83 StorePolicyCallback callback) = 0; | 83 const StorePolicyCallback& callback) = 0; |
84 | 84 |
85 // Creates the instance. | 85 // Creates the instance. |
86 static SessionManagerClient* Create(DBusClientImplementationType type, | 86 static SessionManagerClient* Create(DBusClientImplementationType type, |
87 dbus::Bus* bus); | 87 dbus::Bus* bus); |
88 | 88 |
89 virtual ~SessionManagerClient(); | 89 virtual ~SessionManagerClient(); |
90 | 90 |
91 protected: | 91 protected: |
92 // Create() should be used instead. | 92 // Create() should be used instead. |
93 SessionManagerClient(); | 93 SessionManagerClient(); |
94 | 94 |
95 private: | 95 private: |
96 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | 96 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace chromeos | 99 } // namespace chromeos |
100 | 100 |
101 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | 101 #endif // CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ |
OLD | NEW |