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

Side by Side Diff: Source/core/page/CreateWindow.cpp

Issue 799923006: Make canNavigate() OOPI-friendly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check in History.cpp Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | 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, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "platform/weborigin/SecurityOrigin.h" 43 #include "platform/weborigin/SecurityOrigin.h"
44 #include "platform/weborigin/SecurityPolicy.h" 44 #include "platform/weborigin/SecurityPolicy.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame , const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol icy policy, ShouldSendReferrer shouldSendReferrer, bool& created) 48 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame , const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol icy policy, ShouldSendReferrer shouldSendReferrer, bool& created)
49 { 49 {
50 ASSERT(!features.dialog || request.frameName().isEmpty()); 50 ASSERT(!features.dialog || request.frameName().isEmpty());
51 51
52 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol icy == NavigationPolicyIgnore) { 52 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol icy == NavigationPolicyIgnore) {
53 if (LocalFrame* frame = lookupFrame.loader().findFrameForNavigation(requ est.frameName(), openerFrame.document())) { 53 if (Frame* frame = lookupFrame.findFrameForNavigation(request.frameName( ), openerFrame)) {
54 if (request.frameName() != "_self") { 54 if (request.frameName() != "_self") {
55 if (FrameHost* host = frame->host()) { 55 if (FrameHost* host = frame->host()) {
56 if (host == openerFrame.host()) 56 if (host == openerFrame.host())
57 frame->page()->focusController().setFocusedFrame(frame); 57 frame->page()->focusController().setFocusedFrame(frame);
58 else 58 else
59 host->chrome().focus(); 59 host->chrome().focus();
60 } 60 }
61 } 61 }
62 created = false; 62 created = false;
63 return frame; 63 // FIXME: Make this work with RemoteFrames.
64 return frame->isLocalFrame() ? toLocalFrame(frame) : nullptr;
64 } 65 }
65 } 66 }
66 67
67 // Sandboxed frames cannot open new auxiliary browsing contexts. 68 // Sandboxed frames cannot open new auxiliary browsing contexts.
68 if (openerFrame.document()->isSandboxed(SandboxPopups)) { 69 if (openerFrame.document()->isSandboxed(SandboxPopups)) {
69 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. 70 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
70 openerFrame.document()->addConsoleMessage(ConsoleMessage::create(Securit yMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest ().url().elidedString() + "' in a new window because the request was made in a s andboxed frame whose 'allow-popups' permission is not set.")); 71 openerFrame.document()->addConsoleMessage(ConsoleMessage::create(Securit yMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest ().url().elidedString() + "' in a new window because the request was made in a s andboxed frame whose 'allow-popups' permission is not set."));
71 return nullptr; 72 return nullptr;
72 } 73 }
73 74
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (shouldSendReferrer == MaybeSendReferrer) { 191 if (shouldSendReferrer == MaybeSendReferrer) {
191 newFrame->loader().setOpener(&openerFrame); 192 newFrame->loader().setOpener(&openerFrame);
192 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 193 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
193 } 194 }
194 FrameLoadRequest newRequest(0, request.resourceRequest()); 195 FrameLoadRequest newRequest(0, request.resourceRequest());
195 newRequest.setFormState(request.formState()); 196 newRequest.setFormState(request.formState());
196 newFrame->loader().load(newRequest); 197 newFrame->loader().load(newRequest);
197 } 198 }
198 199
199 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698