Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 1 | // 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 Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 9 | |
| 10 | #include <base/basictypes.h> |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 11 | #include <base/observer_list.h> |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 12 | |
| 13 | namespace cros_disks { |
| 14 | |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 15 | class SessionManagerObserverInterface; |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 16 | |
| 17 | // A proxy class that listens to DBus signals from the session manager and |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 18 | // notifies a list of registered observers for events. |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 19 | class SessionManagerProxy : public DBus::InterfaceProxy, |
| 20 | public DBus::ObjectProxy { |
| 21 | public: |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 22 | explicit SessionManagerProxy(DBus::Connection* connection); |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 23 | |
| 24 | ~SessionManagerProxy(); |
| 25 | |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 26 | void AddObserver(SessionManagerObserverInterface* observer); |
| 27 | |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 28 | private: |
| 29 | // Handles the SessionStateChanged DBus signal. |
| 30 | void OnSessionStateChanged(const DBus::SignalMessage& signal); |
| 31 | |
Ben Chan | 89cf29e | 2011-08-10 13:11:05 -0700 | [diff] [blame^] | 32 | ObserverList<SessionManagerObserverInterface> observer_list_; |
Ben Chan | 6e72692 | 2011-06-28 15:54:32 -0700 | [diff] [blame] | 33 | |
| 34 | DISALLOW_COPY_AND_ASSIGN(SessionManagerProxy); |
| 35 | }; |
| 36 | |
| 37 | } // namespace cros_disks |
| 38 | |
| 39 | #endif // CROS_DISKS_SESSION_MANAGER_PROXY_H_ |