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> |
11 | 11 |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/string16.h" | |
14 #include "net/base/address_list.h" | 13 #include "net/base/address_list.h" |
15 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
16 #include "net/socket_stream/socket_stream_job.h" | 15 #include "net/socket_stream/socket_stream_job.h" |
17 #include "net/spdy/spdy_websocket_stream.h" | 16 #include "net/spdy/spdy_websocket_stream.h" |
18 | 17 |
19 class GURL; | 18 class GURL; |
20 | 19 |
21 namespace net { | 20 namespace net { |
22 | 21 |
23 class DrainableIOBuffer; | 22 class DrainableIOBuffer; |
(...skipping 26 matching lines...) Expand all Loading... |
50 static void EnsureInit(); | 49 static void EnsureInit(); |
51 | 50 |
52 // Enable or Disable WebSocket over SPDY feature. | 51 // Enable or Disable WebSocket over SPDY feature. |
53 // 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. |
54 static void set_websocket_over_spdy_enabled(bool enabled); | 53 static void set_websocket_over_spdy_enabled(bool enabled); |
55 | 54 |
56 State state() const { return state_; } | 55 State state() const { return state_; } |
57 virtual void Connect(); | 56 virtual void Connect(); |
58 virtual bool SendData(const char* data, int len); | 57 virtual bool SendData(const char* data, int len); |
59 virtual void Close(); | 58 virtual void Close(); |
60 virtual void RestartWithAuth( | 59 virtual void RestartWithAuth(const AuthCredentials& credentials); |
61 const string16& username, | |
62 const string16& password); | |
63 virtual void DetachDelegate(); | 60 virtual void DetachDelegate(); |
64 | 61 |
65 // SocketStream::Delegate methods. | 62 // SocketStream::Delegate methods. |
66 virtual int OnStartOpenConnection( | 63 virtual int OnStartOpenConnection( |
67 SocketStream* socket, OldCompletionCallback* callback); | 64 SocketStream* socket, OldCompletionCallback* callback); |
68 virtual void OnConnected(SocketStream* socket, int max_pending_send_allowed); | 65 virtual void OnConnected(SocketStream* socket, int max_pending_send_allowed); |
69 virtual void OnSentData(SocketStream* socket, int amount_sent); | 66 virtual void OnSentData(SocketStream* socket, int amount_sent); |
70 virtual void OnReceivedData(SocketStream* socket, const char* data, int len); | 67 virtual void OnReceivedData(SocketStream* socket, const char* data, int len); |
71 virtual void OnClose(SocketStream* socket); | 68 virtual void OnClose(SocketStream* socket); |
72 virtual void OnAuthRequired( | 69 virtual void OnAuthRequired( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 136 |
140 ScopedRunnableMethodFactory<WebSocketJob> method_factory_; | 137 ScopedRunnableMethodFactory<WebSocketJob> method_factory_; |
141 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; | 138 base::WeakPtrFactory<WebSocketJob> weak_ptr_factory_; |
142 | 139 |
143 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); | 140 DISALLOW_COPY_AND_ASSIGN(WebSocketJob); |
144 }; | 141 }; |
145 | 142 |
146 } // namespace | 143 } // namespace |
147 | 144 |
148 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ | 145 #endif // NET_WEBSOCKETS_WEBSOCKET_JOB_H_ |
OLD | NEW |