summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 08:46:49 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 08:46:49 +0000
commita3f64b2e2bd0b5432d8987b44d134c14984e1f19 (patch)
treedec710a17a795c3f053629ad41f3713d45c47185 /chromeos
parent467942904773f060caf9fecd5fb80ef9a604bdf4 (diff)
downloadchromium_src-a3f64b2e2bd0b5432d8987b44d134c14984e1f19.zip
chromium_src-a3f64b2e2bd0b5432d8987b44d134c14984e1f19.tar.gz
chromium_src-a3f64b2e2bd0b5432d8987b44d134c14984e1f19.tar.bz2
Add NetworkStateHandler::GetDeviceListByType.
The addition of the bluetooth type is required because of the DeviceStatusCollectorNetworkInterfacesTest.NetworkInterfaces test and the GetDeviceList() function now does a match of the device's type to NetworkTypePattern::Default(). BUG=323537 R=stevenjb@chromium.org Review URL: https://codereview.chromium.org/99133016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/network/network_state_handler.cc7
-rw-r--r--chromeos/network/network_state_handler.h4
-rw-r--r--chromeos/network/shill_property_util.cc6
3 files changed, 14 insertions, 3 deletions
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc
index 78346dc..89ec141 100644
--- a/chromeos/network/network_state_handler.cc
+++ b/chromeos/network/network_state_handler.cc
@@ -276,13 +276,18 @@ void NetworkStateHandler::GetNetworkListByType(const NetworkTypePattern& type,
}
void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const {
+ GetDeviceListByType(NetworkTypePattern::Default(), list);
+}
+
+void NetworkStateHandler::GetDeviceListByType(const NetworkTypePattern& type,
+ DeviceStateList* list) const {
DCHECK(list);
list->clear();
for (ManagedStateList::const_iterator iter = device_list_.begin();
iter != device_list_.end(); ++iter) {
const DeviceState* device = (*iter)->AsDeviceState();
DCHECK(device);
- if (device->update_received())
+ if (device->update_received() && device->Matches(type))
list->push_back(device);
}
}
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h
index c45a0d9..6f6d978 100644
--- a/chromeos/network/network_state_handler.h
+++ b/chromeos/network/network_state_handler.h
@@ -163,6 +163,10 @@ class CHROMEOS_EXPORT NetworkStateHandler
// only on the UI thread).
void GetDeviceList(DeviceStateList* list) const;
+ // Like GetDeviceList() but only returns networks with matching |type|.
+ void GetDeviceListByType(const NetworkTypePattern& type,
+ DeviceStateList* list) const;
+
// Sets |list| to contain the list of favorite (aka "preferred") networks.
// See GetNetworkList() for usage, and notes for |favorite_list_|.
// Favorites that are visible have the same path() as the entries in
diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc
index 31709b3..d0d33d3 100644
--- a/chromeos/network/shill_property_util.cc
+++ b/chromeos/network/shill_property_util.cc
@@ -280,7 +280,8 @@ enum NetworkTypeBitFlag {
kNetworkTypeWimax = 1 << 2,
kNetworkTypeCellular = 1 << 3,
kNetworkTypeVPN = 1 << 4,
- kNetworkTypeEthernetEap = 1 << 5
+ kNetworkTypeEthernetEap = 1 << 5,
+ kNetworkTypeBluetooth = 1 << 6
};
struct ShillToBitFlagEntry {
@@ -292,7 +293,8 @@ struct ShillToBitFlagEntry {
{ shill::kTypeWifi, kNetworkTypeWifi },
{ shill::kTypeWimax, kNetworkTypeWimax },
{ shill::kTypeCellular, kNetworkTypeCellular },
- { shill::kTypeVPN, kNetworkTypeVPN }
+ { shill::kTypeVPN, kNetworkTypeVPN },
+ { shill::kTypeBluetooth, kNetworkTypeBluetooth }
};
NetworkTypeBitFlag ShillNetworkTypeToFlag(const std::string& shill_type) {