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

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

Issue 175243004: Chrome OS: Use Manager.DefaultService for Default Network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/fake_shill_service_client.h" 5 #include "chromeos/dbus/fake_shill_service_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 provider->SetWithoutPathExpansion(property, value.DeepCopy()); 391 provider->SetWithoutPathExpansion(property, value.DeepCopy());
392 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); 392 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider);
393 changed_property = shill::kProviderProperty; 393 changed_property = shill::kProviderProperty;
394 } else { 394 } else {
395 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); 395 new_properties.SetWithoutPathExpansion(property, value.DeepCopy());
396 changed_property = property; 396 changed_property = property;
397 } 397 }
398 398
399 dict->MergeDictionary(&new_properties); 399 dict->MergeDictionary(&new_properties);
400 400
401 if (property == shill::kStateProperty) { 401 // First Shill notifies Chrome of the property change.
402 // When State changes the sort order of Services may change.
403 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
404 SortManagerServices();
405 }
406
407 base::MessageLoop::current()->PostTask( 402 base::MessageLoop::current()->PostTask(
408 FROM_HERE, 403 FROM_HERE,
409 base::Bind(&FakeShillServiceClient::NotifyObserversPropertyChanged, 404 base::Bind(&FakeShillServiceClient::NotifyObserversPropertyChanged,
410 weak_ptr_factory_.GetWeakPtr(), 405 weak_ptr_factory_.GetWeakPtr(),
411 dbus::ObjectPath(service_path), changed_property)); 406 dbus::ObjectPath(service_path), changed_property));
407
408 // Next, if the State changes, the sort order of Services may change and the
409 // DefaultService property may change.
410 if (property == shill::kStateProperty) {
411 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
412 SortManagerServices();
413 }
414
412 return true; 415 return true;
413 } 416 }
414 417
415 const base::DictionaryValue* FakeShillServiceClient::GetServiceProperties( 418 const base::DictionaryValue* FakeShillServiceClient::GetServiceProperties(
416 const std::string& service_path) const { 419 const std::string& service_path) const {
417 const base::DictionaryValue* properties = NULL; 420 const base::DictionaryValue* properties = NULL;
418 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); 421 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties);
419 return properties; 422 return properties;
420 } 423 }
421 424
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 base::StringValue(shill::kErrorBadPassphrase))); 558 base::StringValue(shill::kErrorBadPassphrase)));
556 } else { 559 } else {
557 // Set Online. 560 // Set Online.
558 SetServiceProperty(service_path, 561 SetServiceProperty(service_path,
559 shill::kStateProperty, 562 shill::kStateProperty,
560 base::StringValue(shill::kStateOnline)); 563 base::StringValue(shill::kStateOnline));
561 } 564 }
562 } 565 }
563 566
564 } // namespace chromeos 567 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698