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_NETWORK_SMS_WATCHER_H_ 6#define CHROMEOS_NETWORK_SMS_WATCHER_H_ 7 8#include <string> 9#include <vector> 10 11#include "base/memory/weak_ptr.h" 12#include "chromeos/chromeos_export.h" 13#include "chromeos/dbus/dbus_method_call_status.h" 14#include "chromeos/network/cros_network_functions.h" 15#include "dbus/object_path.h" 16 17namespace base { 18 19class DictionaryValue; 20 21} // namespace base 22 23namespace chromeos { 24 25// Class to watch sms without Libcros. 26class CHROMEOS_EXPORT SMSWatcher : public CrosNetworkWatcher { 27 public: 28 // Dictionary key constants. 29 static const char kNumberKey[]; 30 static const char kTextKey[]; 31 static const char kTimestampKey[]; 32 static const char kSmscKey[]; 33 static const char kValidityKey[]; 34 static const char kClassKey[]; 35 static const char kIndexKey[]; 36 37 static const char kModemManager1NumberKey[]; 38 static const char kModemManager1TextKey[]; 39 static const char kModemManager1TimestampKey[]; 40 static const char kModemManager1SmscKey[]; 41 static const char kModemManager1ValidityKey[]; 42 static const char kModemManager1ClassKey[]; 43 static const char kModemManager1IndexKey[]; 44 45 // Base class of watcher implementation classes. Public to allow 46 // derived classes in the anonymous namespace to inherit from it. 47 class WatcherBase; 48 49 SMSWatcher(const std::string& modem_device_path, 50 MonitorSMSCallback callback); 51 virtual ~SMSWatcher(); 52 53 private: 54 // Callback for shill device's GetProperties() method. 55 void DevicePropertiesCallback(DBusMethodCallStatus call_status, 56 const base::DictionaryValue& properties); 57 58 base::WeakPtrFactory<SMSWatcher> weak_ptr_factory_; 59 std::string device_path_; 60 MonitorSMSCallback callback_; 61 scoped_ptr<WatcherBase> watcher_; 62 63 DISALLOW_COPY_AND_ASSIGN(SMSWatcher); 64}; 65 66} // namespace 67 68#endif // CHROMEOS_NETWORK_SMS_WATCHER_H_ 69