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_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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "net/base/net_api.h" | 13 #include "net/base/net_export.h" |
14 #include "net/socket_stream/socket_stream.h" | 14 #include "net/socket_stream/socket_stream.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 class SSLConfigService; | 20 class SSLConfigService; |
21 class TransportSecurityState; | 21 class TransportSecurityState; |
22 | 22 |
23 // SocketStreamJob represents full-duplex communication over SocketStream. | 23 // SocketStreamJob represents full-duplex communication over SocketStream. |
24 // If a protocol (e.g. WebSocket protocol) needs to inspect/modify data | 24 // If a protocol (e.g. WebSocket protocol) needs to inspect/modify data |
25 // over SocketStream, you can implement protocol specific job (e.g. | 25 // over SocketStream, you can implement protocol specific job (e.g. |
26 // WebSocketJob) to do some work on data over SocketStream. | 26 // WebSocketJob) to do some work on data over SocketStream. |
27 // Registers the protocol specific SocketStreamJob by RegisterProtocolFactory | 27 // Registers the protocol specific SocketStreamJob by RegisterProtocolFactory |
28 // and call CreateSocketStreamJob to create SocketStreamJob for the URL. | 28 // and call CreateSocketStreamJob to create SocketStreamJob for the URL. |
29 class NET_API SocketStreamJob | 29 class NET_EXPORT SocketStreamJob |
30 : public base::RefCountedThreadSafe<SocketStreamJob> { | 30 : public base::RefCountedThreadSafe<SocketStreamJob> { |
31 public: | 31 public: |
32 // Callback function implemented by protocol handlers to create new jobs. | 32 // Callback function implemented by protocol handlers to create new jobs. |
33 typedef SocketStreamJob* (ProtocolFactory)(const GURL& url, | 33 typedef SocketStreamJob* (ProtocolFactory)(const GURL& url, |
34 SocketStream::Delegate* delegate); | 34 SocketStream::Delegate* delegate); |
35 | 35 |
36 static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme, | 36 static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme, |
37 ProtocolFactory* factory); | 37 ProtocolFactory* factory); |
38 | 38 |
39 static SocketStreamJob* CreateSocketStreamJob( | 39 static SocketStreamJob* CreateSocketStreamJob( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual ~SocketStreamJob(); | 74 virtual ~SocketStreamJob(); |
75 | 75 |
76 scoped_refptr<SocketStream> socket_; | 76 scoped_refptr<SocketStream> socket_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); | 78 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace net | 81 } // namespace net |
82 | 82 |
83 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 83 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
OLD | NEW |