summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/dbus_client.h
blob: d52de3e6591d7af3fcf0a2c7c70ce2d9d1385478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2013 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 CHROMEOS_DBUS_DBUS_CLIENT_H_
#define CHROMEOS_DBUS_DBUS_CLIENT_H_

#include "base/basictypes.h"

namespace dbus {
class Bus;
}  // namespace dbus

namespace chromeos {

// Interface for all DBus clients handled by DBusThreadManager. It restricts
// access to the Init function to DBusThreadManager only to prevent
// incorrect calls. Stub clients may lift that restriction however.
class DBusClient {
 protected:
  virtual ~DBusClient() {}

  // This function is called by DBusThreadManager. Only in unit tests, which
  // don't use DBusThreadManager, this function can be called through Stub
  // implementations (they change Init's member visibility to public).
  virtual void Init(dbus::Bus* bus) = 0;

 private:
  friend class DBusThreadManager;

  DISALLOW_ASSIGN(DBusClient);
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_DBUS_CLIENT_H_