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

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

Issue 1755803002: Ship `referrerpolicy` attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update webexposed layout tests Created 4 years, 9 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
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) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 17 matching lines...) Expand all
28 #include "core/frame/FrameHost.h" 28 #include "core/frame/FrameHost.h"
29 #include "core/frame/Settings.h" 29 #include "core/frame/Settings.h"
30 #include "core/frame/UseCounter.h" 30 #include "core/frame/UseCounter.h"
31 #include "core/html/HTMLImageElement.h" 31 #include "core/html/HTMLImageElement.h"
32 #include "core/html/parser/HTMLParserIdioms.h" 32 #include "core/html/parser/HTMLParserIdioms.h"
33 #include "core/layout/LayoutImage.h" 33 #include "core/layout/LayoutImage.h"
34 #include "core/loader/FrameLoadRequest.h" 34 #include "core/loader/FrameLoadRequest.h"
35 #include "core/loader/FrameLoaderClient.h" 35 #include "core/loader/FrameLoaderClient.h"
36 #include "core/loader/PingLoader.h" 36 #include "core/loader/PingLoader.h"
37 #include "core/page/ChromeClient.h" 37 #include "core/page/ChromeClient.h"
38 #include "platform/RuntimeEnabledFeatures.h"
39 #include "platform/network/NetworkHints.h" 38 #include "platform/network/NetworkHints.h"
40 #include "platform/weborigin/SecurityPolicy.h" 39 #include "platform/weborigin/SecurityPolicy.h"
41 40
42 namespace blink { 41 namespace blink {
43 42
44 using namespace HTMLNames; 43 using namespace HTMLNames;
45 44
46 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc ument) 45 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc ument)
47 : HTMLElement(tagName, document) 46 : HTMLElement(tagName, document)
48 , m_linkRelations(0) 47 , m_linkRelations(0)
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 330
332 // Schedule the ping before the frame load. Prerender in Chrome may kill the renderer as soon as the navigation is 331 // Schedule the ping before the frame load. Prerender in Chrome may kill the renderer as soon as the navigation is
333 // sent out. 332 // sent out.
334 sendPings(completedURL); 333 sendPings(completedURL);
335 334
336 ResourceRequest request(completedURL); 335 ResourceRequest request(completedURL);
337 request.setUIStartTime(event->platformTimeStamp()); 336 request.setUIStartTime(event->platformTimeStamp());
338 request.setInputPerfMetricReportPolicy(InputToLoadPerfMetricReportPolicy::Re portLink); 337 request.setInputPerfMetricReportPolicy(InputToLoadPerfMetricReportPolicy::Re portLink);
339 338
340 ReferrerPolicy policy; 339 ReferrerPolicy policy;
341 if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && hasAttribute (referrerpolicyAttr) && SecurityPolicy::referrerPolicyFromString(fastGetAttribut e(referrerpolicyAttr), &policy) && !hasRel(RelationNoReferrer)) { 340 if (hasAttribute(referrerpolicyAttr) && SecurityPolicy::referrerPolicyFromSt ring(fastGetAttribute(referrerpolicyAttr), &policy) && !hasRel(RelationNoReferre r)) {
342 request.setHTTPReferrer(SecurityPolicy::generateReferrer(policy, complet edURL, document().outgoingReferrer())); 341 request.setHTTPReferrer(SecurityPolicy::generateReferrer(policy, complet edURL, document().outgoingReferrer()));
343 } 342 }
344 343
345 if (hasAttribute(downloadAttr)) { 344 if (hasAttribute(downloadAttr)) {
346 request.setRequestContext(WebURLRequest::RequestContextDownload); 345 request.setRequestContext(WebURLRequest::RequestContextDownload);
347 bool isSameOrigin = completedURL.protocolIsData() || document().security Origin()->canRequest(completedURL); 346 bool isSameOrigin = completedURL.protocolIsData() || document().security Origin()->canRequest(completedURL);
348 const AtomicString& suggestedName = (isSameOrigin ? fastGetAttribute(dow nloadAttr) : nullAtom); 347 const AtomicString& suggestedName = (isSameOrigin ? fastGetAttribute(dow nloadAttr) : nullAtom);
349 348
350 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, suggestedName, false); 349 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, suggestedName, false);
351 } else { 350 } else {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 382 }
384 383
385 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint) 384 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint)
386 { 385 {
387 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int); 386 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int);
388 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr); 387 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr);
389 return request; 388 return request;
390 } 389 }
391 390
392 } // namespace blink 391 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698