Remove kIgnoreResolutionLimitsForAcceleratedVideoDecode flag
[chromium-blink-merge.git] / net / http / http_stream_factory_impl_request.h
blob7bc41afc0b0016790e37410fd446a6b12e5ab0bb
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
8 #include <set>
9 #include "base/memory/scoped_ptr.h"
10 #include "net/http/http_stream_factory_impl.h"
11 #include "net/log/net_log.h"
12 #include "net/socket/connection_attempts.h"
13 #include "net/socket/ssl_client_socket.h"
14 #include "net/spdy/spdy_session_key.h"
15 #include "url/gurl.h"
17 namespace net {
19 class ClientSocketHandle;
20 class HttpStream;
21 class SpdySession;
23 class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
24 public:
25 Request(const GURL& url,
26 HttpStreamFactoryImpl* factory,
27 HttpStreamRequest::Delegate* delegate,
28 WebSocketHandshakeStreamBase::CreateHelper*
29 websocket_handshake_stream_create_helper,
30 const BoundNetLog& net_log);
31 ~Request() override;
33 // The GURL from the HttpRequestInfo the started the Request.
34 const GURL& url() const { return url_; }
36 // Called when the Job determines the appropriate |spdy_session_key| for the
37 // Request. Note that this does not mean that SPDY is necessarily supported
38 // for this SpdySessionKey, since we may need to wait for NPN to complete
39 // before knowing if SPDY is available.
40 void SetSpdySessionKey(const SpdySessionKey& spdy_session_key);
41 bool HasSpdySessionKey() const;
43 // Attaches |job| to this request. Does not mean that Request will use |job|,
44 // but Request will own |job|.
45 void AttachJob(HttpStreamFactoryImpl::Job* job);
47 // Marks completion of the request. Must be called before OnStreamReady().
48 // |job_net_log| is the BoundNetLog of the Job that fulfilled this request.
49 void Complete(bool was_npn_negotiated,
50 NextProto protocol_negotiated,
51 bool using_spdy,
52 const BoundNetLog& job_net_log);
54 // If this Request has a |spdy_session_key_|, remove this session from the
55 // SpdySessionRequestMap.
56 void RemoveRequestFromSpdySessionRequestMap();
58 // Called by an attached Job if it sets up a SpdySession.
59 void OnNewSpdySessionReady(Job* job,
60 scoped_ptr<HttpStream> stream,
61 const base::WeakPtr<SpdySession>& spdy_session,
62 bool direct);
64 // Called by an attached Job to record connection attempts made by the socket
65 // layer for this stream request.
66 void AddConnectionAttempts(const ConnectionAttempts& attempts);
68 WebSocketHandshakeStreamBase::CreateHelper*
69 websocket_handshake_stream_create_helper() {
70 return websocket_handshake_stream_create_helper_;
73 // HttpStreamRequest::Delegate methods which we implement. Note we don't
74 // actually subclass HttpStreamRequest::Delegate.
76 void OnStreamReady(Job* job,
77 const SSLConfig& used_ssl_config,
78 const ProxyInfo& used_proxy_info,
79 HttpStream* stream);
80 void OnWebSocketHandshakeStreamReady(Job* job,
81 const SSLConfig& used_ssl_config,
82 const ProxyInfo& used_proxy_info,
83 WebSocketHandshakeStreamBase* stream);
84 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config);
85 void OnCertificateError(Job* job,
86 int status,
87 const SSLConfig& used_ssl_config,
88 const SSLInfo& ssl_info);
89 void OnNeedsProxyAuth(Job* job,
90 const HttpResponseInfo& proxy_response,
91 const SSLConfig& used_ssl_config,
92 const ProxyInfo& used_proxy_info,
93 HttpAuthController* auth_controller);
94 void OnNeedsClientAuth(Job* job,
95 const SSLConfig& used_ssl_config,
96 SSLCertRequestInfo* cert_info);
97 void OnHttpsProxyTunnelResponse(
98 Job *job,
99 const HttpResponseInfo& response_info,
100 const SSLConfig& used_ssl_config,
101 const ProxyInfo& used_proxy_info,
102 HttpStream* stream);
104 // HttpStreamRequest methods.
106 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials) override;
107 void SetPriority(RequestPriority priority) override;
108 LoadState GetLoadState() const override;
109 bool was_npn_negotiated() const override;
110 NextProto protocol_negotiated() const override;
111 bool using_spdy() const override;
112 const ConnectionAttempts& connection_attempts() const override;
114 private:
115 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound"
116 // to the request.
117 void OrphanJobsExcept(Job* job);
119 // Used to orphan all jobs in |jobs_|.
120 void OrphanJobs();
122 // Called when a Job succeeds.
123 void OnJobSucceeded(Job* job);
125 const GURL url_;
126 HttpStreamFactoryImpl* const factory_;
127 WebSocketHandshakeStreamBase::CreateHelper* const
128 websocket_handshake_stream_create_helper_;
129 HttpStreamRequest::Delegate* const delegate_;
130 const BoundNetLog net_log_;
132 // At the point where Job is irrevocably tied to the Request, we set this.
133 scoped_ptr<Job> bound_job_;
134 std::set<HttpStreamFactoryImpl::Job*> jobs_;
135 scoped_ptr<const SpdySessionKey> spdy_session_key_;
137 bool completed_;
138 bool was_npn_negotiated_;
139 // Protocol negotiated with the server.
140 NextProto protocol_negotiated_;
141 bool using_spdy_;
142 ConnectionAttempts connection_attempts_;
144 DISALLOW_COPY_AND_ASSIGN(Request);
147 } // namespace net
149 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_