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_NETWORK_NETWORK_SMS_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_SMS_HANDLER_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_SMS_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_SMS_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 }; | 31 }; |
32 | 32 |
33 NetworkSmsHandler(); | 33 NetworkSmsHandler(); |
34 ~NetworkSmsHandler(); | 34 ~NetworkSmsHandler(); |
35 | 35 |
36 // Requests the devices from the netowork manager, sets up observers, and | 36 // Requests the devices from the netowork manager, sets up observers, and |
37 // requests the initial list of messages. Any observers that wish to be | 37 // requests the initial list of messages. Any observers that wish to be |
38 // notified with initial messages should be added before calling this. | 38 // notified with initial messages should be added before calling this. |
39 void Init(); | 39 void Init(); |
40 | 40 |
| 41 // Requests an immediate check for new messages. |
| 42 void RequestUpdate(); |
| 43 |
41 void AddObserver(Observer* observer); | 44 void AddObserver(Observer* observer); |
42 void RemoveObserver(Observer* observer); | 45 void RemoveObserver(Observer* observer); |
43 | 46 |
44 private: | 47 private: |
45 class NetworkSmsDeviceHandler; | 48 class NetworkSmsDeviceHandler; |
46 | 49 |
47 // Called from NetworkSmsDeviceHandler when a message is received. | 50 // Called from NetworkSmsDeviceHandler when a message is received. |
48 void NotifyMessageReceived(const base::DictionaryValue& message); | 51 void NotifyMessageReceived(const base::DictionaryValue& message); |
49 | 52 |
50 // Callback to handle the manager properties with the list of devices. | 53 // Callback to handle the manager properties with the list of devices. |
51 void ManagerPropertiesCallback(DBusMethodCallStatus call_status, | 54 void ManagerPropertiesCallback(DBusMethodCallStatus call_status, |
52 const base::DictionaryValue& properties); | 55 const base::DictionaryValue& properties); |
53 | 56 |
54 // Callback to handle the device properties for |device_path|. | 57 // Callback to handle the device properties for |device_path|. |
55 // A NetworkSmsDeviceHandler will be instantiated for each cellular device. | 58 // A NetworkSmsDeviceHandler will be instantiated for each cellular device. |
56 void DevicePropertiesCallback(const std::string& device_path, | 59 void DevicePropertiesCallback(const std::string& device_path, |
57 DBusMethodCallStatus call_status, | 60 DBusMethodCallStatus call_status, |
58 const base::DictionaryValue& properties); | 61 const base::DictionaryValue& properties); |
59 | 62 |
60 ObserverList<Observer> observers_; | 63 ObserverList<Observer> observers_; |
61 ScopedVector<NetworkSmsDeviceHandler> device_handlers_; | 64 ScopedVector<NetworkSmsDeviceHandler> device_handlers_; |
62 base::WeakPtrFactory<NetworkSmsHandler> weak_ptr_factory_; | 65 base::WeakPtrFactory<NetworkSmsHandler> weak_ptr_factory_; |
63 | 66 |
64 DISALLOW_COPY_AND_ASSIGN(NetworkSmsHandler); | 67 DISALLOW_COPY_AND_ASSIGN(NetworkSmsHandler); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace | 70 } // namespace |
68 | 71 |
69 #endif // CHROMEOS_NETWORK_NETWORK_SMS_HANDLER_H_ | 72 #endif // CHROMEOS_NETWORK_NETWORK_SMS_HANDLER_H_ |
OLD | NEW |