Index: chromeos/dbus/shill_profile_client.cc |
diff --git a/chromeos/dbus/shill_profile_client.cc b/chromeos/dbus/shill_profile_client.cc |
index 291c36a07cb807e27ce293a0410f433794033a0c..638b92f64a4769e4c214305224e814d824951963 100644 |
--- a/chromeos/dbus/shill_profile_client.cc |
+++ b/chromeos/dbus/shill_profile_client.cc |
@@ -5,8 +5,9 @@ |
#include "chromeos/dbus/shill_profile_client.h" |
#include "base/bind.h" |
+#include "base/containers/scoped_ptr_map.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
-#include "base/stl_util.h" |
#include "base/values.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "chromeos/dbus/shill_property_changed_observer.h" |
@@ -56,36 +57,35 @@ class ShillProfileClientImpl : public ShillProfileClient { |
void Init(dbus::Bus* bus) override { bus_ = bus; } |
private: |
- typedef std::map<std::string, ShillClientHelper*> HelperMap; |
+ typedef base::ScopedPtrMap<std::string, scoped_ptr<ShillClientHelper>> |
+ HelperMap; |
// Returns the corresponding ShillClientHelper for the profile. |
ShillClientHelper* GetHelper(const dbus::ObjectPath& profile_path); |
dbus::Bus* bus_; |
HelperMap helpers_; |
- STLValueDeleter<HelperMap> helpers_deleter_; |
DISALLOW_COPY_AND_ASSIGN(ShillProfileClientImpl); |
}; |
-ShillProfileClientImpl::ShillProfileClientImpl() |
- : bus_(NULL), |
- helpers_deleter_(&helpers_) { |
+ShillProfileClientImpl::ShillProfileClientImpl() : bus_(NULL) { |
} |
ShillClientHelper* ShillProfileClientImpl::GetHelper( |
const dbus::ObjectPath& profile_path) { |
- HelperMap::iterator it = helpers_.find(profile_path.value()); |
+ HelperMap::const_iterator it = helpers_.find(profile_path.value()); |
if (it != helpers_.end()) |
return it->second; |
// There is no helper for the profile, create it. |
dbus::ObjectProxy* object_proxy = |
bus_->GetObjectProxy(shill::kFlimflamServiceName, profile_path); |
- ShillClientHelper* helper = new ShillClientHelper(object_proxy); |
+ scoped_ptr<ShillClientHelper> helper(new ShillClientHelper(object_proxy)); |
helper->MonitorPropertyChanged(shill::kFlimflamProfileInterface); |
- helpers_.insert(HelperMap::value_type(profile_path.value(), helper)); |
- return helper; |
+ ShillClientHelper* helper_ptr = helper.get(); |
+ helpers_.insert(profile_path.value(), helper.Pass()); |
+ return helper_ptr; |
} |
void ShillProfileClientImpl::GetProperties( |