summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 03:37:23 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 03:37:23 +0000
commitd759912753b5a71f294cd96e6fb8ea1c6e4efc12 (patch)
tree77a0be70260be8e9963cb37f4576c5e8b09ea72d /net/socket
parentd6cc5d74d5816c6e097e110e30b47b7a36149367 (diff)
downloadchromium_src-d759912753b5a71f294cd96e6fb8ea1c6e4efc12.zip
chromium_src-d759912753b5a71f294cd96e6fb8ea1c6e4efc12.tar.gz
chromium_src-d759912753b5a71f294cd96e6fb8ea1c6e4efc12.tar.bz2
Remove HttpStreamFactory's NPN/SPDY globals, except for spdy_enabled.
Instead, each HttpNetworkSession is given its own immutable copies on construction. Other than spdy_enabled, none of the globals were changed before this CL, anyways. Also, setting spdy_enabled back to true after setting it to false no longer clears the NPN list. spdy_enabled is still a global because group policy can set it to false at runtime. BUG=372533 R=joaodasilva@chromium.org, rch@chromium.org, sergeyu@chromium.org, sgurun@chromium.org, sky@chromium.org, ttuttle@chromium.org Review URL: https://codereview.chromium.org/284423002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/next_proto.cc52
-rw-r--r--net/socket/next_proto.h17
2 files changed, 69 insertions, 0 deletions
diff --git a/net/socket/next_proto.cc b/net/socket/next_proto.cc
new file mode 100644
index 0000000..bf9b86e
--- /dev/null
+++ b/net/socket/next_proto.cc
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "next_proto.h"
+
+namespace net {
+
+NextProtoVector NextProtosHttpOnly() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy3() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy31() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy31WithSpdy2() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoDeprecatedSPDY2);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy4Http2() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ next_protos.push_back(kProtoSPDY4);
+ return next_protos;
+}
+
+} // namespace net
diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h
index ab28a35..797c6ae 100644
--- a/net/socket/next_proto.h
+++ b/net/socket/next_proto.h
@@ -5,6 +5,10 @@
#ifndef NET_SOCKET_NEXT_PROTO_H_
#define NET_SOCKET_NEXT_PROTO_H_
+#include <vector>
+
+#include "net/base/net_export.h"
+
namespace net {
// Next Protocol Negotiation (NPN), if successful, results in agreement on an
@@ -28,6 +32,19 @@ enum NextProto {
kProtoMaximumVersion = kProtoQUIC1SPDY3,
};
+// List of protocols to use for NPN, used for configuring HttpNetworkSessions.
+typedef std::vector<NextProto> NextProtoVector;
+
+// Convenience functions to create NextProtoVector.
+
+NET_EXPORT NextProtoVector NextProtosHttpOnly();
+
+// All of these also enable QUIC.
+NET_EXPORT NextProtoVector NextProtosSpdy3();
+NET_EXPORT NextProtoVector NextProtosSpdy31();
+NET_EXPORT NextProtoVector NextProtosSpdy31WithSpdy2();
+NET_EXPORT NextProtoVector NextProtosSpdy4Http2();
+
} // namespace net
#endif // NET_SOCKET_NEXT_PROTO_H_