Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / tools / quic / quic_reliable_server_stream.h
blob2669f42649ce184b1455f424ce725087f3f1bbdb
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_SERVER_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_RELIABLE_SERVER_STREAM_H_
8 #include <string>
10 #include "net/quic/quic_protocol.h"
11 #include "net/quic/reliable_quic_stream.h"
12 #include "net/tools/flip_server/balsa_headers.h"
14 namespace net {
16 class QuicSession;
18 namespace tools {
20 namespace test {
21 class QuicReliableServerStreamPeer;
22 } // namespace test
24 // A base class for spdy/http server streams which handles the concept
25 // of sending and receiving headers and bodies.
26 class QuicReliableServerStream : public ReliableQuicStream {
27 public:
28 QuicReliableServerStream(QuicStreamId id, QuicSession* session);
29 virtual ~QuicReliableServerStream() {}
31 // Subclasses should process and frame data when this is called, returning
32 // how many bytes are processed.
33 virtual uint32 ProcessData(const char* data, uint32 data_len) = 0;
34 // Subclasses should implement this to serialize headers in a
35 // protocol-specific manner, and send it out to the client.
36 virtual void SendHeaders(const BalsaHeaders& response_headers) = 0;
38 // Sends a basic 200 response using SendHeaders for the headers and WriteData
39 // for the body.
40 void SendResponse();
41 // Sends a basic 500 response using SendHeaders for the headers and WriteData
42 // for the body
43 void SendErrorResponse();
44 // Make sure that as soon as we start writing data, we stop reading.
45 virtual QuicConsumedData WriteData(base::StringPiece data, bool fin) OVERRIDE;
47 // Returns whatever headers have been received for this stream.
48 const BalsaHeaders& headers() { return headers_; }
50 const string& body() { return body_; }
51 protected:
52 BalsaHeaders* mutable_headers() { return &headers_; }
53 string* mutable_body() { return &body_; }
55 private:
56 friend class test::QuicReliableServerStreamPeer;
58 BalsaHeaders headers_;
59 string body_;
62 } // namespace tools
63 } // namespace net
65 #endif // NET_TOOLS_QUIC_QUIC_RELIABLE_SERVER_STREAM_H_