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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2424943002: Add ReferrerPolicy support to preload (Closed)
Patch Set: Test fix Created 4 years, 1 month 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
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 21 matching lines...) Expand all
32 #include "core/dom/TaskRunnerHelper.h" 32 #include "core/dom/TaskRunnerHelper.h"
33 #include "core/events/Event.h" 33 #include "core/events/Event.h"
34 #include "core/frame/UseCounter.h" 34 #include "core/frame/UseCounter.h"
35 #include "core/html/CrossOriginAttribute.h" 35 #include "core/html/CrossOriginAttribute.h"
36 #include "core/html/LinkManifest.h" 36 #include "core/html/LinkManifest.h"
37 #include "core/html/imports/LinkImport.h" 37 #include "core/html/imports/LinkImport.h"
38 #include "core/inspector/ConsoleMessage.h" 38 #include "core/inspector/ConsoleMessage.h"
39 #include "core/loader/FrameLoaderClient.h" 39 #include "core/loader/FrameLoaderClient.h"
40 #include "core/loader/NetworkHintsInterface.h" 40 #include "core/loader/NetworkHintsInterface.h"
41 #include "core/origin_trials/OriginTrials.h" 41 #include "core/origin_trials/OriginTrials.h"
42 #include "platform/weborigin/SecurityPolicy.h"
42 #include "public/platform/WebIconSizesParser.h" 43 #include "public/platform/WebIconSizesParser.h"
43 #include "public/platform/WebSize.h" 44 #include "public/platform/WebSize.h"
44 45
45 namespace blink { 46 namespace blink {
46 47
47 using namespace HTMLNames; 48 using namespace HTMLNames;
48 49
49 inline HTMLLinkElement::HTMLLinkElement(Document& document, 50 inline HTMLLinkElement::HTMLLinkElement(Document& document,
50 bool createdByParser) 51 bool createdByParser)
51 : HTMLElement(linkTag, document), 52 : HTMLElement(linkTag, document),
(...skipping 20 matching lines...) Expand all
72 // Log href attribute before logging resource fetching in process(). 73 // Log href attribute before logging resource fetching in process().
73 logUpdateAttributeIfIsolatedWorldAndInDocument("link", hrefAttr, oldValue, 74 logUpdateAttributeIfIsolatedWorldAndInDocument("link", hrefAttr, oldValue,
74 value); 75 value);
75 process(); 76 process();
76 } else if (name == typeAttr) { 77 } else if (name == typeAttr) {
77 m_type = value; 78 m_type = value;
78 process(); 79 process();
79 } else if (name == asAttr) { 80 } else if (name == asAttr) {
80 m_as = value; 81 m_as = value;
81 process(); 82 process();
83 } else if (name == referrerpolicyAttr) {
84 m_referrerPolicy = ReferrerPolicyDefault;
85 if (!value.isNull())
86 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy);
82 } else if (name == sizesAttr) { 87 } else if (name == sizesAttr) {
83 m_sizes->setValue(value); 88 m_sizes->setValue(value);
84 } else if (name == mediaAttr) { 89 } else if (name == mediaAttr) {
85 m_media = value.lower(); 90 m_media = value.lower();
86 process(); 91 process();
87 } else if (name == scopeAttr) { 92 } else if (name == scopeAttr) {
88 m_scope = value; 93 m_scope = value;
89 process(); 94 process();
90 } else if (name == disabledAttr) { 95 } else if (name == disabledAttr) {
91 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled); 96 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled);
92 if (LinkStyle* link = linkStyle()) 97 if (LinkStyle* link = linkStyle())
93 link->setDisabledState(!value.isNull()); 98 link->setDisabledState(!value.isNull());
94 } else { 99 } else {
95 if (name == titleAttr) { 100 if (name == titleAttr) {
96 if (LinkStyle* link = linkStyle()) 101 if (LinkStyle* link = linkStyle())
97 link->setSheetTitle(value, StyleEngine::UpdateActiveSheets); 102 link->setSheetTitle(value, StyleEngine::UpdateActiveSheets);
98 } 103 }
99 104
100 HTMLElement::parseAttribute(name, oldValue, value); 105 HTMLElement::parseAttribute(name, oldValue, value);
101 } 106 }
102 } 107 }
103 108
104 bool HTMLLinkElement::shouldLoadLink() { 109 bool HTMLLinkElement::shouldLoadLink() {
105 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet()); 110 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet());
106 } 111 }
107 112
108 bool HTMLLinkElement::loadLink(const String& type, 113 bool HTMLLinkElement::loadLink(const String& type,
109 const String& as, 114 const String& as,
110 const String& media, 115 const String& media,
116 ReferrerPolicy referrerPolicy,
111 const KURL& url) { 117 const KURL& url) {
112 return m_linkLoader->loadLink( 118 return m_linkLoader->loadLink(
113 m_relAttribute, 119 m_relAttribute,
114 crossOriginAttributeValue(fastGetAttribute(HTMLNames::crossoriginAttr)), 120 crossOriginAttributeValue(fastGetAttribute(HTMLNames::crossoriginAttr)),
115 type, as, media, url, document(), NetworkHintsInterfaceImpl()); 121 type, as, media, referrerPolicy, url, document(),
122 NetworkHintsInterfaceImpl());
116 } 123 }
117 124
118 LinkResource* HTMLLinkElement::linkResourceToProcess() { 125 LinkResource* HTMLLinkElement::linkResourceToProcess() {
119 if (!shouldLoadLink()) { 126 if (!shouldLoadLink()) {
120 DCHECK(!linkStyle() || !linkStyle()->hasSheet()); 127 DCHECK(!linkStyle() || !linkStyle()->hasSheet());
121 return nullptr; 128 return nullptr;
122 } 129 }
123 130
124 if (!m_link) { 131 if (!m_link) {
125 if (m_relAttribute.isImport()) { 132 if (m_relAttribute.isImport()) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 LinkLoaderClient::trace(visitor); 360 LinkLoaderClient::trace(visitor);
354 DOMTokenListObserver::trace(visitor); 361 DOMTokenListObserver::trace(visitor);
355 } 362 }
356 363
357 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) { 364 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) {
358 visitor->traceWrappers(m_relList); 365 visitor->traceWrappers(m_relList);
359 HTMLElement::traceWrappers(visitor); 366 HTMLElement::traceWrappers(visitor);
360 } 367 }
361 368
362 } // namespace blink 369 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.h ('k') | third_party/WebKit/Source/core/html/LinkStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698