Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / tools / quic / quic_server_session.h
blob604b9fc0c4249a2cc732d02876ff75454f5dd52d
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.
4 //
5 // A server specific QuicSession subclass.
7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
10 #include <set>
11 #include <vector>
13 #include "base/containers/hash_tables.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "net/quic/quic_crypto_server_stream.h"
16 #include "net/quic/quic_protocol.h"
17 #include "net/quic/quic_session.h"
19 namespace net {
21 class QuicConfig;
22 class QuicConnection;
23 class QuicCryptoServerConfig;
24 class ReliableQuicStream;
26 namespace tools {
28 // An interface from the session to the entity owning the session.
29 // This lets the session notify its owner (the Dispatcher) when the connection
30 // is closed.
31 class QuicSessionOwner {
32 public:
33 virtual ~QuicSessionOwner() {}
35 virtual void OnConnectionClose(QuicGuid guid, QuicErrorCode error) = 0;
38 class QuicServerSession : public QuicSession {
39 public:
40 QuicServerSession(const QuicConfig& config,
41 QuicConnection *connection,
42 QuicSessionOwner* owner);
44 // Override the base class to notify the owner of the connection close.
45 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE;
47 virtual ~QuicServerSession();
49 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config);
51 const QuicCryptoServerStream* crypto_stream() { return crypto_stream_.get(); }
53 protected:
54 // QuicSession methods:
55 virtual ReliableQuicStream* CreateIncomingReliableStream(
56 QuicStreamId id) OVERRIDE;
57 virtual ReliableQuicStream* CreateOutgoingReliableStream() OVERRIDE;
58 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE;
60 // If we should create an incoming stream, returns true. Otherwise
61 // does error handling, including communicating the error to the client and
62 // possibly closing the connection, and returns false.
63 virtual bool ShouldCreateIncomingReliableStream(QuicStreamId id);
65 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream(
66 const QuicCryptoServerConfig& crypto_config);
68 private:
69 scoped_ptr<QuicCryptoServerStream> crypto_stream_;
70 QuicSessionOwner* owner_;
72 DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
75 } // namespace tools
76 } // namespace net
78 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_