| Index: chromeos/network/network_sms_handler.h
|
| diff --git a/chromeos/network/network_sms_handler.h b/chromeos/network/network_sms_handler.h
|
| index 5bbe09e8d1431e251eb445d16fd40fa1797e54d5..a32ceb7ecd2dfbe2ab0cf2b95fe834cd59667625 100644
|
| --- a/chromeos/network/network_sms_handler.h
|
| +++ b/chromeos/network/network_sms_handler.h
|
| @@ -10,14 +10,20 @@
|
| #include "base/memory/scoped_vector.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/observer_list.h"
|
| -#include "base/values.h"
|
| #include "chromeos/chromeos_export.h"
|
| #include "chromeos/dbus/dbus_method_call_status.h"
|
| +#include "chromeos/dbus/shill_property_changed_observer.h"
|
| +
|
| +namespace base {
|
| +class DictionaryValue;
|
| +class ListValue;
|
| +class Value;
|
| +}
|
|
|
| namespace chromeos {
|
|
|
| // Class to watch sms without Libcros.
|
| -class CHROMEOS_EXPORT NetworkSmsHandler {
|
| +class CHROMEOS_EXPORT NetworkSmsHandler : public ShillPropertyChangedObserver {
|
| public:
|
| static const char kNumberKey[];
|
| static const char kTextKey[];
|
| @@ -35,22 +41,35 @@ class CHROMEOS_EXPORT NetworkSmsHandler {
|
| NetworkSmsHandler();
|
| ~NetworkSmsHandler();
|
|
|
| - // Requests the devices from the netowork manager, sets up observers, and
|
| - // requests the initial list of messages. Any observers that wish to be
|
| - // notified with initial messages should be added before calling this.
|
| - void Init();
|
| + // Sets the global instance. Must be called before any calls to Get().
|
| + static void Initialize();
|
| +
|
| + // Destroys the global instance.
|
| + static void Shutdown();
|
| +
|
| + // Gets the global instance. Initialize() must be called first.
|
| + static NetworkSmsHandler* Get();
|
|
|
| - // Requests an immediate check for new messages.
|
| - void RequestUpdate();
|
| + // Requests an immediate check for new messages. If |request_existing| is
|
| + // true then also requests to be notified for any already received messages.
|
| + void RequestUpdate(bool request_existing);
|
|
|
| void AddObserver(Observer* observer);
|
| void RemoveObserver(Observer* observer);
|
|
|
| + // ShillPropertyChangedObserver
|
| + virtual void OnPropertyChanged(const std::string& name,
|
| + const base::Value& value) OVERRIDE;
|
| +
|
| private:
|
| class NetworkSmsDeviceHandler;
|
| class ModemManagerNetworkSmsDeviceHandler;
|
| class ModemManager1NetworkSmsDeviceHandler;
|
|
|
| + // Requests the devices from the network manager, sets up observers, and
|
| + // requests the initial list of messages.
|
| + void InitShillDevices();
|
| +
|
| // Called from NetworkSmsDeviceHandler when a message is received.
|
| void NotifyMessageReceived(const base::DictionaryValue& message);
|
|
|
| @@ -58,6 +77,9 @@ class CHROMEOS_EXPORT NetworkSmsHandler {
|
| void ManagerPropertiesCallback(DBusMethodCallStatus call_status,
|
| const base::DictionaryValue& properties);
|
|
|
| + // Requests properties for each entry in |devices|.
|
| + void UpdateDevices(const base::ListValue* devices);
|
| +
|
| // Callback to handle the device properties for |device_path|.
|
| // A NetworkSmsDeviceHandler will be instantiated for each cellular device.
|
| void DevicePropertiesCallback(const std::string& device_path,
|
| @@ -66,6 +88,7 @@ class CHROMEOS_EXPORT NetworkSmsHandler {
|
|
|
| ObserverList<Observer> observers_;
|
| ScopedVector<NetworkSmsDeviceHandler> device_handlers_;
|
| + ScopedVector<base::DictionaryValue> received_messages_;
|
| base::WeakPtrFactory<NetworkSmsHandler> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NetworkSmsHandler);
|
|
|