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_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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 OPEN = 1, | 43 OPEN = 1, |
44 CLOSING = 2, | 44 CLOSING = 2, |
45 CLOSED = 3, | 45 CLOSED = 3, |
46 }; | 46 }; |
47 | 47 |
48 explicit WebSocketJob(SocketStream::Delegate* delegate); | 48 explicit WebSocketJob(SocketStream::Delegate* delegate); |
49 | 49 |
50 static void EnsureInit(); | 50 static void EnsureInit(); |
51 | 51 |
52 State state() const { return state_; } | 52 State state() const { return state_; } |
53 virtual void Connect() OVERRIDE; | 53 virtual void Connect() override; |
54 virtual bool SendData(const char* data, int len) OVERRIDE; | 54 virtual bool SendData(const char* data, int len) override; |
55 virtual void Close() OVERRIDE; | 55 virtual void Close() override; |
56 virtual void RestartWithAuth(const AuthCredentials& credentials) OVERRIDE; | 56 virtual void RestartWithAuth(const AuthCredentials& credentials) override; |
57 virtual void DetachDelegate() OVERRIDE; | 57 virtual void DetachDelegate() override; |
58 | 58 |
59 // SocketStream::Delegate methods. | 59 // SocketStream::Delegate methods. |
60 virtual int OnStartOpenConnection( | 60 virtual int OnStartOpenConnection( |
61 SocketStream* socket, const CompletionCallback& callback) OVERRIDE; | 61 SocketStream* socket, const CompletionCallback& callback) override; |
62 virtual void OnConnected(SocketStream* socket, | 62 virtual void OnConnected(SocketStream* socket, |
63 int max_pending_send_allowed) OVERRIDE; | 63 int max_pending_send_allowed) override; |
64 virtual void OnSentData(SocketStream* socket, int amount_sent) OVERRIDE; | 64 virtual void OnSentData(SocketStream* socket, int amount_sent) override; |
65 virtual void OnReceivedData(SocketStream* socket, | 65 virtual void OnReceivedData(SocketStream* socket, |
66 const char* data, | 66 const char* data, |
67 int len) OVERRIDE; | 67 int len) override; |
68 virtual void OnClose(SocketStream* socket) OVERRIDE; | 68 virtual void OnClose(SocketStream* socket) override; |
69 virtual void OnAuthRequired( | 69 virtual void OnAuthRequired( |
70 SocketStream* socket, AuthChallengeInfo* auth_info) OVERRIDE; | 70 SocketStream* socket, AuthChallengeInfo* auth_info) override; |
71 virtual void OnSSLCertificateError(SocketStream* socket, | 71 virtual void OnSSLCertificateError(SocketStream* socket, |
72 const SSLInfo& ssl_info, | 72 const SSLInfo& ssl_info, |
73 bool fatal) OVERRIDE; | 73 bool fatal) override; |
74 virtual void OnError(const SocketStream* socket, int error) OVERRIDE; | 74 virtual void OnError(const SocketStream* socket, int error) override; |
75 | 75 |
76 // SpdyWebSocketStream::Delegate methods. | 76 // SpdyWebSocketStream::Delegate methods. |
77 virtual void OnCreatedSpdyStream(int status) OVERRIDE; | 77 virtual void OnCreatedSpdyStream(int status) override; |
78 virtual void OnSentSpdyHeaders() OVERRIDE; | 78 virtual void OnSentSpdyHeaders() override; |
79 virtual void OnSpdyResponseHeadersUpdated( | 79 virtual void OnSpdyResponseHeadersUpdated( |
80 const SpdyHeaderBlock& response_headers) OVERRIDE; | 80 const SpdyHeaderBlock& response_headers) override; |
81 virtual void OnSentSpdyData(size_t bytes_sent) OVERRIDE; | 81 virtual void OnSentSpdyData(size_t bytes_sent) override; |
82 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; | 82 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) override; |
83 virtual void OnCloseSpdyStream() OVERRIDE; | 83 virtual void OnCloseSpdyStream() override; |
84 | 84 |
85 private: | 85 private: |
86 friend class WebSocketThrottle; | 86 friend class WebSocketThrottle; |
87 friend class WebSocketJobTest; | 87 friend class WebSocketJobTest; |
88 virtual ~WebSocketJob(); | 88 virtual ~WebSocketJob(); |
89 | 89 |
90 bool SendHandshakeRequest(const char* data, int len); | 90 bool SendHandshakeRequest(const char* data, int len); |
91 void AddCookieHeaderAndSend(); | 91 void AddCookieHeaderAndSend(); |
92 void LoadCookieCallback(const std::string& cookie); | 92 void LoadCookieCallback(const std::string& cookie); |
93 | 93 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; | 149 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; |
150 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_for_send_pending_; | 150 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_for_send_pending_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); | 152 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace | 155 } // namespace |
156 | 156 |
157 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ | 157 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
OLD | NEW |