OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/net/preconnect.h" | 5 #include "chrome/browser/net/preconnect.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // Translate the motivation from UrlRequest motivations to HttpRequest | 83 // Translate the motivation from UrlRequest motivations to HttpRequest |
84 // motivations. | 84 // motivations. |
85 switch (motivation) { | 85 switch (motivation) { |
86 case UrlInfo::OMNIBOX_MOTIVATED: | 86 case UrlInfo::OMNIBOX_MOTIVATED: |
87 request_info.motivation = net::HttpRequestInfo::OMNIBOX_MOTIVATED; | 87 request_info.motivation = net::HttpRequestInfo::OMNIBOX_MOTIVATED; |
88 break; | 88 break; |
89 case UrlInfo::LEARNED_REFERAL_MOTIVATED: | 89 case UrlInfo::LEARNED_REFERAL_MOTIVATED: |
90 request_info.motivation = net::HttpRequestInfo::PRECONNECT_MOTIVATED; | 90 request_info.motivation = net::HttpRequestInfo::PRECONNECT_MOTIVATED; |
91 break; | 91 break; |
| 92 case UrlInfo::MOUSE_OVER_MOTIVATED: |
92 case UrlInfo::SELF_REFERAL_MOTIVATED: | 93 case UrlInfo::SELF_REFERAL_MOTIVATED: |
93 case UrlInfo::EARLY_LOAD_MOTIVATED: | 94 case UrlInfo::EARLY_LOAD_MOTIVATED: |
94 request_info.motivation = net::HttpRequestInfo::EARLY_LOAD_MOTIVATED; | 95 request_info.motivation = net::HttpRequestInfo::EARLY_LOAD_MOTIVATED; |
95 break; | 96 break; |
96 default: | 97 default: |
97 // Other motivations should never happen here. | 98 // Other motivations should never happen here. |
98 NOTREACHED(); | 99 NOTREACHED(); |
99 break; | 100 break; |
100 } | 101 } |
101 | 102 |
102 // Setup the SSL Configuration. | 103 // Setup the SSL Configuration. |
103 net::SSLConfig ssl_config; | 104 net::SSLConfig ssl_config; |
104 session->ssl_config_service()->GetSSLConfig(&ssl_config); | 105 session->ssl_config_service()->GetSSLConfig(&ssl_config); |
105 if (session->http_stream_factory()->has_next_protos()) | 106 if (session->http_stream_factory()->has_next_protos()) |
106 ssl_config.next_protos = session->http_stream_factory()->next_protos(); | 107 ssl_config.next_protos = session->http_stream_factory()->next_protos(); |
107 | 108 |
108 // All preconnects should perform EV certificate verification. | 109 // All preconnects should perform EV certificate verification. |
109 ssl_config.verify_ev_cert = true; | 110 ssl_config.verify_ev_cert = true; |
110 | 111 |
111 net::HttpStreamFactory* http_stream_factory = session->http_stream_factory(); | 112 net::HttpStreamFactory* http_stream_factory = session->http_stream_factory(); |
112 http_stream_factory->PreconnectStreams(count, request_info, priority, | 113 http_stream_factory->PreconnectStreams(count, request_info, priority, |
113 ssl_config, ssl_config); | 114 ssl_config, ssl_config); |
114 } | 115 } |
115 | 116 |
116 } // namespace chrome_browser_net | 117 } // namespace chrome_browser_net |
OLD | NEW |