| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/observer_list.h" | |
| 10 #include "chrome/browser/chromeos/dbus/dbus_client_implementation_type.h" | |
| 11 | |
| 12 #include <string> | |
| 13 | |
| 14 namespace dbus { | |
| 15 class Bus; | |
| 16 } // namespace | |
| 17 | |
| 18 namespace chromeos { | |
| 19 | |
| 20 // SessionManagerClient is used to communicate with the session manager. | |
| 21 class SessionManagerClient { | |
| 22 public: | |
| 23 // Interface for observing changes from the session manager. | |
| 24 class Observer { | |
| 25 public: | |
| 26 // Called when the owner key is set. | |
| 27 virtual void OwnerKeySet(bool success) {} | |
| 28 // Called when the property change is complete. | |
| 29 virtual void PropertyChangeComplete(bool success) {} | |
| 30 }; | |
| 31 | |
| 32 // Adds and removes the observer. | |
| 33 virtual void AddObserver(Observer* observer) = 0; | |
| 34 virtual void RemoveObserver(Observer* observer) = 0; | |
| 35 | |
| 36 // Kicks off an attempt to emit the "login-prompt-ready" upstart signal. | |
| 37 virtual void EmitLoginPromptReady() = 0; | |
| 38 | |
| 39 // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. | |
| 40 virtual void EmitLoginPromptVisible() = 0; | |
| 41 | |
| 42 // Restarts a job referenced by |pid| with the provided command line. | |
| 43 virtual void RestartJob(int pid, const std::string& command_line) = 0; | |
| 44 | |
| 45 // Restarts entd (the enterprise daemon). | |
| 46 // DEPRECATED: will be deleted soon. | |
| 47 virtual void RestartEntd() = 0; | |
| 48 | |
| 49 // Starts the session for the user. | |
| 50 virtual void StartSession(const std::string& user_email) = 0; | |
| 51 | |
| 52 // Stops the current session. | |
| 53 virtual void StopSession() = 0; | |
| 54 | |
| 55 // Used for RetrieveDevicePolicy and RetrieveUserPolicy. Takes a serialized | |
| 56 // protocol buffer as string. Upon success, we will pass a protobuf to the | |
| 57 // callback. On failure, we will pass "". | |
| 58 typedef base::Callback<void(const std::string&)> RetrievePolicyCallback; | |
| 59 | |
| 60 // Fetches the device policy blob stored by the session manager. Upon | |
| 61 // completion of the retrieve attempt, we will call the provided callback. | |
| 62 virtual void RetrieveDevicePolicy(RetrievePolicyCallback callback) = 0; | |
| 63 | |
| 64 // Fetches the user policy blob stored by the session manager for the | |
| 65 // currently signed-in user. Upon completion of the retrieve attempt, we will | |
| 66 // call the provided callback. | |
| 67 virtual void RetrieveUserPolicy(RetrievePolicyCallback callback) = 0; | |
| 68 | |
| 69 // Used for StoreDevicePolicy and StoreUserPolicy. Takes a boolean indicating | |
| 70 // whether the operation was successful or not. | |
| 71 typedef base::Callback<void(bool)> StorePolicyCallback; | |
| 72 | |
| 73 // Attempts to asynchronously store |policy_blob| as device policy. Upon | |
| 74 // completion of the store attempt, we will call callback. | |
| 75 virtual void StoreDevicePolicy(const std::string& policy_blob, | |
| 76 StorePolicyCallback callback) = 0; | |
| 77 | |
| 78 // Attempts to asynchronously store |policy_blob| as user policy for the | |
| 79 // currently signed-in user. Upon completion of the store attempt, we will | |
| 80 // call callback. | |
| 81 virtual void StoreUserPolicy(const std::string& policy_blob, | |
| 82 StorePolicyCallback callback) = 0; | |
| 83 | |
| 84 // Creates the instance. | |
| 85 static SessionManagerClient* Create(DBusClientImplementationType type, | |
| 86 dbus::Bus* bus); | |
| 87 | |
| 88 virtual ~SessionManagerClient(); | |
| 89 | |
| 90 protected: | |
| 91 // Create() should be used instead. | |
| 92 SessionManagerClient(); | |
| 93 | |
| 94 private: | |
| 95 DISALLOW_COPY_AND_ASSIGN(SessionManagerClient); | |
| 96 }; | |
| 97 | |
| 98 } // namespace chromeos | |
| 99 | |
| 100 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_ | |
| OLD | NEW |