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_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/net_log.h" |
10 #include "net/http/http_stream_factory_impl.h" | 11 #include "net/http/http_stream_factory_impl.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { | 15 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { |
15 public: | 16 public: |
16 Request(const GURL& url, | 17 Request(const GURL& url, |
17 HttpStreamFactoryImpl* factory, | 18 HttpStreamFactoryImpl* factory, |
18 HttpStreamRequest::Delegate* delegate); | 19 HttpStreamRequest::Delegate* delegate, |
| 20 const BoundNetLog& net_log); |
19 virtual ~Request(); | 21 virtual ~Request(); |
20 | 22 |
21 // Returns the Job that the Request started up. | 23 // Returns the Job that the Request started up. |
22 Job* job() const { return job_; } | 24 Job* job() const { return job_; } |
23 | 25 |
24 // The GURL from the HttpRequestInfo the started the Request. | 26 // The GURL from the HttpRequestInfo the started the Request. |
25 const GURL& url() const { return url_; } | 27 const GURL& url() const { return url_; } |
26 | 28 |
27 // Called when the Job determines the appropriate |spdy_session_key| for the | 29 // Called when the Job determines the appropriate |spdy_session_key| for the |
28 // Request. Note that this does not mean that SPDY is necessarily supported | 30 // Request. Note that this does not mean that SPDY is necessarily supported |
29 // for this HostPortProxyPair, since we may need to wait for NPN to complete | 31 // for this HostPortProxyPair, since we may need to wait for NPN to complete |
30 // before knowing if SPDY is available. | 32 // before knowing if SPDY is available. |
31 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); | 33 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); |
32 | 34 |
33 // Binds |job| to this request. | 35 // Binds |job| to this request. |
34 void BindJob(HttpStreamFactoryImpl::Job* job); | 36 void BindJob(HttpStreamFactoryImpl::Job* job); |
35 | 37 |
36 // Marks completion of the request. Must be called before OnStreamReady(). | 38 // Marks completion of the request. Must be called before OnStreamReady(). |
| 39 // |source| is the NetLog::Source generated by the Job that fulfilled this |
| 40 // request. |
37 void Complete(bool was_alternate_protocol_available, | 41 void Complete(bool was_alternate_protocol_available, |
38 bool was_npn_negotiated, | 42 bool was_npn_negotiated, |
39 bool using_spdy); | 43 bool using_spdy, |
| 44 const NetLog::Source& source); |
40 | 45 |
41 // If this Request has a spdy_session_key, remove this session from the | 46 // If this Request has a spdy_session_key, remove this session from the |
42 // SpdySessionRequestMap. | 47 // SpdySessionRequestMap. |
43 void RemoveRequestFromSpdySessionRequestMap(); | 48 void RemoveRequestFromSpdySessionRequestMap(); |
44 | 49 |
45 // HttpStreamRequest::Delegate methods which we implement. Note we don't | 50 // HttpStreamRequest::Delegate methods which we implement. Note we don't |
46 // actually subclass HttpStreamRequest::Delegate. | 51 // actually subclass HttpStreamRequest::Delegate. |
47 | 52 |
48 void OnStreamReady(const SSLConfig& used_ssl_config, | 53 void OnStreamReady(const SSLConfig& used_ssl_config, |
49 const ProxyInfo& used_proxy_info, | 54 const ProxyInfo& used_proxy_info, |
(...skipping 20 matching lines...) Expand all Loading... |
70 const string16& password); | 75 const string16& password); |
71 virtual LoadState GetLoadState() const; | 76 virtual LoadState GetLoadState() const; |
72 virtual bool was_alternate_protocol_available() const; | 77 virtual bool was_alternate_protocol_available() const; |
73 virtual bool was_npn_negotiated() const; | 78 virtual bool was_npn_negotiated() const; |
74 virtual bool using_spdy() const; | 79 virtual bool using_spdy() const; |
75 | 80 |
76 private: | 81 private: |
77 const GURL url_; | 82 const GURL url_; |
78 HttpStreamFactoryImpl* const factory_; | 83 HttpStreamFactoryImpl* const factory_; |
79 HttpStreamRequest::Delegate* const delegate_; | 84 HttpStreamRequest::Delegate* const delegate_; |
| 85 const BoundNetLog net_log_; |
80 | 86 |
81 // The |job_| that this request is tied to. | 87 // The |job_| that this request is tied to. |
82 HttpStreamFactoryImpl::Job* job_; | 88 HttpStreamFactoryImpl::Job* job_; |
83 scoped_ptr<const HostPortProxyPair> spdy_session_key_; | 89 scoped_ptr<const HostPortProxyPair> spdy_session_key_; |
84 | 90 |
85 bool completed_; | 91 bool completed_; |
86 bool was_alternate_protocol_available_; | 92 bool was_alternate_protocol_available_; |
87 bool was_npn_negotiated_; | 93 bool was_npn_negotiated_; |
88 bool using_spdy_; | 94 bool using_spdy_; |
89 | 95 |
90 DISALLOW_COPY_AND_ASSIGN(Request); | 96 DISALLOW_COPY_AND_ASSIGN(Request); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace net | 99 } // namespace net |
| 100 |
94 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 101 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
OLD | NEW |