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

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

Issue 2061093002: Revert of Add support for MAC address randomization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chromeos/network/network_device_handler_impl.h ('k') | 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 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 callback, 425 callback,
426 base::Bind(&HandleShillCallFailure, device_path, error_callback)); 426 base::Bind(&HandleShillCallFailure, device_path, error_callback));
427 } 427 }
428 428
429 void NetworkDeviceHandlerImpl::SetCellularAllowRoaming( 429 void NetworkDeviceHandlerImpl::SetCellularAllowRoaming(
430 const bool allow_roaming) { 430 const bool allow_roaming) {
431 cellular_allow_roaming_ = allow_roaming; 431 cellular_allow_roaming_ = allow_roaming;
432 ApplyCellularAllowRoamingToShill(); 432 ApplyCellularAllowRoamingToShill();
433 } 433 }
434 434
435 void NetworkDeviceHandlerImpl::SetMACAddressRandomizationEnabled(
436 const bool enabled) {
437 mac_addr_randomization_ = enabled;
438 ApplyMACAddressRandomizationToShill();
439 }
440
441 void NetworkDeviceHandlerImpl::SetWifiTDLSEnabled( 435 void NetworkDeviceHandlerImpl::SetWifiTDLSEnabled(
442 const std::string& ip_or_mac_address, 436 const std::string& ip_or_mac_address,
443 bool enabled, 437 bool enabled,
444 const network_handler::StringResultCallback& callback, 438 const network_handler::StringResultCallback& callback,
445 const network_handler::ErrorCallback& error_callback) { 439 const network_handler::ErrorCallback& error_callback) {
446 const DeviceState* device_state = GetWifiDeviceState(error_callback); 440 const DeviceState* device_state = GetWifiDeviceState(error_callback);
447 if (!device_state) 441 if (!device_state)
448 return; 442 return;
449 443
450 TDLSOperationParams params; 444 TDLSOperationParams params;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 ->GetShillDeviceClient() 513 ->GetShillDeviceClient()
520 ->RemoveAllWakeOnPacketConnections(dbus::ObjectPath(device_state->path()), 514 ->RemoveAllWakeOnPacketConnections(dbus::ObjectPath(device_state->path()),
521 callback, 515 callback,
522 base::Bind(&HandleShillCallFailure, 516 base::Bind(&HandleShillCallFailure,
523 device_state->path(), 517 device_state->path(),
524 error_callback)); 518 error_callback));
525 } 519 }
526 520
527 void NetworkDeviceHandlerImpl::DeviceListChanged() { 521 void NetworkDeviceHandlerImpl::DeviceListChanged() {
528 ApplyCellularAllowRoamingToShill(); 522 ApplyCellularAllowRoamingToShill();
529 ApplyMACAddressRandomizationToShill();
530 } 523 }
531 524
532 NetworkDeviceHandlerImpl::NetworkDeviceHandlerImpl() 525 NetworkDeviceHandlerImpl::NetworkDeviceHandlerImpl()
533 : network_state_handler_(NULL), 526 : network_state_handler_(NULL),
534 cellular_allow_roaming_(false), 527 cellular_allow_roaming_(false) {}
535 mac_addr_randomization_(false) {}
536 528
537 void NetworkDeviceHandlerImpl::Init( 529 void NetworkDeviceHandlerImpl::Init(
538 NetworkStateHandler* network_state_handler) { 530 NetworkStateHandler* network_state_handler) {
539 DCHECK(network_state_handler); 531 DCHECK(network_state_handler);
540 network_state_handler_ = network_state_handler; 532 network_state_handler_ = network_state_handler;
541 network_state_handler_->AddObserver(this, FROM_HERE); 533 network_state_handler_->AddObserver(this, FROM_HERE);
542 } 534 }
543 535
544 void NetworkDeviceHandlerImpl::ApplyCellularAllowRoamingToShill() { 536 void NetworkDeviceHandlerImpl::ApplyCellularAllowRoamingToShill() {
545 NetworkStateHandler::DeviceStateList list; 537 NetworkStateHandler::DeviceStateList list;
(...skipping 19 matching lines...) Expand all
565 continue; 557 continue;
566 558
567 SetDevicePropertyInternal(device_state->path(), 559 SetDevicePropertyInternal(device_state->path(),
568 shill::kCellularAllowRoamingProperty, 560 shill::kCellularAllowRoamingProperty,
569 base::FundamentalValue(new_device_value), 561 base::FundamentalValue(new_device_value),
570 base::Bind(&base::DoNothing), 562 base::Bind(&base::DoNothing),
571 network_handler::ErrorCallback()); 563 network_handler::ErrorCallback());
572 } 564 }
573 } 565 }
574 566
575 void NetworkDeviceHandlerImpl::ApplyMACAddressRandomizationToShill() {
576 const DeviceState* device_state =
577 GetWifiDeviceState(network_handler::ErrorCallback());
578 if (!device_state)
579 return;
580
581 SetDevicePropertyInternal(device_state->path(),
582 shill::kMACAddressRandomizationProperty,
583 base::FundamentalValue(mac_addr_randomization_),
584 base::Bind(&base::DoNothing),
585 network_handler::ErrorCallback());
586 }
587
588 const DeviceState* NetworkDeviceHandlerImpl::GetWifiDeviceState( 567 const DeviceState* NetworkDeviceHandlerImpl::GetWifiDeviceState(
589 const network_handler::ErrorCallback& error_callback) { 568 const network_handler::ErrorCallback& error_callback) {
590 const DeviceState* device_state = 569 const DeviceState* device_state =
591 network_state_handler_->GetDeviceStateByType(NetworkTypePattern::WiFi()); 570 network_state_handler_->GetDeviceStateByType(NetworkTypePattern::WiFi());
592 if (!device_state) { 571 if (!device_state) {
593 if (error_callback.is_null()) 572 if (error_callback.is_null())
594 return NULL; 573 return NULL;
595 std::unique_ptr<base::DictionaryValue> error_data( 574 std::unique_ptr<base::DictionaryValue> error_data(
596 new base::DictionaryValue); 575 new base::DictionaryValue);
597 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); 576 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing);
598 error_callback.Run(kErrorDeviceMissing, std::move(error_data)); 577 error_callback.Run(kErrorDeviceMissing, std::move(error_data));
599 return NULL; 578 return NULL;
600 } 579 }
601 580
602 return device_state; 581 return device_state;
603 } 582 }
604 583
605 } // namespace chromeos 584 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_device_handler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698