blob: 3b94416009c6ca7e5b0a42926fe4476b637b951f [file] [log] [blame]
Ben Chan6e726922011-06-28 15:54:32 -07001// Copyright (c) 2011 The Chromium OS 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 CROS_DISKS_SESSION_MANAGER_PROXY_H_
6#define CROS_DISKS_SESSION_MANAGER_PROXY_H_
7
8#include <dbus-c++/dbus.h> // NOLINT
Ben Chan6e726922011-06-28 15:54:32 -07009
10#include <base/basictypes.h>
Ben Chan89cf29e2011-08-10 13:11:05 -070011#include <base/observer_list.h>
Ben Chan6e726922011-06-28 15:54:32 -070012
13namespace cros_disks {
14
Ben Chan89cf29e2011-08-10 13:11:05 -070015class SessionManagerObserverInterface;
Ben Chan6e726922011-06-28 15:54:32 -070016
17// A proxy class that listens to DBus signals from the session manager and
Ben Chan89cf29e2011-08-10 13:11:05 -070018// notifies a list of registered observers for events.
Ben Chan6e726922011-06-28 15:54:32 -070019class SessionManagerProxy : public DBus::InterfaceProxy,
20 public DBus::ObjectProxy {
21 public:
Ben Chan89cf29e2011-08-10 13:11:05 -070022 explicit SessionManagerProxy(DBus::Connection* connection);
Ben Chan6e726922011-06-28 15:54:32 -070023
24 ~SessionManagerProxy();
25
Ben Chan89cf29e2011-08-10 13:11:05 -070026 void AddObserver(SessionManagerObserverInterface* observer);
27
Ben Chan6e726922011-06-28 15:54:32 -070028 private:
29 // Handles the SessionStateChanged DBus signal.
30 void OnSessionStateChanged(const DBus::SignalMessage& signal);
31
Ben Chan89cf29e2011-08-10 13:11:05 -070032 ObserverList<SessionManagerObserverInterface> observer_list_;
Ben Chan6e726922011-06-28 15:54:32 -070033
34 DISALLOW_COPY_AND_ASSIGN(SessionManagerProxy);
35};
36
37} // namespace cros_disks
38
39#endif // CROS_DISKS_SESSION_MANAGER_PROXY_H_