OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ |
6 #define CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ | 6 #define CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/dbus/dbus_client_implementation_type.h" | 14 #include "chromeos/dbus/dbus_client_implementation_type.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 class ListValue; | 18 class ListValue; |
19 } | 19 } |
20 | 20 |
21 namespace dbus { | 21 namespace dbus { |
22 class Bus; | 22 class Bus; |
23 class ObjectPath; | 23 class ObjectPath; |
24 } | 24 } |
25 | 25 |
26 namespace chromeos { | 26 namespace chromeos { |
27 | 27 |
28 // GsmSMSClient is used to communicate with | 28 // GsmSMSClient is used to communicate with the |
29 // org.freedesktop.ModemManager.Modem.Gsm.SMS service. | 29 // org.freedesktop.ModemManager.Modem.Gsm.SMS service. |
30 // All methods should be called from the origin thread (UI thread) which | 30 // All methods should be called from the origin thread (UI thread) which |
31 // initializes the DBusThreadManager instance. | 31 // initializes the DBusThreadManager instance. |
32 class CHROMEOS_EXPORT GsmSMSClient { | 32 class CHROMEOS_EXPORT GsmSMSClient { |
33 public: | 33 public: |
34 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler; | 34 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler; |
35 typedef base::Callback<void()> DeleteCallback; | 35 typedef base::Callback<void()> DeleteCallback; |
36 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback; | 36 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback; |
37 typedef base::Callback<void(const base::ListValue& result)> ListCallback; | 37 typedef base::Callback<void(const base::ListValue& result)> ListCallback; |
38 | 38 |
39 virtual ~GsmSMSClient(); | 39 virtual ~GsmSMSClient(); |
40 | 40 |
41 // Factory function, creates a new instance and returns ownership. | 41 // Factory function, creates a new instance and returns ownership. |
42 // For normal usage, access the singleton via DBusThreadManager::Get(). | 42 // For normal usage, access the singleton via DBusThreadManager::Get(). |
43 static GsmSMSClient* Create(DBusClientImplementationType type, | 43 static GsmSMSClient* Create(DBusClientImplementationType type, |
44 dbus::Bus* bus); | 44 dbus::Bus* bus); |
45 | 45 |
46 // Sets DataPlansUpdate signal handler. | 46 // Sets SmsReceived signal handler. |
47 virtual void SetSmsReceivedHandler(const std::string& service_name, | 47 virtual void SetSmsReceivedHandler(const std::string& service_name, |
48 const dbus::ObjectPath& object_path, | 48 const dbus::ObjectPath& object_path, |
49 const SmsReceivedHandler& handler) = 0; | 49 const SmsReceivedHandler& handler) = 0; |
50 | 50 |
51 // Resets DataPlansUpdate signal handler. | 51 // Resets SmsReceived signal handler. |
52 virtual void ResetSmsReceivedHandler(const std::string& service_name, | 52 virtual void ResetSmsReceivedHandler(const std::string& service_name, |
53 const dbus::ObjectPath& object_path) = 0; | 53 const dbus::ObjectPath& object_path) = 0; |
54 | 54 |
55 // Calls Delete method. |callback| is called after the method call succeeds. | 55 // Calls Delete method. |callback| is called after the method call succeeds. |
56 virtual void Delete(const std::string& service_name, | 56 virtual void Delete(const std::string& service_name, |
57 const dbus::ObjectPath& object_path, | 57 const dbus::ObjectPath& object_path, |
58 uint32 index, | 58 uint32 index, |
59 const DeleteCallback& callback) = 0; | 59 const DeleteCallback& callback) = 0; |
60 | 60 |
61 // Calls Get method. |callback| is called after the method call succeeds. | 61 // Calls Get method. |callback| is called after the method call succeeds. |
(...skipping 16 matching lines...) Expand all Loading... |
78 // Create() should be used instead. | 78 // Create() should be used instead. |
79 GsmSMSClient(); | 79 GsmSMSClient(); |
80 | 80 |
81 private: | 81 private: |
82 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient); | 82 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace chromeos | 85 } // namespace chromeos |
86 | 86 |
87 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ | 87 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ |
OLD | NEW |