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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkHeader.h

Issue 1729963002: WIP/proof-of-concept to make blink::LinkHeader reuse net:: parsing code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string-tokenizer-brackets
Patch Set: Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef LinkHeader_h
6 #define LinkHeader_h
7
8 #include "core/CoreExport.h"
9 #include "core/html/CrossOriginAttribute.h"
10 #include "wtf/Allocator.h"
11 #include "wtf/text/WTFString.h"
12
13 namespace blink {
14
15 class LinkHeader {
16 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
17 public:
18 template <typename CharType>
19 LinkHeader(CharType*& position, CharType* end);
20
21 const String& url() const { return m_url; }
22 const String& rel() const { return m_rel; }
23 const String& as() const { return m_as; }
24 CrossOriginAttributeValue crossOrigin() const { return m_crossOrigin; }
25 bool valid() const { return m_isValid; }
26
27 enum LinkParameterName {
28 LinkParameterRel,
29 LinkParameterAnchor,
30 LinkParameterTitle,
31 LinkParameterMedia,
32 LinkParameterType,
33 LinkParameterRev,
34 LinkParameterHreflang,
35 // Beyond this point, only link-extension parameters
36 LinkParameterUnknown,
37 LinkParameterCrossOrigin,
38 LinkParameterAs,
39 };
40
41 private:
42 void setValue(LinkParameterName, String value);
43
44 String m_url;
45 String m_rel;
46 String m_as;
47 CrossOriginAttributeValue m_crossOrigin;
48 bool m_isValid;
49 };
50
51 class CORE_EXPORT LinkHeaderSet {
52 STACK_ALLOCATED();
53 public:
54 LinkHeaderSet(const String& header);
55
56 Vector<LinkHeader>::const_iterator begin() const { return m_headerSet.begin( ); }
57 Vector<LinkHeader>::const_iterator end() const { return m_headerSet.end(); }
58 LinkHeader& operator[](size_t i) { return m_headerSet[i]; }
59 size_t size() { return m_headerSet.size(); }
60
61 private:
62 template <typename CharType>
63 void init(CharType* headerValue, unsigned len);
64
65 Vector<LinkHeader> m_headerSet;
66 };
67
68 } // namespace blink
69
70 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/loader/LinkHeader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698