OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/system_network/system_network_api.h" | 5 #include "extensions/browser/api/system_network/system_network_api.h" |
6 | 6 |
7 namespace { | 7 namespace { |
8 const char kNetworkListError[] = "Network lookup failed or unsupported"; | 8 const char kNetworkListError[] = "Network lookup failed or unsupported"; |
9 } // namespace | 9 } // namespace |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 error_ = kNetworkListError; | 55 error_ = kNetworkListError; |
56 SendResponse(false); | 56 SendResponse(false); |
57 } | 57 } |
58 | 58 |
59 void SystemNetworkGetNetworkInterfacesFunction::SendResponseOnUIThread( | 59 void SystemNetworkGetNetworkInterfacesFunction::SendResponseOnUIThread( |
60 const net::NetworkInterfaceList& interface_list) { | 60 const net::NetworkInterfaceList& interface_list) { |
61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
62 | 62 |
63 std::vector<api::system_network::NetworkInterface> create_arg; | 63 std::vector<api::system_network::NetworkInterface> create_arg; |
64 create_arg.reserve(interface_list.size()); | 64 create_arg.reserve(interface_list.size()); |
65 for (const net::NetworkInterface interface : interface_list) { | 65 for (const net::NetworkInterface& interface : interface_list) { |
66 api::system_network::NetworkInterface info; | 66 api::system_network::NetworkInterface info; |
67 info.name = interface.name; | 67 info.name = interface.name; |
68 info.address = interface.address.ToString(); | 68 info.address = interface.address.ToString(); |
69 info.prefix_length = interface.prefix_length; | 69 info.prefix_length = interface.prefix_length; |
70 create_arg.push_back(std::move(info)); | 70 create_arg.push_back(std::move(info)); |
71 } | 71 } |
72 | 72 |
73 results_ = | 73 results_ = |
74 api::system_network::GetNetworkInterfaces::Results::Create(create_arg); | 74 api::system_network::GetNetworkInterfaces::Results::Create(create_arg); |
75 SendResponse(true); | 75 SendResponse(true); |
76 } | 76 } |
77 | 77 |
78 } // namespace api | 78 } // namespace api |
79 } // namespace extensions | 79 } // namespace extensions |
OLD | NEW |