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

Side by Side Diff: chromeos/network/network_configuration_handler.cc

Issue 243103004: Don't treat Shill ClearProperty errors as failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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/network/network_configuration_handler.h" 5 #include "chromeos/network/network_configuration_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 void NetworkConfigurationHandler::ClearPropertiesSuccessCallback( 393 void NetworkConfigurationHandler::ClearPropertiesSuccessCallback(
394 const std::string& service_path, 394 const std::string& service_path,
395 const std::vector<std::string>& names, 395 const std::vector<std::string>& names,
396 const base::Closure& callback, 396 const base::Closure& callback,
397 const network_handler::ErrorCallback& error_callback, 397 const network_handler::ErrorCallback& error_callback,
398 const base::ListValue& result) { 398 const base::ListValue& result) {
399 const std::string kClearPropertiesFailedError("Error.ClearPropertiesFailed"); 399 const std::string kClearPropertiesFailedError("Error.ClearPropertiesFailed");
400 DCHECK(names.size() == result.GetSize()) 400 DCHECK(names.size() == result.GetSize())
401 << "Incorrect result size from ClearProperties."; 401 << "Incorrect result size from ClearProperties.";
402 402
403 bool some_failed = false;
404 for (size_t i = 0; i < result.GetSize(); ++i) { 403 for (size_t i = 0; i < result.GetSize(); ++i) {
405 bool success = false; 404 bool success = false;
406 result.GetBoolean(i, &success); 405 result.GetBoolean(i, &success);
407 if (!success) { 406 if (!success) {
407 // If we try to clear a property that hasn't been set the clear will
pneubeck (no reviews) 2014/04/22 07:16:41 can this error be distinguished from other errors?
stevenjb 2014/04/22 19:06:23 I'm not sure what you mean by "this error". We do
pneubeck (no reviews) 2014/04/22 19:12:11 Oh, I meant whether the error 'tried to clear a no
408 // fail, so just log the error.
408 NET_LOG_ERROR("ClearProperties Failed: " + names[i], service_path); 409 NET_LOG_ERROR("ClearProperties Failed: " + names[i], service_path);
409 some_failed = true;
410 } 410 }
411 } 411 }
412 412
413 if (some_failed) { 413 callback.Run();
pneubeck (no reviews) 2014/04/22 07:16:41 seems unintentional to remove if (!callback.is_n
stevenjb 2014/04/22 19:06:23 Good catch, and you are correct, will do.
414 if (!error_callback.is_null()) {
415 scoped_ptr<base::DictionaryValue> error_data(
416 network_handler::CreateErrorData(
417 service_path, kClearPropertiesFailedError,
418 base::StringPrintf("Errors: %" PRIuS, result.GetSize())));
419 error_data->Set("errors", result.DeepCopy());
420 scoped_ptr<base::ListValue> name_list(new base::ListValue);
421 name_list->AppendStrings(names);
422 error_data->Set("names", name_list.release());
423 error_callback.Run(kClearPropertiesFailedError, error_data.Pass());
424 }
425 } else if (!callback.is_null()) {
426 callback.Run();
427 }
428 network_state_handler_->RequestUpdateForNetwork(service_path); 414 network_state_handler_->RequestUpdateForNetwork(service_path);
429 } 415 }
430 416
431 void NetworkConfigurationHandler::ClearPropertiesErrorCallback( 417 void NetworkConfigurationHandler::ClearPropertiesErrorCallback(
432 const std::string& service_path, 418 const std::string& service_path,
433 const network_handler::ErrorCallback& error_callback, 419 const network_handler::ErrorCallback& error_callback,
434 const std::string& dbus_error_name, 420 const std::string& dbus_error_name,
435 const std::string& dbus_error_message) { 421 const std::string& dbus_error_message) {
436 network_handler::ShillErrorCallbackFunction( 422 network_handler::ShillErrorCallbackFunction(
437 "Config.ClearProperties Failed", 423 "Config.ClearProperties Failed",
438 service_path, error_callback, 424 service_path, error_callback,
439 dbus_error_name, dbus_error_message); 425 dbus_error_name, dbus_error_message);
440 // Some properties may have changed so request an update regardless. 426 // Some properties may have changed so request an update regardless.
441 network_state_handler_->RequestUpdateForNetwork(service_path); 427 network_state_handler_->RequestUpdateForNetwork(service_path);
442 } 428 }
443 429
444 // static 430 // static
445 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 431 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
446 NetworkStateHandler* network_state_handler) { 432 NetworkStateHandler* network_state_handler) {
447 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 433 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
448 handler->Init(network_state_handler); 434 handler->Init(network_state_handler);
449 return handler; 435 return handler;
450 } 436 }
451 437
452 } // namespace chromeos 438 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698