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

Side by Side Diff: net/http/http_alternate_protocols.cc

Issue 6465001: Display more information at chrome://net-internals/#spdy... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Clear the Alternate Protocols Mapping inner HTML before adding new values Created 9 years, 10 months 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 | Annotate | Revision Log
OLDNEW
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 #include "net/http/http_alternate_protocols.h" 5 #include "net/http/http_alternate_protocols.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stringprintf.h"
8 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
9 10
10 namespace net { 11 namespace net {
11 12
12 const char HttpAlternateProtocols::kHeader[] = "Alternate-Protocol"; 13 const char HttpAlternateProtocols::kHeader[] = "Alternate-Protocol";
13 const char* const HttpAlternateProtocols::kProtocolStrings[] = { 14 const char* const HttpAlternateProtocols::kProtocolStrings[] = {
14 "npn-spdy/1", 15 "npn-spdy/1",
15 "npn-spdy/2", 16 "npn-spdy/2",
16 }; 17 };
17 18
19 const char* HttpAlternateProtocols::ProtocolToString(
20 HttpAlternateProtocols::Protocol protocol) {
21 switch (protocol) {
22 case HttpAlternateProtocols::NPN_SPDY_1:
23 case HttpAlternateProtocols::NPN_SPDY_2:
24 return HttpAlternateProtocols::kProtocolStrings[protocol];
25 case HttpAlternateProtocols::BROKEN:
26 return "Broken";
27 case HttpAlternateProtocols::UNINITIALIZED:
28 return "Uninitialized";
29 default:
30 NOTREACHED();
31 return "";
32 }
33 }
34
35
36 std::string HttpAlternateProtocols::PortProtocolPair::ToString() const {
37 return base::StringPrintf("%d:%s", port,
38 HttpAlternateProtocols::ProtocolToString(protocol));
39 }
40
18 // static 41 // static
19 HttpAlternateProtocols::PortProtocolPair* 42 HttpAlternateProtocols::PortProtocolPair*
20 HttpAlternateProtocols::forced_alternate_protocol_ = NULL; 43 HttpAlternateProtocols::forced_alternate_protocol_ = NULL;
21 44
22 HttpAlternateProtocols::HttpAlternateProtocols() {} 45 HttpAlternateProtocols::HttpAlternateProtocols() {}
23 HttpAlternateProtocols::~HttpAlternateProtocols() {} 46 HttpAlternateProtocols::~HttpAlternateProtocols() {}
24 47
25 bool HttpAlternateProtocols::HasAlternateProtocolFor( 48 bool HttpAlternateProtocols::HasAlternateProtocolFor(
26 const HostPortPair& http_host_port_pair) const { 49 const HostPortPair& http_host_port_pair) const {
27 return ContainsKey(protocol_map_, http_host_port_pair) || 50 return ContainsKey(protocol_map_, http_host_port_pair) ||
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 forced_alternate_protocol_ = new PortProtocolPair(pair); 128 forced_alternate_protocol_ = new PortProtocolPair(pair);
106 } 129 }
107 130
108 // static 131 // static
109 void HttpAlternateProtocols::DisableForcedAlternateProtocol() { 132 void HttpAlternateProtocols::DisableForcedAlternateProtocol() {
110 delete forced_alternate_protocol_; 133 delete forced_alternate_protocol_;
111 forced_alternate_protocol_ = NULL; 134 forced_alternate_protocol_ = NULL;
112 } 135 }
113 136
114 } // namespace net 137 } // namespace net
OLDNEW
« chrome/browser/resources/net_internals/spdyview.js ('K') | « net/http/http_alternate_protocols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698