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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 net::IPEndPoint localAddress; | 631 net::IPEndPoint localAddress; |
632 if (socket->GetLocalAddress(&localAddress)) { | 632 if (socket->GetLocalAddress(&localAddress)) { |
633 info.local_address.reset( | 633 info.local_address.reset( |
634 new std::string(localAddress.ToStringWithoutPort())); | 634 new std::string(localAddress.ToStringWithoutPort())); |
635 info.local_port.reset(new int(localAddress.port())); | 635 info.local_port.reset(new int(localAddress.port())); |
636 } | 636 } |
637 | 637 |
638 SetResult(info.ToValue().release()); | 638 SetResult(info.ToValue().release()); |
639 } | 639 } |
640 | 640 |
641 bool SocketGetNetworkListFunction::RunImpl() { | 641 bool SocketGetNetworkListFunction::RunAsync() { |
642 content::BrowserThread::PostTask( | 642 content::BrowserThread::PostTask( |
643 content::BrowserThread::FILE, | 643 content::BrowserThread::FILE, |
644 FROM_HERE, | 644 FROM_HERE, |
645 base::Bind(&SocketGetNetworkListFunction::GetNetworkListOnFileThread, | 645 base::Bind(&SocketGetNetworkListFunction::GetNetworkListOnFileThread, |
646 this)); | 646 this)); |
647 return true; | 647 return true; |
648 } | 648 } |
649 | 649 |
650 void SocketGetNetworkListFunction::GetNetworkListOnFileThread() { | 650 void SocketGetNetworkListFunction::GetNetworkListOnFileThread() { |
651 net::NetworkInterfaceList interface_list; | 651 net::NetworkInterfaceList interface_list; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 return; | 882 return; |
883 } | 883 } |
884 | 884 |
885 base::ListValue* values = new base::ListValue(); | 885 base::ListValue* values = new base::ListValue(); |
886 values->AppendStrings((std::vector<std::string>&)static_cast<UDPSocket*>( | 886 values->AppendStrings((std::vector<std::string>&)static_cast<UDPSocket*>( |
887 socket)->GetJoinedGroups()); | 887 socket)->GetJoinedGroups()); |
888 SetResult(values); | 888 SetResult(values); |
889 } | 889 } |
890 | 890 |
891 } // namespace extensions | 891 } // namespace extensions |
OLD | NEW |