Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: extensions/browser/api/system_network/system_network_api.cc

Issue 1842953002: [Extensions] Convert APIs to use movable types [13] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "net/base/ip_address_number.h" 7 #include "net/base/ip_address_number.h"
8 8
9 namespace { 9 namespace {
10 const char kNetworkListError[] = "Network lookup failed or unsupported"; 10 const char kNetworkListError[] = "Network lookup failed or unsupported";
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void SystemNetworkGetNetworkInterfacesFunction::HandleGetListError() { 55 void SystemNetworkGetNetworkInterfacesFunction::HandleGetListError() {
56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
57 error_ = kNetworkListError; 57 error_ = kNetworkListError;
58 SendResponse(false); 58 SendResponse(false);
59 } 59 }
60 60
61 void SystemNetworkGetNetworkInterfacesFunction::SendResponseOnUIThread( 61 void SystemNetworkGetNetworkInterfacesFunction::SendResponseOnUIThread(
62 const net::NetworkInterfaceList& interface_list) { 62 const net::NetworkInterfaceList& interface_list) {
63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
64 64
65 std::vector<linked_ptr<api::system_network::NetworkInterface>> create_arg; 65 std::vector<api::system_network::NetworkInterface> create_arg;
66 create_arg.reserve(interface_list.size()); 66 create_arg.reserve(interface_list.size());
67 for (net::NetworkInterfaceList::const_iterator i = interface_list.begin(); 67 for (const net::NetworkInterface interface : interface_list) {
68 i != interface_list.end(); 68 api::system_network::NetworkInterface info;
69 ++i) { 69 info.name = interface.name;
70 linked_ptr<api::system_network::NetworkInterface> info = 70 info.address = interface.address.ToString();
71 make_linked_ptr(new api::system_network::NetworkInterface); 71 info.prefix_length = interface.prefix_length;
72 info->name = i->name; 72 create_arg.push_back(std::move(info));
73 info->address = i->address.ToString();
74 info->prefix_length = i->prefix_length;
75 create_arg.push_back(info);
76 } 73 }
77 74
78 results_ = 75 results_ =
79 api::system_network::GetNetworkInterfaces::Results::Create(create_arg); 76 api::system_network::GetNetworkInterfaces::Results::Create(create_arg);
80 SendResponse(true); 77 SendResponse(true);
81 } 78 }
82 79
83 } // namespace api 80 } // namespace api
84 } // namespace extensions 81 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698