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

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

Issue 21131003: c++11 ud suffix fixes for cros dbus files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 (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_state_handler.h" 5 #include "chromeos/network/network_state_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 } 376 }
377 377
378 //------------------------------------------------------------------------------ 378 //------------------------------------------------------------------------------
379 // ShillPropertyHandler::Delegate overrides 379 // ShillPropertyHandler::Delegate overrides
380 380
381 void NetworkStateHandler::UpdateManagedList(ManagedState::ManagedType type, 381 void NetworkStateHandler::UpdateManagedList(ManagedState::ManagedType type,
382 const base::ListValue& entries) { 382 const base::ListValue& entries) {
383 ManagedStateList* managed_list = GetManagedList(type); 383 ManagedStateList* managed_list = GetManagedList(type);
384 NET_LOG_DEBUG(base::StringPrintf("UpdateManagedList:%d", type), 384 NET_LOG_DEBUG(base::StringPrintf("UpdateManagedList:%d", type),
385 base::StringPrintf("%"PRIuS, entries.GetSize())); 385 base::StringPrintf("%" PRIuS, entries.GetSize()));
386 // Create a map of existing entries. Assumes all entries in |managed_list| 386 // Create a map of existing entries. Assumes all entries in |managed_list|
387 // are unique. 387 // are unique.
388 std::map<std::string, ManagedState*> managed_map; 388 std::map<std::string, ManagedState*> managed_map;
389 for (ManagedStateList::iterator iter = managed_list->begin(); 389 for (ManagedStateList::iterator iter = managed_list->begin();
390 iter != managed_list->end(); ++iter) { 390 iter != managed_list->end(); ++iter) {
391 ManagedState* managed = *iter; 391 ManagedState* managed = *iter;
392 DCHECK(!ContainsKey(managed_map, managed->path())); 392 DCHECK(!ContainsKey(managed_map, managed->path()));
393 managed_map[managed->path()] = managed; 393 managed_map[managed->path()] = managed;
394 } 394 }
395 // Clear the list (pointers are temporarily owned by managed_map). 395 // Clear the list (pointers are temporarily owned by managed_map).
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 NET_LOG_DEBUG("NotifyManagerPropertyChanged", ""); 545 NET_LOG_DEBUG("NotifyManagerPropertyChanged", "");
546 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, 546 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
547 NetworkManagerChanged()); 547 NetworkManagerChanged());
548 } 548 }
549 549
550 void NetworkStateHandler::ManagedStateListChanged( 550 void NetworkStateHandler::ManagedStateListChanged(
551 ManagedState::ManagedType type) { 551 ManagedState::ManagedType type) {
552 if (type == ManagedState::MANAGED_TYPE_NETWORK) { 552 if (type == ManagedState::MANAGED_TYPE_NETWORK) {
553 // Notify observers that the list of networks has changed. 553 // Notify observers that the list of networks has changed.
554 NET_LOG_EVENT("NetworkListChanged", 554 NET_LOG_EVENT("NetworkListChanged",
555 base::StringPrintf("Size:%"PRIuS, network_list_.size())); 555 base::StringPrintf("Size:%" PRIuS, network_list_.size()));
556 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, 556 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
557 NetworkListChanged()); 557 NetworkListChanged());
558 // The list order may have changed, so check if the default network changed. 558 // The list order may have changed, so check if the default network changed.
559 if (CheckDefaultNetworkChanged()) 559 if (CheckDefaultNetworkChanged())
560 OnDefaultNetworkChanged(); 560 OnDefaultNetworkChanged();
561 } else if (type == ManagedState::MANAGED_TYPE_FAVORITE) { 561 } else if (type == ManagedState::MANAGED_TYPE_FAVORITE) {
562 NET_LOG_DEBUG("FavoriteListChanged", 562 NET_LOG_DEBUG("FavoriteListChanged",
563 base::StringPrintf("Size:%"PRIuS, favorite_list_.size())); 563 base::StringPrintf("Size:%" PRIuS, favorite_list_.size()));
564 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, 564 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
565 NetworkListChanged()); 565 NetworkListChanged());
566 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { 566 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) {
567 NET_LOG_DEBUG("DeviceListChanged", 567 NET_LOG_DEBUG("DeviceListChanged",
568 base::StringPrintf("Size:%"PRIuS, device_list_.size())); 568 base::StringPrintf("Size:%" PRIuS, device_list_.size()));
569 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, 569 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
570 DeviceListChanged()); 570 DeviceListChanged());
571 } else { 571 } else {
572 NOTREACHED(); 572 NOTREACHED();
573 } 573 }
574 } 574 }
575 575
576 //------------------------------------------------------------------------------ 576 //------------------------------------------------------------------------------
577 // Private methods 577 // Private methods
578 578
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 connecting_network_.clear(); 662 connecting_network_.clear();
663 NET_LOG_EVENT("ClearConnectingNetwork", base::StringPrintf( 663 NET_LOG_EVENT("ClearConnectingNetwork", base::StringPrintf(
664 "%s:%s", GetManagedStateLogName(network).c_str(), 664 "%s:%s", GetManagedStateLogName(network).c_str(),
665 network->connection_state().c_str())); 665 network->connection_state().c_str()));
666 } 666 }
667 } 667 }
668 668
669 void NetworkStateHandler::ScanCompleted(const std::string& type) { 669 void NetworkStateHandler::ScanCompleted(const std::string& type) {
670 size_t num_callbacks = scan_complete_callbacks_.count(type); 670 size_t num_callbacks = scan_complete_callbacks_.count(type);
671 NET_LOG_EVENT("ScanCompleted", 671 NET_LOG_EVENT("ScanCompleted",
672 base::StringPrintf("%s:%"PRIuS, type.c_str(), num_callbacks)); 672 base::StringPrintf("%s:%" PRIuS, type.c_str(), num_callbacks));
673 if (num_callbacks == 0) 673 if (num_callbacks == 0)
674 return; 674 return;
675 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; 675 ScanCallbackList& callback_list = scan_complete_callbacks_[type];
676 for (ScanCallbackList::iterator iter = callback_list.begin(); 676 for (ScanCallbackList::iterator iter = callback_list.begin();
677 iter != callback_list.end(); ++iter) { 677 iter != callback_list.end(); ++iter) {
678 (*iter).Run(); 678 (*iter).Run();
679 } 679 }
680 scan_complete_callbacks_.erase(type); 680 scan_complete_callbacks_.erase(type);
681 } 681 }
682 682
683 std::string NetworkStateHandler::GetTechnologyForType( 683 std::string NetworkStateHandler::GetTechnologyForType(
684 const std::string& type) const { 684 const std::string& type) const {
685 if (type == kMatchTypeMobile) { 685 if (type == kMatchTypeMobile) {
686 if (shill_property_handler_->IsTechnologyAvailable(flimflam::kTypeWimax)) 686 if (shill_property_handler_->IsTechnologyAvailable(flimflam::kTypeWimax))
687 return flimflam::kTypeWimax; 687 return flimflam::kTypeWimax;
688 else 688 else
689 return flimflam::kTypeCellular; 689 return flimflam::kTypeCellular;
690 } 690 }
691 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || 691 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual ||
692 type == kMatchTypeWireless) { 692 type == kMatchTypeWireless) {
693 NOTREACHED(); 693 NOTREACHED();
694 return flimflam::kTypeWifi; 694 return flimflam::kTypeWifi;
695 } 695 }
696 return type; 696 return type;
697 } 697 }
698 698
699 } // namespace chromeos 699 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_event_log_unittest.cc ('k') | chromeos/network/shill_property_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698