Commit 06de9b74 authored by Abhishek Bhardwaj's avatar Abhishek Bhardwaj Committed by Commit Bot

arc: Remove deprecated GetNetworks API

This changes removes the deprecated GetNetworks API.

BUG=907245
TEST=Boot and test ARC++ WiFi apps.

Change-Id: Iec0f9e18ba6a709af6e40d205503e5c1bf2545cb
Reviewed-on: https://chromium-review.googlesource.com/c/1344991Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611013}
parent 14fc2482
......@@ -177,6 +177,7 @@ struct AndroidVpnConfiguration {
};
// Next Method ID: 14
// ID 3 is missing as it belonged to a deprecated method.
interface NetHost {
// Sends a request to get enabled / disabled status of WiFi.
GetWifiEnabledState@1() => (bool is_enabled);
......@@ -184,10 +185,6 @@ interface NetHost {
// Sends a request to start scan of WiFi APs.
[MinVersion=1] StartScan@2();
// Sends a request to get configured or visible WiFi networks based on the
// request type.
[MinVersion=2] GetNetworksDeprecated@3(GetNetworksRequestType type) => (NetworkData data);
// Sends a request to enable or disable WiFi. The |result| is true when the
// the state has been successfully set or WiFi is already in the desired
// state. It is false if WiFi manipulation is prohibited due to a policy or
......
......@@ -446,84 +446,6 @@ void ArcNetHostImpl::OnConnectionClosed() {
observing_network_state_ = false;
}
void ArcNetHostImpl::GetNetworksDeprecated(
mojom::GetNetworksRequestType type,
GetNetworksDeprecatedCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
mojom::NetworkDataPtr data = mojom::NetworkData::New();
bool configured_only = true;
bool visible_only = false;
if (type == mojom::GetNetworksRequestType::VISIBLE_ONLY) {
configured_only = false;
visible_only = true;
}
// Retrieve list of nearby WiFi networks.
chromeos::NetworkTypePattern network_pattern =
chromeos::onc::NetworkTypePatternFromOncType(onc::network_type::kWiFi);
std::unique_ptr<base::ListValue> network_properties_list =
chromeos::network_util::TranslateNetworkListToONC(
network_pattern, configured_only, visible_only,
kGetNetworksListLimit);
// Extract info for each network and add it to the list.
// Even if there's no WiFi, an empty (size=0) list must be returned and not a
// null one. The explicitly sized New() constructor ensures the non-null
// property.
std::vector<mojom::WifiConfigurationPtr> networks;
for (const auto& value : *network_properties_list) {
mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New();
const base::DictionaryValue* network_dict = nullptr;
value.GetAsDictionary(&network_dict);
DCHECK(network_dict);
// kName is a post-processed version of kHexSSID.
std::string tmp;
network_dict->GetString(onc::network_config::kName, &tmp);
DCHECK(!tmp.empty());
wc->ssid = tmp;
tmp.clear();
network_dict->GetString(onc::network_config::kGUID, &tmp);
DCHECK(!tmp.empty());
wc->guid = tmp;
const base::DictionaryValue* wifi_dict = nullptr;
network_dict->GetDictionary(onc::network_config::kWiFi, &wifi_dict);
DCHECK(wifi_dict);
if (!wifi_dict->GetInteger(onc::wifi::kFrequency, &wc->frequency))
wc->frequency = 0;
if (!wifi_dict->GetInteger(onc::wifi::kSignalStrength,
&wc->signal_strength))
wc->signal_strength = 0;
if (!wifi_dict->GetString(onc::wifi::kSecurity, &tmp))
NOTREACHED();
DCHECK(!tmp.empty());
wc->security = tmp;
if (!wifi_dict->GetString(onc::wifi::kBSSID, &tmp))
NOTREACHED();
DCHECK(!tmp.empty());
wc->bssid = tmp;
mojom::VisibleNetworkDetailsPtr details =
mojom::VisibleNetworkDetails::New();
details->frequency = wc->frequency;
details->signal_strength = wc->signal_strength;
details->bssid = wc->bssid;
wc->details = mojom::NetworkDetails::New();
wc->details->set_visible(std::move(details));
networks.push_back(std::move(wc));
}
data->networks = std::move(networks);
std::move(callback).Run(std::move(data));
}
void ArcNetHostImpl::GetNetworks(mojom::GetNetworksRequestType type,
GetNetworksCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
......
......@@ -54,9 +54,6 @@ class ArcNetHostImpl : public KeyedService,
// ARC -> Chrome calls:
void GetNetworksDeprecated(mojom::GetNetworksRequestType type,
GetNetworksDeprecatedCallback callback) override;
void GetNetworks(mojom::GetNetworksRequestType type,
GetNetworksCallback callback) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment