OLD | NEW |
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/network/network_device_handler_impl.h" | 5 #include "chromeos/network/network_device_handler_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 559 |
560 // If roaming is required by the provider, always try to set to true. | 560 // If roaming is required by the provider, always try to set to true. |
561 bool new_device_value = | 561 bool new_device_value = |
562 device_state->provider_requires_roaming() || cellular_allow_roaming_; | 562 device_state->provider_requires_roaming() || cellular_allow_roaming_; |
563 | 563 |
564 // Only set the value if the current value is different from | 564 // Only set the value if the current value is different from |
565 // |new_device_value|. | 565 // |new_device_value|. |
566 if (new_device_value == current_allow_roaming) | 566 if (new_device_value == current_allow_roaming) |
567 continue; | 567 continue; |
568 | 568 |
569 SetDevicePropertyInternal(device_state->path(), | 569 SetDevicePropertyInternal( |
570 shill::kCellularAllowRoamingProperty, | 570 device_state->path(), shill::kCellularAllowRoamingProperty, |
571 base::FundamentalValue(new_device_value), | 571 base::Value(new_device_value), base::Bind(&base::DoNothing), |
572 base::Bind(&base::DoNothing), | 572 network_handler::ErrorCallback()); |
573 network_handler::ErrorCallback()); | |
574 } | 573 } |
575 } | 574 } |
576 | 575 |
577 void NetworkDeviceHandlerImpl::ApplyMACAddressRandomizationToShill() { | 576 void NetworkDeviceHandlerImpl::ApplyMACAddressRandomizationToShill() { |
578 if (!mac_addr_randomization_supported_) | 577 if (!mac_addr_randomization_supported_) |
579 return; | 578 return; |
580 | 579 |
581 const DeviceState* device_state = | 580 const DeviceState* device_state = |
582 GetWifiDeviceState(network_handler::ErrorCallback()); | 581 GetWifiDeviceState(network_handler::ErrorCallback()); |
583 if (!device_state) | 582 if (!device_state) |
584 return; | 583 return; |
585 | 584 |
586 SetDevicePropertyInternal( | 585 SetDevicePropertyInternal( |
587 device_state->path(), shill::kMACAddressRandomizationProperty, | 586 device_state->path(), shill::kMACAddressRandomizationProperty, |
588 base::FundamentalValue(mac_addr_randomization_enabled_), | 587 base::Value(mac_addr_randomization_enabled_), |
589 base::Bind(&base::DoNothing), | 588 base::Bind(&base::DoNothing), |
590 base::Bind( | 589 base::Bind( |
591 &NetworkDeviceHandlerImpl::SetMACAddressRandomizationErrorCallback, | 590 &NetworkDeviceHandlerImpl::SetMACAddressRandomizationErrorCallback, |
592 weak_ptr_factory_.GetWeakPtr())); | 591 weak_ptr_factory_.GetWeakPtr())); |
593 } | 592 } |
594 | 593 |
595 void NetworkDeviceHandlerImpl::SetMACAddressRandomizationErrorCallback( | 594 void NetworkDeviceHandlerImpl::SetMACAddressRandomizationErrorCallback( |
596 const std::string& error_name, | 595 const std::string& error_name, |
597 std::unique_ptr<base::DictionaryValue> error_data) { | 596 std::unique_ptr<base::DictionaryValue> error_data) { |
598 if (error_name == NetworkDeviceHandler::kErrorNotSupported) | 597 if (error_name == NetworkDeviceHandler::kErrorNotSupported) |
(...skipping 11 matching lines...) Expand all Loading... |
610 new base::DictionaryValue); | 609 new base::DictionaryValue); |
611 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); | 610 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); |
612 error_callback.Run(kErrorDeviceMissing, std::move(error_data)); | 611 error_callback.Run(kErrorDeviceMissing, std::move(error_data)); |
613 return NULL; | 612 return NULL; |
614 } | 613 } |
615 | 614 |
616 return device_state; | 615 return device_state; |
617 } | 616 } |
618 | 617 |
619 } // namespace chromeos | 618 } // namespace chromeos |
OLD | NEW |