OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/networking_private/networking_private_api.h" | 5 #include "extensions/browser/api/networking_private/networking_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 393 } |
394 | 394 |
395 std::unique_ptr<base::ListValue> enabled_networks_onc_types( | 395 std::unique_ptr<base::ListValue> enabled_networks_onc_types( |
396 GetDelegate(browser_context())->GetEnabledNetworkTypes()); | 396 GetDelegate(browser_context())->GetEnabledNetworkTypes()); |
397 if (!enabled_networks_onc_types) | 397 if (!enabled_networks_onc_types) |
398 return RespondNow(Error(networking_private::kErrorNotSupported)); | 398 return RespondNow(Error(networking_private::kErrorNotSupported)); |
399 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); | 399 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); |
400 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); | 400 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); |
401 iter != enabled_networks_onc_types->end(); ++iter) { | 401 iter != enabled_networks_onc_types->end(); ++iter) { |
402 std::string type; | 402 std::string type; |
403 if (!(*iter)->GetAsString(&type)) | 403 if (!iter->GetAsString(&type)) |
404 NOTREACHED(); | 404 NOTREACHED(); |
405 if (type == ::onc::network_type::kEthernet) { | 405 if (type == ::onc::network_type::kEthernet) { |
406 enabled_networks_list->AppendString( | 406 enabled_networks_list->AppendString( |
407 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); | 407 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); |
408 } else if (type == ::onc::network_type::kWiFi) { | 408 } else if (type == ::onc::network_type::kWiFi) { |
409 enabled_networks_list->AppendString( | 409 enabled_networks_list->AppendString( |
410 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); | 410 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); |
411 } else if (type == ::onc::network_type::kWimax) { | 411 } else if (type == ::onc::network_type::kWimax) { |
412 enabled_networks_list->AppendString( | 412 enabled_networks_list->AppendString( |
413 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); | 413 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 // private_api::GlobalPolicy is a subset of the global policy dictionary | 945 // private_api::GlobalPolicy is a subset of the global policy dictionary |
946 // (by definition), so use the api setter/getter to generate the subset. | 946 // (by definition), so use the api setter/getter to generate the subset. |
947 std::unique_ptr<private_api::GlobalPolicy> policy( | 947 std::unique_ptr<private_api::GlobalPolicy> policy( |
948 private_api::GlobalPolicy::FromValue(*policy_dict)); | 948 private_api::GlobalPolicy::FromValue(*policy_dict)); |
949 DCHECK(policy); | 949 DCHECK(policy); |
950 return RespondNow( | 950 return RespondNow( |
951 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); | 951 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); |
952 } | 952 } |
953 | 953 |
954 } // namespace extensions | 954 } // namespace extensions |
OLD | NEW |