Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromeos / dbus / amplifier_client.h
blobc63a286ff9e0e6b651531c16a8b8ccdc92b4fe18
1 // Copyright 2015 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.
5 #ifndef CHROMEOS_DBUS_AMPLIFIER_CLIENT_H_
6 #define CHROMEOS_DBUS_AMPLIFIER_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "chromeos/chromeos_export.h"
10 #include "chromeos/dbus/dbus_client.h"
11 #include "chromeos/dbus/dbus_method_call_status.h"
13 namespace chromeos {
15 // A DBus client class for the org.chromium.Amplifier service.
16 class CHROMEOS_EXPORT AmplifierClient : public DBusClient {
17 public:
18 // Interface for observing amplifier events from an amplifier client.
19 class Observer {
20 public:
21 virtual ~Observer() {}
22 // Called when the Error signal is received.
23 virtual void OnError(int32 error_code) = 0;
26 ~AmplifierClient() override;
28 // Adds and removes observers for amplifier events.
29 virtual void AddObserver(Observer* observer) = 0;
30 virtual void RemoveObserver(Observer* observer) = 0;
32 // Factory function; creates a new instance which is owned by the caller.
33 // For normal usage, access the singleton via DBusThreadManager::Get().
34 static AmplifierClient* Create();
36 // Calls Initialize method.
37 // |callback| will be called with a DBusMethodCallStatus indicating whether
38 // the DBus method call succeeded, and a bool that is the return value from
39 // the DBus method.
40 virtual void Initialize(const BoolDBusMethodCallback& callback) = 0;
42 // Calls SetStandbyMode method.
43 // |callback| will be called with a DBusMethodCallStatus indicating whether
44 // the DBus method call succeeded.
45 virtual void SetStandbyMode(bool standby,
46 const VoidDBusMethodCallback& callback) = 0;
48 // Calls SetVolume method.
49 // |callback| will be called with a DBusMethodCallStatus indicating whether
50 // the DBus method call succeeded.
51 virtual void SetVolume(double db_spl,
52 const VoidDBusMethodCallback& callback) = 0;
54 protected:
55 // Create() should be used instead.
56 AmplifierClient();
58 private:
59 DISALLOW_COPY_AND_ASSIGN(AmplifierClient);
62 } // namespace chromeos
64 #endif // CHROMEOS_DBUS_AMPLIFIER_CLIENT_H_