| 1 | /* |
| 2 | * Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 | * Copyright (C) 2016 Akamai Technologies Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #include <wtf/text/WTFString.h> |
| 30 | |
| 31 | namespace WebCore { |
| 32 | |
| 33 | class { |
| 34 | public: |
| 35 | template <typename CharacterType> |
| 36 | (CharacterType*& position, CharacterType* const end); |
| 37 | |
| 38 | const String& () const { return m_url; } |
| 39 | const String& () const { return m_rel; } |
| 40 | const String& () const { return m_as; } |
| 41 | const String& () const { return m_mimeType; } |
| 42 | const String& () const { return m_media; } |
| 43 | const String& () const { return m_crossOrigin; } |
| 44 | const String& () const { return m_imageSrcSet; } |
| 45 | const String& () const { return m_imageSizes; } |
| 46 | bool () const { return m_isValid; } |
| 47 | bool () const { return !media().isEmpty() || !imageSrcSet().isEmpty() || !imageSizes().isEmpty(); } |
| 48 | |
| 49 | enum { |
| 50 | , |
| 51 | , |
| 52 | , |
| 53 | , |
| 54 | , |
| 55 | , |
| 56 | , |
| 57 | // Beyond this point, only link-extension parameters |
| 58 | , |
| 59 | , |
| 60 | , |
| 61 | , |
| 62 | , |
| 63 | }; |
| 64 | |
| 65 | private: |
| 66 | void (LinkParameterName, String&& value); |
| 67 | |
| 68 | String ; |
| 69 | String ; |
| 70 | String ; |
| 71 | String ; |
| 72 | String ; |
| 73 | String ; |
| 74 | String ; |
| 75 | String ; |
| 76 | bool { true }; |
| 77 | }; |
| 78 | |
| 79 | class { |
| 80 | public: |
| 81 | (const String& ); |
| 82 | |
| 83 | Vector<LinkHeader>::const_iterator () const { return m_headerSet.begin(); } |
| 84 | Vector<LinkHeader>::const_iterator () const { return m_headerSet.end(); } |
| 85 | |
| 86 | private: |
| 87 | template <typename CharacterType> |
| 88 | void (CharacterType* , size_t length); |
| 89 | |
| 90 | Vector<LinkHeader> ; |
| 91 | }; |
| 92 | |
| 93 | } // namespace WebCore |
| 94 | |
| 95 | |