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

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

Issue 10777003: Refactor APIResourceController to ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge/antony/fix build. Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/socket/tcp_socket.h" 5 #include "chrome/browser/extensions/api/socket/tcp_socket.h"
6 6
7 #include "chrome/browser/extensions/api/api_resource.h" 7 #include "chrome/browser/extensions/api/api_resource.h"
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
9 #include "net/base/address_list.h" 9 #include "net/base/address_list.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/rand_callback.h" 12 #include "net/base/rand_callback.h"
13 #include "net/socket/tcp_client_socket.h" 13 #include "net/socket/tcp_client_socket.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 TCPSocket::TCPSocket(APIResourceEventNotifier* event_notifier) 17 TCPSocket::TCPSocket(ApiResourceEventNotifier* event_notifier)
18 : Socket(event_notifier) { 18 : Socket(event_notifier) {
19 } 19 }
20 20
21 // For testing. 21 // For testing.
22 TCPSocket::TCPSocket(net::TCPClientSocket* tcp_client_socket, 22 TCPSocket::TCPSocket(net::TCPClientSocket* tcp_client_socket,
23 APIResourceEventNotifier* event_notifier) 23 ApiResourceEventNotifier* event_notifier)
24 : Socket(event_notifier), 24 : Socket(event_notifier),
25 socket_(tcp_client_socket) { 25 socket_(tcp_client_socket) {
26 } 26 }
27 27
28 // static 28 // static
29 TCPSocket* TCPSocket::CreateSocketForTesting( 29 TCPSocket* TCPSocket::CreateSocketForTesting(
30 net::TCPClientSocket* tcp_client_socket, 30 net::TCPClientSocket* tcp_client_socket,
31 APIResourceEventNotifier* event_notifier) { 31 ApiResourceEventNotifier* event_notifier) {
32 return new TCPSocket(tcp_client_socket, event_notifier); 32 return new TCPSocket(tcp_client_socket, event_notifier);
33 } 33 }
34 34
35 TCPSocket::~TCPSocket() { 35 TCPSocket::~TCPSocket() {
36 if (is_connected_) { 36 if (is_connected_) {
37 Disconnect(); 37 Disconnect();
38 } 38 }
39 } 39 }
40 40
41 void TCPSocket::Connect(const std::string& address, 41 void TCPSocket::Connect(const std::string& address,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 void TCPSocket::OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, 160 void TCPSocket::OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer,
161 int result) { 161 int result) {
162 DCHECK(!read_callback_.is_null()); 162 DCHECK(!read_callback_.is_null());
163 read_callback_.Run(result, io_buffer); 163 read_callback_.Run(result, io_buffer);
164 read_callback_.Reset(); 164 read_callback_.Reset();
165 } 165 }
166 166
167 } // namespace extensions 167 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/socket/tcp_socket.h ('k') | chrome/browser/extensions/api/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698