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

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

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaks Created 6 years, 5 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_manager_client.h" 5 #include "chromeos/dbus/fake_shill_manager_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 dbus::ObjectPath(best_service_), callback, error_callback); 353 dbus::ObjectPath(best_service_), callback, error_callback);
354 } 354 }
355 355
356 ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() { 356 ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() {
357 return this; 357 return this;
358 } 358 }
359 359
360 // ShillManagerClient::TestInterface overrides. 360 // ShillManagerClient::TestInterface overrides.
361 361
362 void FakeShillManagerClient::AddDevice(const std::string& device_path) { 362 void FakeShillManagerClient::AddDevice(const std::string& device_path) {
363 if (GetListProperty(shill::kDevicesProperty)->AppendIfNotPresent( 363 if (GetListProperty(shill::kDevicesProperty)
364 base::Value::CreateStringValue(device_path))) { 364 ->AppendIfNotPresent(new base::StringValue(device_path))) {
365 CallNotifyObserversPropertyChanged(shill::kDevicesProperty); 365 CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
366 } 366 }
367 } 367 }
368 368
369 void FakeShillManagerClient::RemoveDevice(const std::string& device_path) { 369 void FakeShillManagerClient::RemoveDevice(const std::string& device_path) {
370 base::StringValue device_path_value(device_path); 370 base::StringValue device_path_value(device_path);
371 if (GetListProperty(shill::kDevicesProperty)->Remove( 371 if (GetListProperty(shill::kDevicesProperty)->Remove(
372 device_path_value, NULL)) { 372 device_path_value, NULL)) {
373 CallNotifyObserversPropertyChanged(shill::kDevicesProperty); 373 CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
374 } 374 }
375 } 375 }
376 376
377 void FakeShillManagerClient::ClearDevices() { 377 void FakeShillManagerClient::ClearDevices() {
378 GetListProperty(shill::kDevicesProperty)->Clear(); 378 GetListProperty(shill::kDevicesProperty)->Clear();
379 CallNotifyObserversPropertyChanged(shill::kDevicesProperty); 379 CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
380 } 380 }
381 381
382 void FakeShillManagerClient::AddTechnology(const std::string& type, 382 void FakeShillManagerClient::AddTechnology(const std::string& type,
383 bool enabled) { 383 bool enabled) {
384 if (GetListProperty(shill::kAvailableTechnologiesProperty)-> 384 if (GetListProperty(shill::kAvailableTechnologiesProperty)
385 AppendIfNotPresent(base::Value::CreateStringValue(type))) { 385 ->AppendIfNotPresent(new base::StringValue(type))) {
386 CallNotifyObserversPropertyChanged( 386 CallNotifyObserversPropertyChanged(
387 shill::kAvailableTechnologiesProperty); 387 shill::kAvailableTechnologiesProperty);
388 } 388 }
389 if (enabled && 389 if (enabled &&
390 GetListProperty(shill::kEnabledTechnologiesProperty)-> 390 GetListProperty(shill::kEnabledTechnologiesProperty)
391 AppendIfNotPresent(base::Value::CreateStringValue(type))) { 391 ->AppendIfNotPresent(new base::StringValue(type))) {
392 CallNotifyObserversPropertyChanged( 392 CallNotifyObserversPropertyChanged(
393 shill::kEnabledTechnologiesProperty); 393 shill::kEnabledTechnologiesProperty);
394 } 394 }
395 } 395 }
396 396
397 void FakeShillManagerClient::RemoveTechnology(const std::string& type) { 397 void FakeShillManagerClient::RemoveTechnology(const std::string& type) {
398 base::StringValue type_value(type); 398 base::StringValue type_value(type);
399 if (GetListProperty(shill::kAvailableTechnologiesProperty)->Remove( 399 if (GetListProperty(shill::kAvailableTechnologiesProperty)->Remove(
400 type_value, NULL)) { 400 type_value, NULL)) {
401 CallNotifyObserversPropertyChanged( 401 CallNotifyObserversPropertyChanged(
402 shill::kAvailableTechnologiesProperty); 402 shill::kAvailableTechnologiesProperty);
403 } 403 }
404 if (GetListProperty(shill::kEnabledTechnologiesProperty)->Remove( 404 if (GetListProperty(shill::kEnabledTechnologiesProperty)->Remove(
405 type_value, NULL)) { 405 type_value, NULL)) {
406 CallNotifyObserversPropertyChanged( 406 CallNotifyObserversPropertyChanged(
407 shill::kEnabledTechnologiesProperty); 407 shill::kEnabledTechnologiesProperty);
408 } 408 }
409 } 409 }
410 410
411 void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type, 411 void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type,
412 bool initializing) { 412 bool initializing) {
413 if (initializing) { 413 if (initializing) {
414 if (GetListProperty(shill::kUninitializedTechnologiesProperty)-> 414 if (GetListProperty(shill::kUninitializedTechnologiesProperty)
415 AppendIfNotPresent(base::Value::CreateStringValue(type))) { 415 ->AppendIfNotPresent(new base::StringValue(type))) {
416 CallNotifyObserversPropertyChanged( 416 CallNotifyObserversPropertyChanged(
417 shill::kUninitializedTechnologiesProperty); 417 shill::kUninitializedTechnologiesProperty);
418 } 418 }
419 } else { 419 } else {
420 if (GetListProperty(shill::kUninitializedTechnologiesProperty)->Remove( 420 if (GetListProperty(shill::kUninitializedTechnologiesProperty)->Remove(
421 base::StringValue(type), NULL)) { 421 base::StringValue(type), NULL)) {
422 CallNotifyObserversPropertyChanged( 422 CallNotifyObserversPropertyChanged(
423 shill::kUninitializedTechnologiesProperty); 423 shill::kUninitializedTechnologiesProperty);
424 } 424 }
425 } 425 }
(...skipping 26 matching lines...) Expand all
452 void FakeShillManagerClient::SetManagerProperty(const std::string& key, 452 void FakeShillManagerClient::SetManagerProperty(const std::string& key,
453 const base::Value& value) { 453 const base::Value& value) {
454 SetProperty(key, value, 454 SetProperty(key, value,
455 base::Bind(&base::DoNothing), base::Bind(&LogErrorCallback)); 455 base::Bind(&base::DoNothing), base::Bind(&LogErrorCallback));
456 } 456 }
457 457
458 void FakeShillManagerClient::AddManagerService( 458 void FakeShillManagerClient::AddManagerService(
459 const std::string& service_path, 459 const std::string& service_path,
460 bool notify_observers) { 460 bool notify_observers) {
461 DVLOG(2) << "AddManagerService: " << service_path; 461 DVLOG(2) << "AddManagerService: " << service_path;
462 GetListProperty(shill::kServiceCompleteListProperty)->AppendIfNotPresent( 462 GetListProperty(shill::kServiceCompleteListProperty)
463 base::Value::CreateStringValue(service_path)); 463 ->AppendIfNotPresent(new base::StringValue(service_path));
464 SortManagerServices(false); 464 SortManagerServices(false);
465 if (notify_observers) 465 if (notify_observers)
466 CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); 466 CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
467 } 467 }
468 468
469 void FakeShillManagerClient::RemoveManagerService( 469 void FakeShillManagerClient::RemoveManagerService(
470 const std::string& service_path) { 470 const std::string& service_path) {
471 DVLOG(2) << "RemoveManagerService: " << service_path; 471 DVLOG(2) << "RemoveManagerService: " << service_path;
472 base::StringValue service_path_value(service_path); 472 base::StringValue service_path_value(service_path);
473 GetListProperty(shill::kServiceCompleteListProperty)->Remove( 473 GetListProperty(shill::kServiceCompleteListProperty)->Remove(
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 *enabled = true; 1029 *enabled = true;
1030 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || 1030 if ((state == shill::kStatePortal && type != shill::kTypeWifi) ||
1031 (state == kNetworkActivated && type != shill::kTypeCellular)) { 1031 (state == kNetworkActivated && type != shill::kTypeCellular)) {
1032 LOG(WARNING) << "Invalid state: " << state << " for " << type; 1032 LOG(WARNING) << "Invalid state: " << state << " for " << type;
1033 return shill::kStateIdle; 1033 return shill::kStateIdle;
1034 } 1034 }
1035 return state; 1035 return state;
1036 } 1036 }
1037 1037
1038 } // namespace chromeos 1038 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698