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