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

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

Issue 2561903002: [downloads] Set initiator when handling downloads via a[download] (Closed)
Patch Set: Fix compilation Created 4 years 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 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 policy, completedURL, document().outgoingReferrer())); 414 policy, completedURL, document().outgoingReferrer()));
415 } 415 }
416 416
417 if (hasAttribute(downloadAttr)) { 417 if (hasAttribute(downloadAttr)) {
418 request.setRequestContext(WebURLRequest::RequestContextDownload); 418 request.setRequestContext(WebURLRequest::RequestContextDownload);
419 bool isSameOrigin = 419 bool isSameOrigin =
420 completedURL.protocolIsData() || 420 completedURL.protocolIsData() ||
421 document().getSecurityOrigin()->canRequest(completedURL); 421 document().getSecurityOrigin()->canRequest(completedURL);
422 const AtomicString& suggestedName = 422 const AtomicString& suggestedName =
423 (isSameOrigin ? fastGetAttribute(downloadAttr) : nullAtom); 423 (isSameOrigin ? fastGetAttribute(downloadAttr) : nullAtom);
424 request.setRequestorOrigin(SecurityOrigin::create(document().url()));
424 425
425 frame->loader().client()->loadURLExternally( 426 frame->loader().client()->loadURLExternally(
426 request, NavigationPolicyDownload, suggestedName, false); 427 request, NavigationPolicyDownload, suggestedName, false);
427 } else { 428 } else {
428 request.setRequestContext(WebURLRequest::RequestContextHyperlink); 429 request.setRequestContext(WebURLRequest::RequestContextHyperlink);
429 FrameLoadRequest frameRequest(&document(), request, 430 FrameLoadRequest frameRequest(&document(), request,
430 getAttribute(targetAttr)); 431 getAttribute(targetAttr));
431 frameRequest.setTriggeringEvent(event); 432 frameRequest.setTriggeringEvent(event);
432 if (hasRel(RelationNoReferrer)) { 433 if (hasRel(RelationNoReferrer)) {
433 frameRequest.setShouldSendReferrer(NeverSendReferrer); 434 frameRequest.setShouldSendReferrer(NeverSendReferrer);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 475 }
475 476
476 HTMLAnchorElement::NavigationHintSender* 477 HTMLAnchorElement::NavigationHintSender*
477 HTMLAnchorElement::ensureNavigationHintSender() { 478 HTMLAnchorElement::ensureNavigationHintSender() {
478 if (!m_navigationHintSender) 479 if (!m_navigationHintSender)
479 m_navigationHintSender = NavigationHintSender::create(this); 480 m_navigationHintSender = NavigationHintSender::create(this);
480 return m_navigationHintSender; 481 return m_navigationHintSender;
481 } 482 }
482 483
483 } // namespace blink 484 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698