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

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

Issue 717263003: Use uint16 for port numbers, extensions/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review Created 6 years, 1 month 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: extensions/browser/api/socket/socket.h
diff --git a/extensions/browser/api/socket/socket.h b/extensions/browser/api/socket/socket.h
index dce5216f4cbe4e3c5ac664000f163ec0ddfdca38..e2287fe5c895434ec824de0613fce6e6203707ea 100644
--- a/extensions/browser/api/socket/socket.h
+++ b/extensions/browser/api/socket/socket.h
@@ -29,9 +29,10 @@ namespace extensions {
typedef base::Callback<void(int)> CompletionCallback;
typedef base::Callback<void(int, scoped_refptr<net::IOBuffer> io_buffer)>
ReadCompletionCallback;
-typedef base::Callback<
- void(int, scoped_refptr<net::IOBuffer> io_buffer, const std::string&, int)>
- RecvFromCompletionCallback;
+typedef base::Callback<void(int,
+ scoped_refptr<net::IOBuffer> io_buffer,
+ const std::string&,
+ uint16)> RecvFromCompletionCallback;
typedef base::Callback<void(int, net::TCPClientSocket*)>
AcceptCompletionCallback;
@@ -58,10 +59,10 @@ class Socket : public ApiResource {
// the remote endpoint. In order to upgrade this socket to TLS, callers
// must also supply the hostname of the endpoint via set_hostname().
virtual void Connect(const std::string& address,
- int port,
+ uint16 port,
const CompletionCallback& callback) = 0;
virtual void Disconnect() = 0;
- virtual int Bind(const std::string& address, int port) = 0;
+ virtual int Bind(const std::string& address, uint16 port) = 0;
// The |callback| will be called with the number of bytes read into the
// buffer, or a negative number if an error occurred.
@@ -78,13 +79,13 @@ class Socket : public ApiResource {
virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer,
int byte_count,
const std::string& address,
- int port,
+ uint16 port,
const CompletionCallback& callback) = 0;
virtual bool SetKeepAlive(bool enable, int delay);
virtual bool SetNoDelay(bool no_delay);
virtual int Listen(const std::string& address,
- int port,
+ uint16 port,
int backlog,
std::string* error_msg);
virtual void Accept(const AcceptCompletionCallback& callback);
@@ -97,14 +98,14 @@ class Socket : public ApiResource {
virtual SocketType GetSocketType() const = 0;
static bool StringAndPortToAddressList(const std::string& ip_address_str,
- int port,
+ uint16 port,
net::AddressList* address_list);
static bool StringAndPortToIPEndPoint(const std::string& ip_address_str,
- int port,
+ uint16 port,
net::IPEndPoint* ip_end_point);
static void IPEndPointToStringAndPort(const net::IPEndPoint& address,
std::string* ip_address_str,
- int* port);
+ uint16* port);
protected:
explicit Socket(const std::string& owner_extension_id_);

Powered by Google App Engine
This is Rietveld 408576698