Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / tools / quic / quic_reliable_client_stream.h
blob10b60c2f69628dcb4103588f5f055089fe1bb59e
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
3 // found in the LICENSE file.
5 #ifndef NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
8 #include <sys/types.h>
9 #include <string>
11 #include "base/strings/string_piece.h"
12 #include "net/quic/quic_protocol.h"
13 #include "net/quic/reliable_quic_stream.h"
14 #include "net/tools/flip_server/balsa_frame.h"
15 #include "net/tools/flip_server/balsa_headers.h"
17 namespace net {
19 class QuicSession;
21 namespace tools {
23 class QuicClientSession;
25 // A base class for spdy/http client streams which handles the concept
26 // of sending and receiving headers and bodies.
27 class QuicReliableClientStream : public ReliableQuicStream {
28 public:
29 QuicReliableClientStream(QuicStreamId id, QuicSession* session)
30 : ReliableQuicStream(id, session) {
33 // Serializes the headers and body, sends it to the server, and
34 // returns the number of bytes sent.
35 virtual ssize_t SendRequest(const BalsaHeaders& headers,
36 base::StringPiece body,
37 bool fin) = 0;
38 // Sends body data to the server and returns the number of bytes sent.
39 virtual ssize_t SendBody(const std::string& data, bool fin);
41 // Override the base class to close the Write side as soon as we get a
42 // response.
43 // SPDY/HTTP do not support bidirectional streaming.
44 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE;
46 // Returns the response data.
47 const std::string& data() { return data_; }
49 // Returns whatever headers have been received for this stream.
50 const BalsaHeaders& headers() { return headers_; }
52 protected:
53 std::string* mutable_data() { return &data_; }
54 BalsaHeaders* mutable_headers() { return &headers_; }
56 private:
57 BalsaHeaders headers_;
58 std::string data_;
60 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream);
63 } // namespace tools
64 } // namespace net
66 #endif // NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_