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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/dbus/dbus_client.h" | 13 #include "chromeos/dbus/dbus_client.h" |
14 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 class DictionaryValue; | 16 class DictionaryValue; |
18 class ListValue; | 17 class ListValue; |
19 } | 18 } |
20 | 19 |
21 namespace dbus { | 20 namespace dbus { |
22 class ObjectPath; | 21 class ObjectPath; |
23 } | 22 } |
24 | 23 |
25 namespace chromeos { | 24 namespace chromeos { |
26 | 25 |
27 // GsmSMSClient is used to communicate with the | 26 // GsmSMSClient is used to communicate with the |
28 // org.freedesktop.ModemManager.Modem.Gsm.SMS service. | 27 // org.freedesktop.ModemManager.Modem.Gsm.SMS service. |
29 // All methods should be called from the origin thread (UI thread) which | 28 // All methods should be called from the origin thread (UI thread) which |
30 // initializes the DBusThreadManager instance. | 29 // initializes the DBusThreadManager instance. |
31 class CHROMEOS_EXPORT GsmSMSClient : public DBusClient { | 30 class CHROMEOS_EXPORT GsmSMSClient : public DBusClient { |
32 public: | 31 public: |
33 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler; | 32 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler; |
34 typedef base::Callback<void()> DeleteCallback; | 33 typedef base::Callback<void()> DeleteCallback; |
35 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback; | 34 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback; |
36 typedef base::Callback<void(const base::ListValue& result)> ListCallback; | 35 typedef base::Callback<void(const base::ListValue& result)> ListCallback; |
37 | 36 |
38 virtual ~GsmSMSClient(); | 37 virtual ~GsmSMSClient(); |
39 | 38 |
40 // Factory function, creates a new instance and returns ownership. | 39 // Factory function, creates a new instance and returns ownership. |
41 // For normal usage, access the singleton via DBusThreadManager::Get(). | 40 // For normal usage, access the singleton via DBusThreadManager::Get(). |
42 static GsmSMSClient* Create(DBusClientImplementationType type); | 41 static GsmSMSClient* Create(); |
43 | 42 |
44 // Sets SmsReceived signal handler. | 43 // Sets SmsReceived signal handler. |
45 virtual void SetSmsReceivedHandler(const std::string& service_name, | 44 virtual void SetSmsReceivedHandler(const std::string& service_name, |
46 const dbus::ObjectPath& object_path, | 45 const dbus::ObjectPath& object_path, |
47 const SmsReceivedHandler& handler) = 0; | 46 const SmsReceivedHandler& handler) = 0; |
48 | 47 |
49 // Resets SmsReceived signal handler. | 48 // Resets SmsReceived signal handler. |
50 virtual void ResetSmsReceivedHandler(const std::string& service_name, | 49 virtual void ResetSmsReceivedHandler(const std::string& service_name, |
51 const dbus::ObjectPath& object_path) = 0; | 50 const dbus::ObjectPath& object_path) = 0; |
52 | 51 |
(...skipping 25 matching lines...) Expand all Loading... |
78 // Create() should be used instead. | 77 // Create() should be used instead. |
79 GsmSMSClient(); | 78 GsmSMSClient(); |
80 | 79 |
81 private: | 80 private: |
82 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient); | 81 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace chromeos | 84 } // namespace chromeos |
86 | 85 |
87 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ | 86 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ |
OLD | NEW |