Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chromeos/dbus/shill_ipconfig_client.cc

Issue 11361211: chromeos: Remove unused CrosAddIPConfig/CrosRemoveIPConfig functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/shill_ipconfig_client.h ('k') | chromeos/dbus/shill_ipconfig_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chromeos/dbus/shill_ipconfig_client.h" 5 #include "chromeos/dbus/shill_ipconfig_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const dbus::ObjectPath& ipconfig_path) OVERRIDE; 46 const dbus::ObjectPath& ipconfig_path) OVERRIDE;
47 virtual void SetProperty(const dbus::ObjectPath& ipconfig_path, 47 virtual void SetProperty(const dbus::ObjectPath& ipconfig_path,
48 const std::string& name, 48 const std::string& name,
49 const base::Value& value, 49 const base::Value& value,
50 const VoidDBusMethodCallback& callback) OVERRIDE; 50 const VoidDBusMethodCallback& callback) OVERRIDE;
51 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, 51 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path,
52 const std::string& name, 52 const std::string& name,
53 const VoidDBusMethodCallback& callback) OVERRIDE; 53 const VoidDBusMethodCallback& callback) OVERRIDE;
54 virtual void Remove(const dbus::ObjectPath& ipconfig_path, 54 virtual void Remove(const dbus::ObjectPath& ipconfig_path,
55 const VoidDBusMethodCallback& callback) OVERRIDE; 55 const VoidDBusMethodCallback& callback) OVERRIDE;
56 virtual bool CallRemoveAndBlock(
57 const dbus::ObjectPath& ipconfig_path) OVERRIDE;
58 56
59 private: 57 private:
60 typedef std::map<std::string, ShillClientHelper*> HelperMap; 58 typedef std::map<std::string, ShillClientHelper*> HelperMap;
61 59
62 // Returns the corresponding ShillClientHelper for the profile. 60 // Returns the corresponding ShillClientHelper for the profile.
63 ShillClientHelper* GetHelper(const dbus::ObjectPath& ipconfig_path) { 61 ShillClientHelper* GetHelper(const dbus::ObjectPath& ipconfig_path) {
64 HelperMap::iterator it = helpers_.find(ipconfig_path.value()); 62 HelperMap::iterator it = helpers_.find(ipconfig_path.value());
65 if (it != helpers_.end()) 63 if (it != helpers_.end())
66 return it->second; 64 return it->second;
67 65
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 162 }
165 163
166 void ShillIPConfigClientImpl::Remove( 164 void ShillIPConfigClientImpl::Remove(
167 const dbus::ObjectPath& ipconfig_path, 165 const dbus::ObjectPath& ipconfig_path,
168 const VoidDBusMethodCallback& callback) { 166 const VoidDBusMethodCallback& callback) {
169 dbus::MethodCall method_call(flimflam::kFlimflamIPConfigInterface, 167 dbus::MethodCall method_call(flimflam::kFlimflamIPConfigInterface,
170 flimflam::kRemoveConfigFunction); 168 flimflam::kRemoveConfigFunction);
171 GetHelper(ipconfig_path)->CallVoidMethod(&method_call, callback); 169 GetHelper(ipconfig_path)->CallVoidMethod(&method_call, callback);
172 } 170 }
173 171
174 bool ShillIPConfigClientImpl::CallRemoveAndBlock(
175 const dbus::ObjectPath& ipconfig_path) {
176 dbus::MethodCall method_call(flimflam::kFlimflamIPConfigInterface,
177 flimflam::kRemoveConfigFunction);
178 return GetHelper(ipconfig_path)->CallVoidMethodAndBlock(&method_call);
179 }
180
181 // A stub implementation of ShillIPConfigClient. 172 // A stub implementation of ShillIPConfigClient.
182 class ShillIPConfigClientStubImpl : public ShillIPConfigClient { 173 class ShillIPConfigClientStubImpl : public ShillIPConfigClient {
183 public: 174 public:
184 ShillIPConfigClientStubImpl() : weak_ptr_factory_(this) {} 175 ShillIPConfigClientStubImpl() : weak_ptr_factory_(this) {}
185 176
186 virtual ~ShillIPConfigClientStubImpl() {} 177 virtual ~ShillIPConfigClientStubImpl() {}
187 178
188 /////////////////////////////////////////////// 179 ///////////////////////////////////////////////
189 // ShillIPConfigClient overrides: 180 // ShillIPConfigClient overrides:
190 virtual void AddPropertyChangedObserver( 181 virtual void AddPropertyChangedObserver(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 MessageLoop::current()->PostTask( 215 MessageLoop::current()->PostTask(
225 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); 216 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
226 } 217 }
227 218
228 virtual void Remove(const dbus::ObjectPath& ipconfig_path, 219 virtual void Remove(const dbus::ObjectPath& ipconfig_path,
229 const VoidDBusMethodCallback& callback) OVERRIDE { 220 const VoidDBusMethodCallback& callback) OVERRIDE {
230 MessageLoop::current()->PostTask( 221 MessageLoop::current()->PostTask(
231 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); 222 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
232 } 223 }
233 224
234 virtual bool CallRemoveAndBlock(
235 const dbus::ObjectPath& ipconfig_path) OVERRIDE {
236 return true;
237 }
238
239 private: 225 private:
240 // Runs callback with |properties_|. 226 // Runs callback with |properties_|.
241 void PassProperties(const DictionaryValueCallback& callback) const { 227 void PassProperties(const DictionaryValueCallback& callback) const {
242 callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_); 228 callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_);
243 } 229 }
244 230
245 base::DictionaryValue properties_; 231 base::DictionaryValue properties_;
246 232
247 // Note: This should remain the last member so it'll be destroyed and 233 // Note: This should remain the last member so it'll be destroyed and
248 // invalidate its weak pointers before any other members are destroyed. 234 // invalidate its weak pointers before any other members are destroyed.
(...skipping 12 matching lines...) Expand all
261 ShillIPConfigClient* ShillIPConfigClient::Create( 247 ShillIPConfigClient* ShillIPConfigClient::Create(
262 DBusClientImplementationType type, 248 DBusClientImplementationType type,
263 dbus::Bus* bus) { 249 dbus::Bus* bus) {
264 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 250 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
265 return new ShillIPConfigClientImpl(bus); 251 return new ShillIPConfigClientImpl(bus);
266 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 252 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
267 return new ShillIPConfigClientStubImpl(); 253 return new ShillIPConfigClientStubImpl();
268 } 254 }
269 255
270 } // namespace chromeos 256 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_ipconfig_client.h ('k') | chromeos/dbus/shill_ipconfig_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698