Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 const std::string& match_type) { | 35 const std::string& match_type) { |
| 36 const std::string& type = managed->type(); | 36 const std::string& type = managed->type(); |
| 37 if (match_type == NetworkStateHandler::kMatchTypeDefault) | 37 if (match_type == NetworkStateHandler::kMatchTypeDefault) |
| 38 return true; | 38 return true; |
| 39 if (match_type == type) | 39 if (match_type == type) |
| 40 return true; | 40 return true; |
| 41 if (match_type == NetworkStateHandler::kMatchTypeNonVirtual && | 41 if (match_type == NetworkStateHandler::kMatchTypeNonVirtual && |
| 42 type != flimflam::kTypeVPN) { | 42 type != flimflam::kTypeVPN) { |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 if (match_type == NetworkStateHandler::kMatchTypeWired && | |
| 46 (type == flimflam::kTypeEthernet || type == shill::kTypeEthernetEap)) { | |
| 47 return true; | |
| 48 } | |
| 45 if (match_type == NetworkStateHandler::kMatchTypeWireless && | 49 if (match_type == NetworkStateHandler::kMatchTypeWireless && |
| 46 type != flimflam::kTypeEthernet && type != flimflam::kTypeVPN) { | 50 type != flimflam::kTypeEthernet && type != shill::kTypeEthernetEap && |
| 51 type != flimflam::kTypeVPN) { | |
| 47 return true; | 52 return true; |
| 48 } | 53 } |
| 49 if (match_type == NetworkStateHandler::kMatchTypeMobile && | 54 if (match_type == NetworkStateHandler::kMatchTypeMobile && |
| 50 (type == flimflam::kTypeCellular || type == flimflam::kTypeWimax)) { | 55 (type == flimflam::kTypeCellular || type == flimflam::kTypeWimax)) { |
| 51 return true; | 56 return true; |
| 52 } | 57 } |
| 53 return false; | 58 return false; |
| 54 } | 59 } |
| 55 | 60 |
| 56 bool ConnectionStateChanged(NetworkState* network, | 61 bool ConnectionStateChanged(NetworkState* network, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 76 std::string GetManagedStateLogName(const ManagedState* state) { | 81 std::string GetManagedStateLogName(const ManagedState* state) { |
| 77 if (!state) | 82 if (!state) |
| 78 return "None"; | 83 return "None"; |
| 79 return base::StringPrintf("%s (%s)", state->name().c_str(), | 84 return base::StringPrintf("%s (%s)", state->name().c_str(), |
| 80 state->path().c_str()); | 85 state->path().c_str()); |
| 81 } | 86 } |
| 82 | 87 |
| 83 } // namespace | 88 } // namespace |
| 84 | 89 |
| 85 const char NetworkStateHandler::kMatchTypeDefault[] = "default"; | 90 const char NetworkStateHandler::kMatchTypeDefault[] = "default"; |
| 91 const char NetworkStateHandler::kMatchTypeWired[] = "wired"; | |
| 86 const char NetworkStateHandler::kMatchTypeWireless[] = "wireless"; | 92 const char NetworkStateHandler::kMatchTypeWireless[] = "wireless"; |
| 87 const char NetworkStateHandler::kMatchTypeMobile[] = "mobile"; | 93 const char NetworkStateHandler::kMatchTypeMobile[] = "mobile"; |
| 88 const char NetworkStateHandler::kMatchTypeNonVirtual[] = "non-virtual"; | 94 const char NetworkStateHandler::kMatchTypeNonVirtual[] = "non-virtual"; |
| 89 const char NetworkStateHandler::kDefaultCheckPortalList[] = | 95 const char NetworkStateHandler::kDefaultCheckPortalList[] = |
| 90 "ethernet,wifi,cellular"; | 96 "ethernet,wifi,cellular"; |
| 91 | 97 |
| 92 NetworkStateHandler::NetworkStateHandler() { | 98 NetworkStateHandler::NetworkStateHandler() { |
| 93 } | 99 } |
| 94 | 100 |
| 95 NetworkStateHandler::~NetworkStateHandler() { | 101 NetworkStateHandler::~NetworkStateHandler() { |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; | 726 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; |
| 721 for (ScanCallbackList::iterator iter = callback_list.begin(); | 727 for (ScanCallbackList::iterator iter = callback_list.begin(); |
| 722 iter != callback_list.end(); ++iter) { | 728 iter != callback_list.end(); ++iter) { |
| 723 (*iter).Run(); | 729 (*iter).Run(); |
| 724 } | 730 } |
| 725 scan_complete_callbacks_.erase(type); | 731 scan_complete_callbacks_.erase(type); |
| 726 } | 732 } |
| 727 | 733 |
| 728 std::string NetworkStateHandler::GetTechnologyForType( | 734 std::string NetworkStateHandler::GetTechnologyForType( |
| 729 const std::string& type) const { | 735 const std::string& type) const { |
| 736 if (type == kMatchTypeWired || type == shill::kTypeEthernetEap) | |
|
stevenjb
2013/08/28 15:51:30
Another place where IsTypeWired(type) would be hel
pneubeck (no reviews)
2013/09/02 20:41:21
Since the old |type| argument could be a pattern/M
| |
| 737 return flimflam::kTypeEthernet; | |
| 738 | |
| 730 if (type == kMatchTypeMobile) { | 739 if (type == kMatchTypeMobile) { |
| 731 if (shill_property_handler_->IsTechnologyAvailable(flimflam::kTypeWimax)) | 740 if (shill_property_handler_->IsTechnologyAvailable(flimflam::kTypeWimax)) |
| 732 return flimflam::kTypeWimax; | 741 return flimflam::kTypeWimax; |
| 733 else | 742 else |
| 734 return flimflam::kTypeCellular; | 743 return flimflam::kTypeCellular; |
| 735 } | 744 } |
| 736 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || | 745 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || |
| 737 type == kMatchTypeWireless) { | 746 type == kMatchTypeWireless) { |
| 738 NOTREACHED(); | 747 NOTREACHED(); |
| 739 return flimflam::kTypeWifi; | 748 return flimflam::kTypeWifi; |
| 740 } | 749 } |
| 741 return type; | 750 return type; |
| 742 } | 751 } |
| 743 | 752 |
| 744 } // namespace chromeos | 753 } // namespace chromeos |
| OLD | NEW |