Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromeos / dbus / gsm_sms_client.h
blobafbae3845f956e1027f958fa4d0f52c530165e4f
1 // Copyright (c) 2012 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_GSM_SMS_CLIENT_H_
6 #define CHROMEOS_DBUS_GSM_SMS_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client.h"
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
20 namespace dbus {
21 class ObjectPath;
24 namespace chromeos {
26 // GsmSMSClient is used to communicate with the
27 // org.freedesktop.ModemManager.Modem.Gsm.SMS service.
28 // All methods should be called from the origin thread (UI thread) which
29 // initializes the DBusThreadManager instance.
30 class CHROMEOS_EXPORT GsmSMSClient : public DBusClient {
31 public:
32 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler;
33 typedef base::Callback<void()> DeleteCallback;
34 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback;
35 typedef base::Callback<void(const base::ListValue& result)> ListCallback;
37 ~GsmSMSClient() override;
39 // Factory function, creates a new instance and returns ownership.
40 // For normal usage, access the singleton via DBusThreadManager::Get().
41 static GsmSMSClient* Create();
43 // Sets SmsReceived signal handler.
44 virtual void SetSmsReceivedHandler(const std::string& service_name,
45 const dbus::ObjectPath& object_path,
46 const SmsReceivedHandler& handler) = 0;
48 // Resets SmsReceived signal handler.
49 virtual void ResetSmsReceivedHandler(const std::string& service_name,
50 const dbus::ObjectPath& object_path) = 0;
52 // Calls Delete method. |callback| is called after the method call succeeds.
53 virtual void Delete(const std::string& service_name,
54 const dbus::ObjectPath& object_path,
55 uint32 index,
56 const DeleteCallback& callback) = 0;
58 // Calls Get method. |callback| is called after the method call succeeds.
59 virtual void Get(const std::string& service_name,
60 const dbus::ObjectPath& object_path,
61 uint32 index,
62 const GetCallback& callback) = 0;
64 // Calls List method. |callback| is called after the method call succeeds.
65 virtual void List(const std::string& service_name,
66 const dbus::ObjectPath& object_path,
67 const ListCallback& callback) = 0;
69 // Requests a check for new messages. In shill this does nothing. The
70 // stub implementation uses it to generate a sequence of test messages.
71 virtual void RequestUpdate(const std::string& service_name,
72 const dbus::ObjectPath& object_path) = 0;
74 protected:
75 friend class GsmSMSClientTest;
77 // Create() should be used instead.
78 GsmSMSClient();
80 private:
81 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient);
84 } // namespace chromeos
86 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_