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

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

Issue 12220113: Next phase for chrome.networkingPrivate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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
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_service_client.h" 5 #include "chromeos/dbus/shill_service_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/chromeos/chromeos_version.h" 8 #include "base/chromeos/chromeos_version.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/shill_manager_client.h"
12 #include "chromeos/dbus/shill_property_changed_observer.h" 14 #include "chromeos/dbus/shill_property_changed_observer.h"
13 #include "dbus/bus.h" 15 #include "dbus/bus.h"
14 #include "dbus/message.h" 16 #include "dbus/message.h"
15 #include "dbus/object_proxy.h" 17 #include "dbus/object_proxy.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
17 19
18 namespace chromeos { 20 namespace chromeos {
19 21
20 namespace { 22 namespace {
21 23
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const std::string& name, 242 const std::string& name,
241 const base::Value& value, 243 const base::Value& value,
242 const base::Closure& callback, 244 const base::Closure& callback,
243 const ErrorCallback& error_callback) OVERRIDE { 245 const ErrorCallback& error_callback) OVERRIDE {
244 base::DictionaryValue* dict = NULL; 246 base::DictionaryValue* dict = NULL;
245 if (!stub_services_.GetDictionaryWithoutPathExpansion( 247 if (!stub_services_.GetDictionaryWithoutPathExpansion(
246 service_path.value(), &dict)) { 248 service_path.value(), &dict)) {
247 error_callback.Run("StubError", "Service not found"); 249 error_callback.Run("StubError", "Service not found");
248 return; 250 return;
249 } 251 }
252 if (name == flimflam::kStateProperty) {
253 // If we connect to a service, then we move it to the top of the list in
254 // the manager client.
255 std::string state;
256 if (value.GetAsString(&state) && state == flimflam::kStateOnline) {
257 ShillManagerClient* manager_client =
258 DBusThreadManager::Get()->GetShillManagerClient();
259 manager_client->GetTestInterface()->RemoveService(service_path.value());
260 manager_client->GetTestInterface()->AddServiceAtIndex(
261 service_path.value(), 0, true);
stevenjb 2013/02/12 17:19:16 I'd like to avoid cross dependencies between these
Greg Spencer (Chromium) 2013/02/12 17:34:56 OK, but the reason for this is that I'm unable to
262 }
263 }
250 dict->SetWithoutPathExpansion(name, value.DeepCopy()); 264 dict->SetWithoutPathExpansion(name, value.DeepCopy());
251 MessageLoop::current()->PostTask( 265 MessageLoop::current()->PostTask(
252 FROM_HERE, 266 FROM_HERE,
253 base::Bind(&ShillServiceClientStubImpl::NotifyObserversPropertyChanged, 267 base::Bind(&ShillServiceClientStubImpl::NotifyObserversPropertyChanged,
254 weak_ptr_factory_.GetWeakPtr(), service_path, name)); 268 weak_ptr_factory_.GetWeakPtr(), service_path, name));
255 if (callback.is_null()) 269 if (callback.is_null())
256 return; 270 return;
257 MessageLoop::current()->PostTask(FROM_HERE, callback); 271 MessageLoop::current()->PostTask(FROM_HERE, callback);
258 } 272 }
259 273
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 ShillServiceClient* ShillServiceClient::Create( 552 ShillServiceClient* ShillServiceClient::Create(
539 DBusClientImplementationType type, 553 DBusClientImplementationType type,
540 dbus::Bus* bus) { 554 dbus::Bus* bus) {
541 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 555 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
542 return new ShillServiceClientImpl(bus); 556 return new ShillServiceClientImpl(bus);
543 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 557 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
544 return new ShillServiceClientStubImpl(); 558 return new ShillServiceClientStubImpl();
545 } 559 }
546 560
547 } // namespace chromeos 561 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698