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

Side by Side Diff: extensions/browser/api/socket/socket.cc

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: Created 4 years, 12 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
« no previous file with comments | « extensions/browser/api/socket/socket.h ('k') | extensions/browser/api/socket/socket_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "extensions/browser/api/socket/socket.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "extensions/browser/api/api_resource_manager.h" 9 #include "extensions/browser/api/api_resource_manager.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 if (!write_queue_.empty()) 84 if (!write_queue_.empty())
85 WriteData(); 85 WriteData();
86 } 86 }
87 87
88 bool Socket::SetKeepAlive(bool enable, int delay) { return false; } 88 bool Socket::SetKeepAlive(bool enable, int delay) { return false; }
89 89
90 bool Socket::SetNoDelay(bool no_delay) { return false; } 90 bool Socket::SetNoDelay(bool no_delay) { return false; }
91 91
92 int Socket::Listen(const std::string& address, 92 int Socket::Listen(const std::string& address,
93 uint16 port, 93 uint16_t port,
94 int backlog, 94 int backlog,
95 std::string* error_msg) { 95 std::string* error_msg) {
96 *error_msg = kSocketTypeNotSupported; 96 *error_msg = kSocketTypeNotSupported;
97 return net::ERR_FAILED; 97 return net::ERR_FAILED;
98 } 98 }
99 99
100 void Socket::Accept(const AcceptCompletionCallback& callback) { 100 void Socket::Accept(const AcceptCompletionCallback& callback) {
101 callback.Run(net::ERR_FAILED, NULL); 101 callback.Run(net::ERR_FAILED, NULL);
102 } 102 }
103 103
104 // static 104 // static
105 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str, 105 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str,
106 uint16 port, 106 uint16_t port,
107 net::IPEndPoint* ip_end_point) { 107 net::IPEndPoint* ip_end_point) {
108 DCHECK(ip_end_point); 108 DCHECK(ip_end_point);
109 net::IPAddressNumber ip_number; 109 net::IPAddressNumber ip_number;
110 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number)) 110 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number))
111 return false; 111 return false;
112 112
113 *ip_end_point = net::IPEndPoint(ip_number, port); 113 *ip_end_point = net::IPEndPoint(ip_number, port);
114 return true; 114 return true;
115 } 115 }
116 116
117 void Socket::IPEndPointToStringAndPort(const net::IPEndPoint& address, 117 void Socket::IPEndPointToStringAndPort(const net::IPEndPoint& address,
118 std::string* ip_address_str, 118 std::string* ip_address_str,
119 uint16* port) { 119 uint16_t* port) {
120 DCHECK(ip_address_str); 120 DCHECK(ip_address_str);
121 DCHECK(port); 121 DCHECK(port);
122 *ip_address_str = address.ToStringWithoutPort(); 122 *ip_address_str = address.ToStringWithoutPort();
123 if (ip_address_str->empty()) { 123 if (ip_address_str->empty()) {
124 *port = 0; 124 *port = 0;
125 } else { 125 } else {
126 *port = address.port(); 126 *port = address.port();
127 } 127 }
128 } 128 }
129 129
130 Socket::WriteRequest::WriteRequest(scoped_refptr<net::IOBuffer> io_buffer, 130 Socket::WriteRequest::WriteRequest(scoped_refptr<net::IOBuffer> io_buffer,
131 int byte_count, 131 int byte_count,
132 const CompletionCallback& callback) 132 const CompletionCallback& callback)
133 : io_buffer(io_buffer), 133 : io_buffer(io_buffer),
134 byte_count(byte_count), 134 byte_count(byte_count),
135 callback(callback), 135 callback(callback),
136 bytes_written(0) {} 136 bytes_written(0) {}
137 137
138 Socket::WriteRequest::~WriteRequest() {} 138 Socket::WriteRequest::~WriteRequest() {}
139 139
140 } // namespace extensions 140 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/socket.h ('k') | extensions/browser/api/socket/socket_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698