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

Unified Diff: chrome/browser/extensions/api/socket/udp_socket.h

Issue 10134008: Add bind(), recvFrom(), sendTo() for UDP socket. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: wip Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/socket/udp_socket.h
diff --git a/chrome/browser/extensions/api/socket/udp_socket.h b/chrome/browser/extensions/api/socket/udp_socket.h
index 4cffa98b86414eced3efd12b558ff4c7454f74d1..ac0e1554795cfc2b2abe25c4e54145d52ebb34f9 100644
--- a/chrome/browser/extensions/api/socket/udp_socket.h
+++ b/chrome/browser/extensions/api/socket/udp_socket.h
@@ -9,7 +9,7 @@
#include <string>
#include "chrome/browser/extensions/api/socket/socket.h"
-#include "net/udp/datagram_client_socket.h"
+#include "net/udp/udp_socket.h"
namespace net {
class Socket;
@@ -21,30 +21,36 @@ class APIResourceEventNotifier;
class UDPSocket : public Socket {
public:
- UDPSocket(const std::string& address, int port,
- APIResourceEventNotifier* event_notifier);
+ UDPSocket(APIResourceEventNotifier* event_notifier);
virtual ~UDPSocket();
virtual bool IsValid() OVERRIDE;
- virtual int Connect() OVERRIDE;
+ virtual int Connect(const std::string& address, int port) OVERRIDE;
virtual void Disconnect() OVERRIDE;
+ virtual int Bind(const std::string& address, int port) OVERRIDE;
+ virtual int Read(scoped_refptr<net::IOBuffer> io_buffer,
+ int io_buffer_size) OVERRIDE;
+ virtual int Write(scoped_refptr<net::IOBuffer> io_buffer,
+ int bytes) OVERRIDE;
+ virtual int RecvFrom(scoped_refptr<net::IOBuffer> io_buffer,
+ int io_buffer_size,
+ net::IPEndPoint* address) OVERRIDE;
+ virtual int SendTo(scoped_refptr<net::IOBuffer> io_buffer,
+ int byte_count,
+ const std::string& address,
+ int port) OVERRIDE;
static UDPSocket* CreateSocketForTesting(
- net::DatagramClientSocket* datagram_client_socket,
- const std::string& address, int port,
+ net::UDPSocket* udp_socket,
APIResourceEventNotifier* event_notifier);
- protected:
- virtual net::Socket* socket() OVERRIDE;
-
private:
// Special constructor for testing.
- UDPSocket(net::DatagramClientSocket* datagram_client_socket,
- const std::string& address, int port,
+ UDPSocket(net::UDPSocket* udp_socket,
APIResourceEventNotifier* event_notifier);
- scoped_ptr<net::DatagramClientSocket> socket_;
+ scoped_ptr<net::UDPSocket> socket_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698