Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: net/socket/next_proto.cc

Issue 2496953002: Revert of Unify enum NextProto and enum AlternateProtocol. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/next_proto.h ('k') | net/socket/ssl_client_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 "net/socket/next_proto.h"
6
7 namespace net {
8
9 NextProto NextProtoFromString(base::StringPiece proto_string) {
10 if (proto_string == "http1.1" || proto_string == "http/1.1")
11 return kProtoHTTP11;
12 // "npn-h2" and "npn-spdy/3.1" are accepted here so that persisted
13 // settings with the old string can be loaded from disk.
14 // TODO(bnc): Remove around 2016 December.
15 if (proto_string == "h2" || proto_string == "npn-h2" ||
16 proto_string == "npn-spdy/3.1") {
17 return kProtoHTTP2;
18 }
19 if (proto_string == "quic")
20 return kProtoQUIC;
21
22 return kProtoUnknown;
23 }
24
25 const char* NextProtoToString(NextProto next_proto) {
26 switch (next_proto) {
27 case kProtoHTTP11:
28 return "http/1.1";
29 case kProtoHTTP2:
30 return "h2";
31 case kProtoQUIC:
32 return "quic";
33 case kProtoUnknown:
34 break;
35 }
36 return "unknown";
37 }
38
39 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/next_proto.h ('k') | net/socket/ssl_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698