| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 | 364 |
| 365 std::unique_ptr<base::ListValue> enabled_networks_onc_types( | 365 std::unique_ptr<base::ListValue> enabled_networks_onc_types( |
| 366 GetDelegate(browser_context())->GetEnabledNetworkTypes()); | 366 GetDelegate(browser_context())->GetEnabledNetworkTypes()); |
| 367 if (!enabled_networks_onc_types) | 367 if (!enabled_networks_onc_types) |
| 368 return RespondNow(Error(networking_private::kErrorNotSupported)); | 368 return RespondNow(Error(networking_private::kErrorNotSupported)); |
| 369 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); | 369 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); |
| 370 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); | 370 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); |
| 371 iter != enabled_networks_onc_types->end(); ++iter) { | 371 iter != enabled_networks_onc_types->end(); ++iter) { |
| 372 std::string type; | 372 std::string type; |
| 373 if (!(*iter)->GetAsString(&type)) | 373 if (!iter->GetAsString(&type)) |
| 374 NOTREACHED(); | 374 NOTREACHED(); |
| 375 if (type == ::onc::network_type::kEthernet) { | 375 if (type == ::onc::network_type::kEthernet) { |
| 376 enabled_networks_list->AppendString( | 376 enabled_networks_list->AppendString( |
| 377 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); | 377 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); |
| 378 } else if (type == ::onc::network_type::kWiFi) { | 378 } else if (type == ::onc::network_type::kWiFi) { |
| 379 enabled_networks_list->AppendString( | 379 enabled_networks_list->AppendString( |
| 380 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); | 380 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); |
| 381 } else if (type == ::onc::network_type::kWimax) { | 381 } else if (type == ::onc::network_type::kWimax) { |
| 382 enabled_networks_list->AppendString( | 382 enabled_networks_list->AppendString( |
| 383 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); | 383 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 // private_api::GlobalPolicy is a subset of the global policy dictionary | 908 // private_api::GlobalPolicy is a subset of the global policy dictionary |
| 909 // (by definition), so use the api setter/getter to generate the subset. | 909 // (by definition), so use the api setter/getter to generate the subset. |
| 910 std::unique_ptr<private_api::GlobalPolicy> policy( | 910 std::unique_ptr<private_api::GlobalPolicy> policy( |
| 911 private_api::GlobalPolicy::FromValue(*policy_dict)); | 911 private_api::GlobalPolicy::FromValue(*policy_dict)); |
| 912 DCHECK(policy); | 912 DCHECK(policy); |
| 913 return RespondNow( | 913 return RespondNow( |
| 914 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); | 914 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace extensions | 917 } // namespace extensions |
| OLD | NEW |