1 // Copyright 2019 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.
4 
5 #include "components/page_load_metrics/browser/protocol_util.h"
6 
7 namespace page_load_metrics {
8 
GetNetworkProtocol(net::HttpResponseInfo::ConnectionInfo connection_info)9 NetworkProtocol GetNetworkProtocol(
10     net::HttpResponseInfo::ConnectionInfo connection_info) {
11   if (connection_info == net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1) {
12     return NetworkProtocol::kHttp11;
13   }
14   if (connection_info == net::HttpResponseInfo::CONNECTION_INFO_HTTP2) {
15     return NetworkProtocol::kHttp2;
16   }
17   if (net::HttpResponseInfo::ConnectionInfoToCoarse(connection_info) ==
18       net::HttpResponseInfo::CONNECTION_INFO_COARSE_QUIC) {
19     return NetworkProtocol::kQuic;
20   }
21   return NetworkProtocol::kOther;
22 }
23 
24 }  // namespace page_load_metrics
25