| 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 #include "chromeos/dbus/gsm_sms_client.h" | 4 #include "chromeos/dbus/gsm_sms_client.h" |
| 5 | 5 |
| 6 #include <map> | 6 #include <map> |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // The GsmSMSClient implementation. | 162 // The GsmSMSClient implementation. |
| 163 class GsmSMSClientImpl : public GsmSMSClient { | 163 class GsmSMSClientImpl : public GsmSMSClient { |
| 164 public: | 164 public: |
| 165 GsmSMSClientImpl() : bus_(NULL), proxies_deleter_(&proxies_) {} | 165 GsmSMSClientImpl() : bus_(NULL), proxies_deleter_(&proxies_) {} |
| 166 | 166 |
| 167 // GsmSMSClient override. | 167 // GsmSMSClient override. |
| 168 virtual void SetSmsReceivedHandler( | 168 virtual void SetSmsReceivedHandler( |
| 169 const std::string& service_name, | 169 const std::string& service_name, |
| 170 const dbus::ObjectPath& object_path, | 170 const dbus::ObjectPath& object_path, |
| 171 const SmsReceivedHandler& handler) OVERRIDE { | 171 const SmsReceivedHandler& handler) override { |
| 172 GetProxy(service_name, object_path)->SetSmsReceivedHandler(handler); | 172 GetProxy(service_name, object_path)->SetSmsReceivedHandler(handler); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // GsmSMSClient override. | 175 // GsmSMSClient override. |
| 176 virtual void ResetSmsReceivedHandler( | 176 virtual void ResetSmsReceivedHandler( |
| 177 const std::string& service_name, | 177 const std::string& service_name, |
| 178 const dbus::ObjectPath& object_path) OVERRIDE { | 178 const dbus::ObjectPath& object_path) override { |
| 179 GetProxy(service_name, object_path)->ResetSmsReceivedHandler(); | 179 GetProxy(service_name, object_path)->ResetSmsReceivedHandler(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // GsmSMSClient override. | 182 // GsmSMSClient override. |
| 183 virtual void Delete(const std::string& service_name, | 183 virtual void Delete(const std::string& service_name, |
| 184 const dbus::ObjectPath& object_path, | 184 const dbus::ObjectPath& object_path, |
| 185 uint32 index, | 185 uint32 index, |
| 186 const DeleteCallback& callback) OVERRIDE { | 186 const DeleteCallback& callback) override { |
| 187 GetProxy(service_name, object_path)->Delete(index, callback); | 187 GetProxy(service_name, object_path)->Delete(index, callback); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // GsmSMSClient override. | 190 // GsmSMSClient override. |
| 191 virtual void Get(const std::string& service_name, | 191 virtual void Get(const std::string& service_name, |
| 192 const dbus::ObjectPath& object_path, | 192 const dbus::ObjectPath& object_path, |
| 193 uint32 index, | 193 uint32 index, |
| 194 const GetCallback& callback) OVERRIDE { | 194 const GetCallback& callback) override { |
| 195 GetProxy(service_name, object_path)->Get(index, callback); | 195 GetProxy(service_name, object_path)->Get(index, callback); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // GsmSMSClient override. | 198 // GsmSMSClient override. |
| 199 virtual void List(const std::string& service_name, | 199 virtual void List(const std::string& service_name, |
| 200 const dbus::ObjectPath& object_path, | 200 const dbus::ObjectPath& object_path, |
| 201 const ListCallback& callback) OVERRIDE { | 201 const ListCallback& callback) override { |
| 202 GetProxy(service_name, object_path)->List(callback); | 202 GetProxy(service_name, object_path)->List(callback); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // GsmSMSClient override. | 205 // GsmSMSClient override. |
| 206 virtual void RequestUpdate(const std::string& service_name, | 206 virtual void RequestUpdate(const std::string& service_name, |
| 207 const dbus::ObjectPath& object_path) OVERRIDE { | 207 const dbus::ObjectPath& object_path) override { |
| 208 } | 208 } |
| 209 | 209 |
| 210 protected: | 210 protected: |
| 211 virtual void Init(dbus::Bus* bus) OVERRIDE { bus_ = bus; } | 211 virtual void Init(dbus::Bus* bus) override { bus_ = bus; } |
| 212 | 212 |
| 213 private: | 213 private: |
| 214 typedef std::map<std::pair<std::string, std::string>, SMSProxy*> ProxyMap; | 214 typedef std::map<std::pair<std::string, std::string>, SMSProxy*> ProxyMap; |
| 215 | 215 |
| 216 // Returns a SMSProxy for the given service name and object path. | 216 // Returns a SMSProxy for the given service name and object path. |
| 217 SMSProxy* GetProxy(const std::string& service_name, | 217 SMSProxy* GetProxy(const std::string& service_name, |
| 218 const dbus::ObjectPath& object_path) { | 218 const dbus::ObjectPath& object_path) { |
| 219 const ProxyMap::key_type key(service_name, object_path.value()); | 219 const ProxyMap::key_type key(service_name, object_path.value()); |
| 220 ProxyMap::iterator it = proxies_.find(key); | 220 ProxyMap::iterator it = proxies_.find(key); |
| 221 if (it != proxies_.end()) | 221 if (it != proxies_.end()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 242 GsmSMSClient::GsmSMSClient() {} | 242 GsmSMSClient::GsmSMSClient() {} |
| 243 | 243 |
| 244 GsmSMSClient::~GsmSMSClient() {} | 244 GsmSMSClient::~GsmSMSClient() {} |
| 245 | 245 |
| 246 // static | 246 // static |
| 247 GsmSMSClient* GsmSMSClient::Create() { | 247 GsmSMSClient* GsmSMSClient::Create() { |
| 248 return new GsmSMSClientImpl(); | 248 return new GsmSMSClientImpl(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace chromeos | 251 } // namespace chromeos |
| OLD | NEW |