OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // HttpBasicStream is a simple implementation of HttpStream. It assumes it is |
| 6 // not sharing a sharing with any other HttpStreams, therefore it just reads and |
| 7 // writes directly to the Http Stream. |
| 8 |
| 9 #ifndef NET_HTTP_HTTP_BASIC_STREAM_H_ |
| 10 #define NET_HTTP_HTTP_BASIC_STREAM_H_ |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "net/base/client_socket_handle.h" |
| 14 #include "net/http/http_stream.h" |
| 15 |
| 16 namespace net { |
| 17 |
| 18 class HttpBasicStream : public HttpStream { |
| 19 public: |
| 20 explicit HttpBasicStream(ClientSocketHandle* handle) : handle_(handle) {} |
| 21 virtual ~HttpBasicStream() {} |
| 22 |
| 23 // HttpStream methods: |
| 24 virtual int Read(IOBuffer* buf, |
| 25 int buf_len, |
| 26 CompletionCallback* callback) { |
| 27 return handle_->socket()->Read(buf, buf_len, callback); |
| 28 } |
| 29 |
| 30 virtual int Write(IOBuffer* buf, |
| 31 int buf_len, |
| 32 CompletionCallback* callback) { |
| 33 return handle_->socket()->Write(buf, buf_len, callback); |
| 34 } |
| 35 |
| 36 private: |
| 37 ClientSocketHandle* const handle_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream); |
| 40 }; |
| 41 |
| 42 } // namespace net |
| 43 |
| 44 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_ |
OLD | NEW |