| 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/socket/socket_api.h" | 5 #include "extensions/browser/api/socket/socket_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 void SocketGetNetworkListFunction::HandleGetNetworkListError() { | 785 void SocketGetNetworkListFunction::HandleGetNetworkListError() { |
| 786 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 786 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 787 error_ = kNetworkListError; | 787 error_ = kNetworkListError; |
| 788 SendResponse(false); | 788 SendResponse(false); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void SocketGetNetworkListFunction::SendResponseOnUIThread( | 791 void SocketGetNetworkListFunction::SendResponseOnUIThread( |
| 792 const net::NetworkInterfaceList& interface_list) { | 792 const net::NetworkInterfaceList& interface_list) { |
| 793 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 793 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 794 | 794 |
| 795 std::vector<linked_ptr<api::socket::NetworkInterface>> create_arg; | 795 std::vector<api::socket::NetworkInterface> create_arg; |
| 796 create_arg.reserve(interface_list.size()); | 796 create_arg.reserve(interface_list.size()); |
| 797 for (net::NetworkInterfaceList::const_iterator i = interface_list.begin(); | 797 for (const net::NetworkInterface& interface : interface_list) { |
| 798 i != interface_list.end(); | 798 api::socket::NetworkInterface info; |
| 799 ++i) { | 799 info.name = interface.name; |
| 800 linked_ptr<api::socket::NetworkInterface> info = | 800 info.address = interface.address.ToString(); |
| 801 make_linked_ptr(new api::socket::NetworkInterface); | 801 info.prefix_length = interface.prefix_length; |
| 802 info->name = i->name; | 802 create_arg.push_back(std::move(info)); |
| 803 info->address = i->address.ToString(); | |
| 804 info->prefix_length = i->prefix_length; | |
| 805 create_arg.push_back(info); | |
| 806 } | 803 } |
| 807 | 804 |
| 808 results_ = api::socket::GetNetworkList::Results::Create(create_arg); | 805 results_ = api::socket::GetNetworkList::Results::Create(create_arg); |
| 809 SendResponse(true); | 806 SendResponse(true); |
| 810 } | 807 } |
| 811 | 808 |
| 812 SocketJoinGroupFunction::SocketJoinGroupFunction() {} | 809 SocketJoinGroupFunction::SocketJoinGroupFunction() {} |
| 813 | 810 |
| 814 SocketJoinGroupFunction::~SocketJoinGroupFunction() {} | 811 SocketJoinGroupFunction::~SocketJoinGroupFunction() {} |
| 815 | 812 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 } else { | 1066 } else { |
| 1070 RemoveSocket(params_->socket_id); | 1067 RemoveSocket(params_->socket_id); |
| 1071 error_ = net::ErrorToString(result); | 1068 error_ = net::ErrorToString(result); |
| 1072 } | 1069 } |
| 1073 | 1070 |
| 1074 results_ = api::socket::Secure::Results::Create(result); | 1071 results_ = api::socket::Secure::Results::Create(result); |
| 1075 AsyncWorkCompleted(); | 1072 AsyncWorkCompleted(); |
| 1076 } | 1073 } |
| 1077 | 1074 |
| 1078 } // namespace extensions | 1075 } // namespace extensions |
| OLD | NEW |