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

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

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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/page/Chrome.cpp ('k') | Source/core/page/EventHandler.cpp » ('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, 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // Sandboxed frames cannot open new auxiliary browsing contexts. 60 // Sandboxed frames cannot open new auxiliary browsing contexts.
61 if (openerFrame->document()->isSandboxed(SandboxPopups)) { 61 if (openerFrame->document()->isSandboxed(SandboxPopups)) {
62 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. 62 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
63 openerFrame->document()->addConsoleMessage(SecurityMessageSource, ErrorM essageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString( ) + "' in a new window because the request was made in a sandboxed frame whose ' allow-popups' permission is not set."); 63 openerFrame->document()->addConsoleMessage(SecurityMessageSource, ErrorM essageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString( ) + "' in a new window because the request was made in a sandboxed frame whose ' allow-popups' permission is not set.");
64 return 0; 64 return 0;
65 } 65 }
66 66
67 if (openerFrame->settings() && !openerFrame->settings()->supportsMultipleWin dows()) { 67 if (openerFrame->settings() && !openerFrame->settings()->supportsMultipleWin dows()) {
68 created = false; 68 created = false;
69 return openerFrame->tree()->top(); 69 return openerFrame->tree().top();
70 } 70 }
71 71
72 Page* oldPage = openerFrame->page(); 72 Page* oldPage = openerFrame->page();
73 if (!oldPage) 73 if (!oldPage)
74 return 0; 74 return 0;
75 75
76 Page* page = oldPage->chrome().client().createWindow(openerFrame, request, f eatures); 76 Page* page = oldPage->chrome().client().createWindow(openerFrame, request, f eatures);
77 if (!page) 77 if (!page)
78 return 0; 78 return 0;
79 79
80 Frame* frame = page->mainFrame(); 80 Frame* frame = page->mainFrame();
81 81
82 frame->loader()->forceSandboxFlags(openerFrame->document()->sandboxFlags()); 82 frame->loader()->forceSandboxFlags(openerFrame->document()->sandboxFlags());
83 83
84 if (request.frameName() != "_blank") 84 if (request.frameName() != "_blank")
85 frame->tree()->setName(request.frameName()); 85 frame->tree().setName(request.frameName());
86 86
87 page->chrome().setWindowFeatures(features); 87 page->chrome().setWindowFeatures(features);
88 88
89 // 'x' and 'y' specify the location of the window, while 'width' and 'height ' 89 // 'x' and 'y' specify the location of the window, while 'width' and 'height '
90 // specify the size of the viewport. We can only resize the window, so adjus t 90 // specify the size of the viewport. We can only resize the window, so adjus t
91 // for the difference between the window size and the viewport size. 91 // for the difference between the window size and the viewport size.
92 92
93 FloatRect windowRect = page->chrome().windowRect(); 93 FloatRect windowRect = page->chrome().windowRect();
94 FloatSize viewportSize = page->chrome().pageRect().size(); 94 FloatSize viewportSize = page->chrome().pageRect().size();
95 95
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (created) { 150 if (created) {
151 FrameLoadRequest request(activeWindow->document()->securityOrigin(), Res ourceRequest(completedURL, referrer)); 151 FrameLoadRequest request(activeWindow->document()->securityOrigin(), Res ourceRequest(completedURL, referrer));
152 newFrame->loader()->load(request); 152 newFrame->loader()->load(request);
153 } else if (!urlString.isEmpty()) { 153 } else if (!urlString.isEmpty()) {
154 newFrame->navigationScheduler()->scheduleLocationChange(activeWindow->do cument()->securityOrigin(), completedURL.string(), referrer, false); 154 newFrame->navigationScheduler()->scheduleLocationChange(activeWindow->do cument()->securityOrigin(), completedURL.string(), referrer, false);
155 } 155 }
156 return newFrame; 156 return newFrame;
157 } 157 }
158 158
159 } // namespace WebCore 159 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Chrome.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698