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 #ifndef NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 int status) = 0; | 44 int status) = 0; |
45 | 45 |
46 // Called when data is sent. | 46 // Called when data is sent. |
47 virtual void OnSentSpdyData(int amount_sent) = 0; | 47 virtual void OnSentSpdyData(int amount_sent) = 0; |
48 | 48 |
49 // Called when data is received. | 49 // Called when data is received. |
50 virtual void OnReceivedSpdyData(const char* data, int length) = 0; | 50 virtual void OnReceivedSpdyData(const char* data, int length) = 0; |
51 | 51 |
52 // Called when SpdyStream is closed. | 52 // Called when SpdyStream is closed. |
53 virtual void OnCloseSpdyStream() = 0; | 53 virtual void OnCloseSpdyStream() = 0; |
| 54 |
| 55 protected: |
| 56 virtual ~Delegate() {} |
54 }; | 57 }; |
55 | 58 |
56 SpdyWebSocketStream(SpdySession* spdy_session, Delegate* delegate); | 59 SpdyWebSocketStream(SpdySession* spdy_session, Delegate* delegate); |
57 virtual ~SpdyWebSocketStream(); | 60 virtual ~SpdyWebSocketStream(); |
58 | 61 |
59 // Initializes SPDY stream for the WebSocket. | 62 // Initializes SPDY stream for the WebSocket. |
60 // It might create SPDY stream asynchronously. In this case, this method | 63 // It might create SPDY stream asynchronously. In this case, this method |
61 // returns ERR_IO_PENDING and call OnCreatedSpdyStream delegate with result | 64 // returns ERR_IO_PENDING and call OnCreatedSpdyStream delegate with result |
62 // after completion. In other cases, delegate does not be called. | 65 // after completion. In other cases, delegate does not be called. |
63 int InitializeStream(const GURL& url, | 66 int InitializeStream(const GURL& url, |
(...skipping 25 matching lines...) Expand all Loading... |
89 scoped_refptr<SpdyStream> stream_; | 92 scoped_refptr<SpdyStream> stream_; |
90 scoped_refptr<SpdySession> spdy_session_; | 93 scoped_refptr<SpdySession> spdy_session_; |
91 Delegate* delegate_; | 94 Delegate* delegate_; |
92 | 95 |
93 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); | 96 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); |
94 }; | 97 }; |
95 | 98 |
96 } // namespace net | 99 } // namespace net |
97 | 100 |
98 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 101 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
OLD | NEW |