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_HTTP_HTTP_STREAM_FACTORY_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 16 matching lines...) Expand all Loading... |
27 class HttpNetworkSession; | 27 class HttpNetworkSession; |
28 struct HttpRequestInfo; | 28 struct HttpRequestInfo; |
29 class HttpStreamRequest; | 29 class HttpStreamRequest; |
30 | 30 |
31 class HttpStreamFactory : public StreamFactory, | 31 class HttpStreamFactory : public StreamFactory, |
32 public HttpStreamRequest::PreconnectDelegate { | 32 public HttpStreamRequest::PreconnectDelegate { |
33 public: | 33 public: |
34 HttpStreamFactory(); | 34 HttpStreamFactory(); |
35 virtual ~HttpStreamFactory(); | 35 virtual ~HttpStreamFactory(); |
36 | 36 |
37 // StreamFactory Interface | |
38 virtual StreamRequest* RequestStream(const HttpRequestInfo* info, | |
39 SSLConfig* ssl_config, | |
40 ProxyInfo* proxy_info, | |
41 HttpNetworkSession* session, | |
42 StreamRequest::Delegate* delegate, | |
43 const BoundNetLog& net_log); | |
44 | |
45 virtual int PreconnectStreams(int num_streams, | |
46 const HttpRequestInfo* info, | |
47 SSLConfig* ssl_config, | |
48 ProxyInfo* proxy_info, | |
49 HttpNetworkSession* session, | |
50 const BoundNetLog& net_log, | |
51 CompletionCallback* callback); | |
52 | |
53 virtual void AddTLSIntolerantServer(const GURL& url); | |
54 virtual bool IsTLSIntolerantServer(const GURL& url); | |
55 | |
56 virtual void ProcessAlternateProtocol( | |
57 HttpAlternateProtocols* alternate_protocols, | |
58 const std::string& alternate_protocol_str, | |
59 const HostPortPair& http_host_port_pair); | |
60 | |
61 virtual GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); | |
62 | |
63 // HttpStreamRequest::PreconnectDelegate API | |
64 virtual void OnPreconnectsComplete(HttpStreamRequest* request, int result); | |
65 | |
66 // Static settings | 37 // Static settings |
67 | 38 |
68 // Turns spdy on or off. | 39 // Turns spdy on or off. |
69 static void set_spdy_enabled(bool value) { | 40 static void set_spdy_enabled(bool value) { |
70 spdy_enabled_ = value; | 41 spdy_enabled_ = value; |
71 if (value == false) | 42 if (value == false) |
72 set_next_protos(""); | 43 set_next_protos(""); |
73 } | 44 } |
74 static bool spdy_enabled() { return spdy_enabled_; } | 45 static bool spdy_enabled() { return spdy_enabled_; } |
75 | 46 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // errors. This is for testing. | 86 // errors. This is for testing. |
116 static void set_ignore_certificate_errors(bool value) { | 87 static void set_ignore_certificate_errors(bool value) { |
117 ignore_certificate_errors_ = value; | 88 ignore_certificate_errors_ = value; |
118 } | 89 } |
119 static bool ignore_certificate_errors() { | 90 static bool ignore_certificate_errors() { |
120 return ignore_certificate_errors_; | 91 return ignore_certificate_errors_; |
121 } | 92 } |
122 | 93 |
123 static void SetHostMappingRules(const std::string& rules); | 94 static void SetHostMappingRules(const std::string& rules); |
124 | 95 |
| 96 // StreamFactory Interface |
| 97 virtual StreamRequest* RequestStream(const HttpRequestInfo* info, |
| 98 SSLConfig* ssl_config, |
| 99 ProxyInfo* proxy_info, |
| 100 HttpNetworkSession* session, |
| 101 StreamRequest::Delegate* delegate, |
| 102 const BoundNetLog& net_log); |
| 103 virtual int PreconnectStreams(int num_streams, |
| 104 const HttpRequestInfo* info, |
| 105 SSLConfig* ssl_config, |
| 106 ProxyInfo* proxy_info, |
| 107 HttpNetworkSession* session, |
| 108 const BoundNetLog& net_log, |
| 109 CompletionCallback* callback); |
| 110 virtual void AddTLSIntolerantServer(const GURL& url); |
| 111 virtual bool IsTLSIntolerantServer(const GURL& url); |
| 112 virtual void ProcessAlternateProtocol( |
| 113 HttpAlternateProtocols* alternate_protocols, |
| 114 const std::string& alternate_protocol_str, |
| 115 const HostPortPair& http_host_port_pair); |
| 116 virtual GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); |
| 117 |
| 118 // HttpStreamRequest::PreconnectDelegate API |
| 119 virtual void OnPreconnectsComplete(HttpStreamRequest* request, int result); |
| 120 |
125 private: | 121 private: |
126 typedef std::map<HttpStreamRequest*, CompletionCallback*> RequestCallbackMap; | 122 typedef std::map<HttpStreamRequest*, CompletionCallback*> RequestCallbackMap; |
127 RequestCallbackMap request_callback_map_; | 123 RequestCallbackMap request_callback_map_; |
128 std::set<std::string> tls_intolerant_servers_; | 124 std::set<std::string> tls_intolerant_servers_; |
129 | 125 |
130 static const HostMappingRules* host_mapping_rules_; | 126 static const HostMappingRules* host_mapping_rules_; |
131 static const std::string* next_protos_; | 127 static const std::string* next_protos_; |
132 static bool spdy_enabled_; | 128 static bool spdy_enabled_; |
133 static bool use_alternate_protocols_; | 129 static bool use_alternate_protocols_; |
134 static bool force_spdy_over_ssl_; | 130 static bool force_spdy_over_ssl_; |
135 static bool force_spdy_always_; | 131 static bool force_spdy_always_; |
136 static std::list<HostPortPair>* forced_spdy_exclusions_; | 132 static std::list<HostPortPair>* forced_spdy_exclusions_; |
137 static bool ignore_certificate_errors_; | 133 static bool ignore_certificate_errors_; |
138 | 134 |
139 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); | 135 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); |
140 }; | 136 }; |
141 | 137 |
142 } // namespace net | 138 } // namespace net |
143 | 139 |
144 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ | 140 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ |
145 | 141 |
OLD | NEW |