OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "base/string16.h" |
12 #include "net/socket_stream/socket_stream.h" | 13 #include "net/socket_stream/socket_stream.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 // SocketStreamJob represents full-duplex communication over SocketStream. | 19 // SocketStreamJob represents full-duplex communication over SocketStream. |
19 // If a protocol (e.g. WebSocket protocol) needs to inspect/modify data | 20 // If a protocol (e.g. WebSocket protocol) needs to inspect/modify data |
20 // over SocketStream, you can implement protocol specific job (e.g. | 21 // over SocketStream, you can implement protocol specific job (e.g. |
21 // WebSocketJob) to do some work on data over SocketStream. | 22 // WebSocketJob) to do some work on data over SocketStream. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 virtual bool SendData(const char* data, int len) { | 60 virtual bool SendData(const char* data, int len) { |
60 return socket_->SendData(data, len); | 61 return socket_->SendData(data, len); |
61 } | 62 } |
62 | 63 |
63 virtual void Close() { | 64 virtual void Close() { |
64 socket_->Close(); | 65 socket_->Close(); |
65 } | 66 } |
66 | 67 |
67 virtual void RestartWithAuth( | 68 virtual void RestartWithAuth( |
68 const std::wstring& username, | 69 const string16& username, |
69 const std::wstring& password) { | 70 const string16& password) { |
70 socket_->RestartWithAuth(username, password); | 71 socket_->RestartWithAuth(username, password); |
71 } | 72 } |
72 | 73 |
73 virtual void DetachDelegate() { | 74 virtual void DetachDelegate() { |
74 socket_->DetachDelegate(); | 75 socket_->DetachDelegate(); |
75 } | 76 } |
76 | 77 |
77 protected: | 78 protected: |
78 friend class base::RefCountedThreadSafe<SocketStreamJob>; | 79 friend class base::RefCountedThreadSafe<SocketStreamJob>; |
79 virtual ~SocketStreamJob() {} | 80 virtual ~SocketStreamJob() {} |
80 | 81 |
81 scoped_refptr<SocketStream> socket_; | 82 scoped_refptr<SocketStream> socket_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); | 84 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace net | 87 } // namespace net |
87 | 88 |
88 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 89 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
OLD | NEW |