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

Unified Diff: chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc

Issue 280023003: Implement networkingPrivate.getNetworks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nonchromeos Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
index 9b4ad43543ca09d5004592423341b8df9c805785..a84f5fd9ad10f0186552667ef6bf2aef2f4e24c6 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
@@ -210,6 +210,35 @@ void NetworkingPrivateCreateNetworkFunction::ResultCallback(
}
////////////////////////////////////////////////////////////////////////////////
+// NetworkingPrivateGetNetworksFunction
+
+NetworkingPrivateGetNetworksFunction::
+ ~NetworkingPrivateGetNetworksFunction() {
+}
+
+bool NetworkingPrivateGetNetworksFunction::RunAsync() {
+ scoped_ptr<api::GetNetworks::Params> params =
+ api::GetNetworks::Params::Create(*args_);
+ EXTENSION_FUNCTION_VALIDATE(params);
+
+ // TODO(stevenjb/mef): Apply filters (visible, configured).
+ NetworkingPrivateServiceClient* service_client =
+ NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile());
+
+ service_client->GetVisibleNetworks(
+ api::ToString(params->filter.network_type),
+ base::Bind(&NetworkingPrivateGetNetworksFunction::ResultCallback, this));
+
+ return true;
+}
+
+void NetworkingPrivateGetNetworksFunction::ResultCallback(
+ const base::ListValue& network_list) {
+ SetResult(network_list.DeepCopy());
+ SendResponse(true);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// NetworkingPrivateGetVisibleNetworksFunction
NetworkingPrivateGetVisibleNetworksFunction::
@@ -225,7 +254,7 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() {
NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile());
service_client->GetVisibleNetworks(
- api::GetVisibleNetworks::Params::ToString(params->type),
+ api::ToString(params->network_type),
base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::ResultCallback,
this));

Powered by Google App Engine
This is Rietveld 408576698