| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 469 } |
| 470 | 470 |
| 471 std::unique_ptr<base::ListValue> enabled_networks_onc_types( | 471 std::unique_ptr<base::ListValue> enabled_networks_onc_types( |
| 472 GetDelegate(browser_context())->GetEnabledNetworkTypes()); | 472 GetDelegate(browser_context())->GetEnabledNetworkTypes()); |
| 473 if (!enabled_networks_onc_types) | 473 if (!enabled_networks_onc_types) |
| 474 return RespondNow(Error(networking_private::kErrorNotSupported)); | 474 return RespondNow(Error(networking_private::kErrorNotSupported)); |
| 475 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); | 475 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue); |
| 476 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); | 476 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); |
| 477 iter != enabled_networks_onc_types->end(); ++iter) { | 477 iter != enabled_networks_onc_types->end(); ++iter) { |
| 478 std::string type; | 478 std::string type; |
| 479 if (!(*iter)->GetAsString(&type)) | 479 if (!iter->GetAsString(&type)) |
| 480 NOTREACHED(); | 480 NOTREACHED(); |
| 481 if (type == ::onc::network_type::kEthernet) { | 481 if (type == ::onc::network_type::kEthernet) { |
| 482 enabled_networks_list->AppendString( | 482 enabled_networks_list->AppendString( |
| 483 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); | 483 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); |
| 484 } else if (type == ::onc::network_type::kWiFi) { | 484 } else if (type == ::onc::network_type::kWiFi) { |
| 485 enabled_networks_list->AppendString( | 485 enabled_networks_list->AppendString( |
| 486 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); | 486 private_api::ToString(private_api::NETWORK_TYPE_WIFI)); |
| 487 } else if (type == ::onc::network_type::kWimax) { | 487 } else if (type == ::onc::network_type::kWimax) { |
| 488 enabled_networks_list->AppendString( | 488 enabled_networks_list->AppendString( |
| 489 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); | 489 private_api::ToString(private_api::NETWORK_TYPE_WIMAX)); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 // private_api::GlobalPolicy is a subset of the global policy dictionary | 1021 // private_api::GlobalPolicy is a subset of the global policy dictionary |
| 1022 // (by definition), so use the api setter/getter to generate the subset. | 1022 // (by definition), so use the api setter/getter to generate the subset. |
| 1023 std::unique_ptr<private_api::GlobalPolicy> policy( | 1023 std::unique_ptr<private_api::GlobalPolicy> policy( |
| 1024 private_api::GlobalPolicy::FromValue(*policy_dict)); | 1024 private_api::GlobalPolicy::FromValue(*policy_dict)); |
| 1025 DCHECK(policy); | 1025 DCHECK(policy); |
| 1026 return RespondNow( | 1026 return RespondNow( |
| 1027 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); | 1027 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 } // namespace extensions | 1030 } // namespace extensions |
| OLD | NEW |