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

Side by Side Diff: Source/core/html/HTMLFrameOwnerElement.cpp

Issue 1328183002: Implement referrerpolicy attr for iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update webexposed tests Created 5 years, 3 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
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLIFrameElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 16 matching lines...) Expand all
27 #include "core/dom/ExceptionCode.h" 27 #include "core/dom/ExceptionCode.h"
28 #include "core/events/Event.h" 28 #include "core/events/Event.h"
29 #include "core/frame/FrameHost.h" 29 #include "core/frame/FrameHost.h"
30 #include "core/frame/FrameView.h" 30 #include "core/frame/FrameView.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 #include "core/layout/LayoutPart.h" 32 #include "core/layout/LayoutPart.h"
33 #include "core/loader/FrameLoadRequest.h" 33 #include "core/loader/FrameLoadRequest.h"
34 #include "core/loader/FrameLoader.h" 34 #include "core/loader/FrameLoader.h"
35 #include "core/loader/FrameLoaderClient.h" 35 #include "core/loader/FrameLoaderClient.h"
36 #include "core/plugins/PluginView.h" 36 #include "core/plugins/PluginView.h"
37 #include "platform/RuntimeEnabledFeatures.h"
37 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 typedef WillBeHeapHashMap<RefPtrWillBeMember<Widget>, RawPtrWillBeMember<FrameVi ew>> WidgetToParentMap; 42 typedef WillBeHeapHashMap<RefPtrWillBeMember<Widget>, RawPtrWillBeMember<FrameVi ew>> WidgetToParentMap;
42 static WidgetToParentMap& widgetNewParentMap() 43 static WidgetToParentMap& widgetNewParentMap()
43 { 44 {
44 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WidgetToParentMap>, map, (adoptPt rWillBeNoop(new WidgetToParentMap()))); 45 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WidgetToParentMap>, map, (adoptPt rWillBeNoop(new WidgetToParentMap())));
45 return *map; 46 return *map;
46 } 47 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); 255 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string());
255 return false; 256 return false;
256 } 257 }
257 258
258 if (!SubframeLoadingDisabler::canLoadFrame(*this)) 259 if (!SubframeLoadingDisabler::canLoadFrame(*this))
259 return false; 260 return false;
260 261
261 if (document().frame()->host()->subframeCount() >= FrameHost::maxNumberOfFra mes) 262 if (document().frame()->host()->subframeCount() >= FrameHost::maxNumberOfFra mes)
262 return false; 263 return false;
263 264
264 return parentFrame->loader().client()->createFrame(FrameLoadRequest(&documen t(), url, "_self", CheckContentSecurityPolicy), frameName, this); 265 FrameLoadRequest frameLoadRequest(&document(), url, "_self", CheckContentSec urityPolicy);
266
267 if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled()) {
268 ReferrerPolicy policy = referrerPolicyAttribute();
269 if (policy != ReferrerPolicyDefault)
270 frameLoadRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::g enerateReferrer(policy, url, document().outgoingReferrer()));
271 }
272
273 return parentFrame->loader().client()->createFrame(frameLoadRequest, frameNa me, this);
265 } 274 }
266 275
267 DEFINE_TRACE(HTMLFrameOwnerElement) 276 DEFINE_TRACE(HTMLFrameOwnerElement)
268 { 277 {
269 visitor->trace(m_contentFrame); 278 visitor->trace(m_contentFrame);
270 visitor->trace(m_widget); 279 visitor->trace(m_widget);
271 HTMLElement::trace(visitor); 280 HTMLElement::trace(visitor);
272 FrameOwner::trace(visitor); 281 FrameOwner::trace(visitor);
273 } 282 }
274 283
275 284
276 } // namespace blink 285 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLIFrameElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698