OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBSOCKETS_WEBSOCKET_JOB_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_JOB_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 26 matching lines...) Expand all Loading... | |
37 CONNECTING = 0, | 37 CONNECTING = 0, |
38 OPEN = 1, | 38 OPEN = 1, |
39 CLOSING = 2, | 39 CLOSING = 2, |
40 CLOSED = 3, | 40 CLOSED = 3, |
41 }; | 41 }; |
42 | 42 |
43 explicit WebSocketJob(SocketStream::Delegate* delegate); | 43 explicit WebSocketJob(SocketStream::Delegate* delegate); |
44 | 44 |
45 static void EnsureInit(); | 45 static void EnsureInit(); |
46 | 46 |
47 // Enable or Disable WebSocket over SPDY feature. | |
48 // This function is intended to be called before I/O thread starts. | |
49 static void set_websocket_over_spdy_enabled(bool enable); | |
Yuta Kitamura
2011/05/20 08:30:33
enable -> enabled
Takashi Toyoshima
2011/05/20 09:46:52
Done.
| |
50 | |
47 State state() const { return state_; } | 51 State state() const { return state_; } |
48 virtual void Connect(); | 52 virtual void Connect(); |
49 virtual bool SendData(const char* data, int len); | 53 virtual bool SendData(const char* data, int len); |
50 virtual void Close(); | 54 virtual void Close(); |
51 virtual void RestartWithAuth( | 55 virtual void RestartWithAuth( |
52 const string16& username, | 56 const string16& username, |
53 const string16& password); | 57 const string16& password); |
54 virtual void DetachDelegate(); | 58 virtual void DetachDelegate(); |
55 | 59 |
56 // SocketStream::Delegate methods. | 60 // SocketStream::Delegate methods. |
(...skipping 28 matching lines...) Expand all Loading... | |
85 GURL GetURLForCookies() const; | 89 GURL GetURLForCookies() const; |
86 | 90 |
87 const AddressList& address_list() const; | 91 const AddressList& address_list() const; |
88 void SetWaiting(); | 92 void SetWaiting(); |
89 bool IsWaiting() const; | 93 bool IsWaiting() const; |
90 void Wakeup(); | 94 void Wakeup(); |
91 void DoCallback(); | 95 void DoCallback(); |
92 | 96 |
93 void SendPending(); | 97 void SendPending(); |
94 | 98 |
99 static bool websocket_over_spdy_enabled_; | |
100 | |
95 SocketStream::Delegate* delegate_; | 101 SocketStream::Delegate* delegate_; |
96 State state_; | 102 State state_; |
97 bool waiting_; | 103 bool waiting_; |
98 AddressList addresses_; | 104 AddressList addresses_; |
99 CompletionCallback* callback_; // for throttling. | 105 CompletionCallback* callback_; // for throttling. |
100 | 106 |
101 scoped_ptr<WebSocketHandshakeRequestHandler> handshake_request_; | 107 scoped_ptr<WebSocketHandshakeRequestHandler> handshake_request_; |
102 scoped_ptr<WebSocketHandshakeResponseHandler> handshake_response_; | 108 scoped_ptr<WebSocketHandshakeResponseHandler> handshake_response_; |
103 | 109 |
104 size_t handshake_request_sent_; | 110 size_t handshake_request_sent_; |
105 | 111 |
106 std::vector<std::string> response_cookies_; | 112 std::vector<std::string> response_cookies_; |
107 size_t response_cookies_save_index_; | 113 size_t response_cookies_save_index_; |
108 | 114 |
109 scoped_ptr<WebSocketFrameHandler> send_frame_handler_; | 115 scoped_ptr<WebSocketFrameHandler> send_frame_handler_; |
110 scoped_refptr<DrainableIOBuffer> current_buffer_; | 116 scoped_refptr<DrainableIOBuffer> current_buffer_; |
111 scoped_ptr<WebSocketFrameHandler> receive_frame_handler_; | 117 scoped_ptr<WebSocketFrameHandler> receive_frame_handler_; |
112 | 118 |
113 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); | 119 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); |
114 }; | 120 }; |
115 | 121 |
116 } // namespace | 122 } // namespace |
117 | 123 |
118 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ | 124 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
OLD | NEW |