Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: chrome/browser/chromeos/dbus/session_manager_client.h

Issue 8295019: chromeos: Implement the new D-Bus client for SessionManagerClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/dbus/session_manager_client.h
diff --git a/chrome/browser/chromeos/dbus/session_manager_client.h b/chrome/browser/chromeos/dbus/session_manager_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9b0bcb6d27d2ae72acca4890076d38a267a4d66
--- /dev/null
+++ b/chrome/browser/chromeos/dbus/session_manager_client.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_
+#define CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_
+
+#include "base/callback.h"
+#include "base/observer_list.h"
+
+#include <string>
+
+namespace dbus {
+class Bus;
+} // namespace
+
+namespace chromeos {
+
+// SessionManagerClient is used to communicate with the session manager.
+class 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) {}
+ };
+
+ // Adds and removes the observer.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(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).
+ virtual void RestartEntd() = 0;
Chris Masone 2011/10/18 16:32:41 This is deprecated; we can either remove it now, o
satorux1 2011/10/18 17:49:44 RestartEntd() is called from browser/chromeos/ente
Chris Masone 2011/10/18 17:55:44 I believe so, but kmixter and rginda would know fo
+
+ // Starts the session for the user.
+ virtual void StartSession(const std::string& user_email) = 0;
+
+ // Stops the current session.
+ virtual void StopSession() = 0;
+
+ // Used for RetrievePolicy. Takes a serialized protocol buffer as string.
+ typedef base::Callback<void(const std::string&)> RetrievePolicyCallback;
+
+ // Fetches the policy blob stored by the session manager. Upon
+ // completion of the retrieve attempt, we will call the provided
+ // callback. Policies are serialized protocol buffers. Upon success,
+ // we will pass a protobuf to the callback. On failure, we will pass
+ // NULL.
+ virtual void RetrievePolicy(RetrievePolicyCallback callback) = 0;
Chris Masone 2011/10/18 16:32:41 When I wrote this originally, davemoore indicated
satorux1 2011/10/18 17:49:44 Good point. I expect all D-Bus method calls to be
Chris Masone 2011/10/18 17:55:44 Fair enough
+
+ // Used for StorePolicyCallback. Takes a bollean indicating whether the
Chris Masone 2011/10/18 16:32:41 nit: boolean
satorux1 2011/10/18 17:49:44 Done.
+ // operation was successful or not.
+ typedef base::Callback<void(bool)> StorePolicyCallback;
+
+ // Attempts to store the policy blob |policy_blob| asynchronously.
+ // Upon completion of the store attempt, we will call callback(delegate, ...)
+ virtual void StorePolicy(const std::string& policy_bob,
Chris Masone 2011/10/18 16:32:41 Same comment as above.
satorux1 2011/10/18 17:49:44 Done.
+ StorePolicyCallback callback) = 0;
+
+ // Creates the instance.
+ static SessionManagerClient* Create(dbus::Bus* bus);
+
+ virtual ~SessionManagerClient();
+
+ protected:
+ // Create() should be used instead.
+ SessionManagerClient();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SessionManagerClient);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_DBUS_SESSION_MANAGER_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698