| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 explicit WebSocketJob(SocketStream::Delegate* delegate); | 47 explicit WebSocketJob(SocketStream::Delegate* delegate); |
| 48 | 48 |
| 49 static void EnsureInit(); | 49 static void EnsureInit(); |
| 50 | 50 |
| 51 // Enable or Disable WebSocket over SPDY feature. | 51 // Enable or Disable WebSocket over SPDY feature. |
| 52 // This function is intended to be called before I/O thread starts. | 52 // This function is intended to be called before I/O thread starts. |
| 53 static void set_websocket_over_spdy_enabled(bool enabled); | 53 static void set_websocket_over_spdy_enabled(bool enabled); |
| 54 | 54 |
| 55 State state() const { return state_; } | 55 State state() const { return state_; } |
| 56 virtual void Connect(); | 56 virtual void Connect() OVERRIDE; |
| 57 virtual bool SendData(const char* data, int len); | 57 virtual bool SendData(const char* data, int len) OVERRIDE; |
| 58 virtual void Close(); | 58 virtual void Close() OVERRIDE; |
| 59 virtual void RestartWithAuth(const AuthCredentials& credentials); | 59 virtual void RestartWithAuth(const AuthCredentials& credentials) OVERRIDE; |
| 60 virtual void DetachDelegate(); | 60 virtual void DetachDelegate() OVERRIDE; |
| 61 | 61 |
| 62 // SocketStream::Delegate methods. | 62 // SocketStream::Delegate methods. |
| 63 virtual int OnStartOpenConnection( | 63 virtual int OnStartOpenConnection( |
| 64 SocketStream* socket, OldCompletionCallback* callback); | 64 SocketStream* socket, OldCompletionCallback* callback) OVERRIDE; |
| 65 virtual void OnConnected(SocketStream* socket, int max_pending_send_allowed); | 65 virtual void OnConnected(SocketStream* socket, |
| 66 virtual void OnSentData(SocketStream* socket, int amount_sent); | 66 int max_pending_send_allowed) OVERRIDE; |
| 67 virtual void OnReceivedData(SocketStream* socket, const char* data, int len); | 67 virtual void OnSentData(SocketStream* socket, int amount_sent) OVERRIDE; |
| 68 virtual void OnClose(SocketStream* socket); | 68 virtual void OnReceivedData(SocketStream* socket, |
| 69 const char* data, |
| 70 int len) OVERRIDE; |
| 71 virtual void OnClose(SocketStream* socket) OVERRIDE; |
| 69 virtual void OnAuthRequired( | 72 virtual void OnAuthRequired( |
| 70 SocketStream* socket, AuthChallengeInfo* auth_info); | 73 SocketStream* socket, AuthChallengeInfo* auth_info) OVERRIDE; |
| 71 virtual void OnError(const SocketStream* socket, int error); | 74 virtual void OnError(const SocketStream* socket, int error) OVERRIDE; |
| 72 | 75 |
| 73 // SpdyWebSocketStream::Delegate methods. | 76 // SpdyWebSocketStream::Delegate methods. |
| 74 virtual void OnCreatedSpdyStream(int status); | 77 virtual void OnCreatedSpdyStream(int status) OVERRIDE; |
| 75 virtual void OnSentSpdyHeaders(int status); | 78 virtual void OnSentSpdyHeaders(int status) OVERRIDE; |
| 76 virtual int OnReceivedSpdyResponseHeader( | 79 virtual int OnReceivedSpdyResponseHeader( |
| 77 const spdy::SpdyHeaderBlock& headers, int status); | 80 const spdy::SpdyHeaderBlock& headers, int status) OVERRIDE; |
| 78 virtual void OnSentSpdyData(int amount_sent); | 81 virtual void OnSentSpdyData(int amount_sent) OVERRIDE; |
| 79 virtual void OnReceivedSpdyData(const char* data, int length); | 82 virtual void OnReceivedSpdyData(const char* data, int length) OVERRIDE; |
| 80 virtual void OnCloseSpdyStream(); | 83 virtual void OnCloseSpdyStream() OVERRIDE; |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 friend class WebSocketThrottle; | 86 friend class WebSocketThrottle; |
| 84 friend class WebSocketJobTest; | 87 friend class WebSocketJobTest; |
| 85 virtual ~WebSocketJob(); | 88 virtual ~WebSocketJob(); |
| 86 | 89 |
| 87 bool SendHandshakeRequest(const char* data, int len); | 90 bool SendHandshakeRequest(const char* data, int len); |
| 88 void AddCookieHeaderAndSend(); | 91 void AddCookieHeaderAndSend(); |
| 89 void LoadCookieCallback(const std::string& cookie); | 92 void LoadCookieCallback(const std::string& cookie); |
| 90 | 93 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 139 |
| 137 ScopedRunnableMethodFactory<WebSocketJob> method_factory_; | 140 ScopedRunnableMethodFactory<WebSocketJob> method_factory_; |
| 138 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; | 141 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; |
| 139 | 142 |
| 140 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); | 143 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); |
| 141 }; | 144 }; |
| 142 | 145 |
| 143 } // namespace | 146 } // namespace |
| 144 | 147 |
| 145 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ | 148 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
| OLD | NEW |