| OLD | NEW |
| 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/socket.h" | 5 #include "chrome/browser/extensions/api/socket/socket.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.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/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/socket/socket.h" | 13 #include "net/socket/socket.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 Socket::Socket(ApiResourceEventNotifier* event_notifier) | 17 Socket::Socket(const std::string& owner_extension_id, |
| 18 : ApiResource(event_notifier), | 18 ApiResourceEventNotifier* event_notifier) |
| 19 : ApiResource(owner_extension_id, event_notifier), |
| 19 port_(0), | 20 port_(0), |
| 20 is_connected_(false) { | 21 is_connected_(false) { |
| 21 } | 22 } |
| 22 | 23 |
| 23 Socket::~Socket() { | 24 Socket::~Socket() { |
| 24 // Derived destructors should make sure the socket has been closed. | 25 // Derived destructors should make sure the socket has been closed. |
| 25 DCHECK(!is_connected_); | 26 DCHECK(!is_connected_); |
| 26 } | 27 } |
| 27 | 28 |
| 28 void Socket::Write(scoped_refptr<net::IOBuffer> io_buffer, | 29 void Socket::Write(scoped_refptr<net::IOBuffer> io_buffer, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const CompletionCallback& callback) | 130 const CompletionCallback& callback) |
| 130 : io_buffer(io_buffer), | 131 : io_buffer(io_buffer), |
| 131 byte_count(byte_count), | 132 byte_count(byte_count), |
| 132 callback(callback), | 133 callback(callback), |
| 133 bytes_written(0) { | 134 bytes_written(0) { |
| 134 } | 135 } |
| 135 | 136 |
| 136 Socket::WriteRequest::~WriteRequest() { } | 137 Socket::WriteRequest::~WriteRequest() { } |
| 137 | 138 |
| 138 } // namespace extensions | 139 } // namespace extensions |
| OLD | NEW |