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

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: move referrerpolicy retrieval to subclass 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
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 17 matching lines...) Expand all
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/weborigin/SecurityOrigin.h" 37 #include "platform/weborigin/SecurityOrigin.h"
38 #include "platform/weborigin/SecurityPolicy.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 }
47 48
(...skipping 206 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 ReferrerPolicy policy;
268 if (referrerPolicyAttribute(&policy)) {
Yoav Weiss 2015/09/08 09:55:08 I think it would be cleaner to change referrerPoli
estark 2015/09/08 14:40:34 Done.
269 frameLoadRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::gener ateReferrer(policy, url, document().outgoingReferrer()));
270 }
271
272 return parentFrame->loader().client()->createFrame(frameLoadRequest, frameNa me, this);
265 } 273 }
266 274
267 DEFINE_TRACE(HTMLFrameOwnerElement) 275 DEFINE_TRACE(HTMLFrameOwnerElement)
268 { 276 {
269 visitor->trace(m_contentFrame); 277 visitor->trace(m_contentFrame);
270 visitor->trace(m_widget); 278 visitor->trace(m_widget);
271 HTMLElement::trace(visitor); 279 HTMLElement::trace(visitor);
272 FrameOwner::trace(visitor); 280 FrameOwner::trace(visitor);
273 } 281 }
274 282
275 283
276 } // namespace blink 284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698