OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/network/LinkHeader.h" | 5 #include "platform/network/LinkHeader.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "components/link_header_util/link_header_util.h" | 8 #include "components/link_header_util/link_header_util.h" |
9 #include "wtf/text/ParsingUtilities.h" | 9 #include "wtf/text/ParsingUtilities.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 // Verify that the parameter is a link-extension which according to spec doesn't
have to have a value. | 13 // Verify that the parameter is a link-extension which according to spec doesn't |
| 14 // have to have a value. |
14 static bool isExtensionParameter(LinkHeader::LinkParameterName name) { | 15 static bool isExtensionParameter(LinkHeader::LinkParameterName name) { |
15 return name >= LinkHeader::LinkParameterUnknown; | 16 return name >= LinkHeader::LinkParameterUnknown; |
16 } | 17 } |
17 | 18 |
18 static LinkHeader::LinkParameterName parameterNameFromString( | 19 static LinkHeader::LinkParameterName parameterNameFromString( |
19 base::StringPiece name) { | 20 base::StringPiece name) { |
20 if (base::EqualsCaseInsensitiveASCII(name, "rel")) | 21 if (base::EqualsCaseInsensitiveASCII(name, "rel")) |
21 return LinkHeader::LinkParameterRel; | 22 return LinkHeader::LinkParameterRel; |
22 if (base::EqualsCaseInsensitiveASCII(name, "anchor")) | 23 if (base::EqualsCaseInsensitiveASCII(name, "anchor")) |
23 return LinkHeader::LinkParameterAnchor; | 24 return LinkHeader::LinkParameterAnchor; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return; | 77 return; |
77 | 78 |
78 DCHECK(header.is8Bit()) << "Headers should always be 8 bit"; | 79 DCHECK(header.is8Bit()) << "Headers should always be 8 bit"; |
79 std::string headerString(reinterpret_cast<const char*>(header.characters8()), | 80 std::string headerString(reinterpret_cast<const char*>(header.characters8()), |
80 header.length()); | 81 header.length()); |
81 for (const auto& value : link_header_util::SplitLinkHeader(headerString)) | 82 for (const auto& value : link_header_util::SplitLinkHeader(headerString)) |
82 m_headerSet.append(LinkHeader(value.first, value.second)); | 83 m_headerSet.append(LinkHeader(value.first, value.second)); |
83 } | 84 } |
84 | 85 |
85 } // namespace blink | 86 } // namespace blink |
OLD | NEW |