sms_client.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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.
4
5#ifndef CHROMEOS_DBUS_SMS_CLIENT_H_
6#define CHROMEOS_DBUS_SMS_CLIENT_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/callback.h"
12#include "chromeos/chromeos_export.h"
13#include "chromeos/dbus/dbus_client.h"
14
15namespace base {
16class DictionaryValue;
17}
18
19namespace dbus {
20class ObjectPath;
21}
22
23namespace chromeos {
24
25// SMSMessageClient is used to communicate with the
26// org.freedesktop.ModemManager1.SMS service.  All methods should be
27// called from the origin thread (UI thread) which initializes the
28// DBusThreadManager instance.
29class CHROMEOS_EXPORT SMSClient : public DBusClient {
30 public:
31  typedef base::Callback<void(const base::DictionaryValue& sms)> GetAllCallback;
32
33  virtual ~SMSClient();
34
35  // Factory function, creates a new instance and returns ownership.
36  // For normal usage, access the singleton via DBusThreadManager::Get().
37  static SMSClient* Create();
38
39  // Calls GetAll method.  |callback| is called after the method call succeeds.
40  virtual void GetAll(const std::string& service_name,
41                      const dbus::ObjectPath& object_path,
42                      const GetAllCallback& callback) = 0;
43
44 protected:
45  // Create() should be used instead.
46  SMSClient();
47
48 private:
49  DISALLOW_COPY_AND_ASSIGN(SMSClient);
50};
51
52}  // namespace chromeos
53
54#endif  // CHROMEOS_DBUS_SMS_CLIENT_H_
55