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

Side by Side Diff: Source/core/loader/DocumentLoader.cpp

Issue 176763009: Have DOMWindow deal with references instead of pointers when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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/html/HTMLFormElement.cpp ('k') | Source/core/loader/FrameLoader.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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 m_frame->ownerElement()->dispatchEvent(Event::create(EventTypeNames::loa d)); 307 m_frame->ownerElement()->dispatchEvent(Event::create(EventTypeNames::loa d));
308 return false; 308 return false;
309 } 309 }
310 310
311 NavigationPolicy policy = m_triggeringAction.policy(); 311 NavigationPolicy policy = m_triggeringAction.policy();
312 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p olicy); 312 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p olicy);
313 if (policy == NavigationPolicyCurrentTab) 313 if (policy == NavigationPolicyCurrentTab)
314 return true; 314 return true;
315 if (policy == NavigationPolicyIgnore) 315 if (policy == NavigationPolicyIgnore)
316 return false; 316 return false;
317 if (!DOMWindow::allowPopUp(m_frame) && !UserGestureIndicator::processingUser Gesture()) 317 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse rGesture())
318 return false; 318 return false;
319 frameLoader()->client()->loadURLExternally(request, policy); 319 frameLoader()->client()->loadURLExternally(request, policy);
320 return false; 320 return false;
321 } 321 }
322 322
323 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse) 323 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse)
324 { 324 {
325 ASSERT_UNUSED(resource, resource == m_mainResource); 325 ASSERT_UNUSED(resource, resource == m_mainResource);
326 willSendRequest(request, redirectResponse); 326 willSendRequest(request, redirectResponse);
327 } 327 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // "securely transition" the existing DOMWindow to the Document that results from 802 // "securely transition" the existing DOMWindow to the Document that results from
803 // the network load. See also SecurityContext::isSecureTransitionTo. 803 // the network load. See also SecurityContext::isSecureTransitionTo.
804 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn itialEmptyDocument() && frame->document()->isSecureTransitionTo(url); 804 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn itialEmptyDocument() && frame->document()->isSecureTransitionTo(url);
805 805
806 frame->loader().clear(); 806 frame->loader().clear();
807 807
808 if (frame->document()) 808 if (frame->document())
809 frame->document()->prepareForDestruction(); 809 frame->document()->prepareForDestruction();
810 810
811 if (!shouldReuseDefaultView) 811 if (!shouldReuseDefaultView)
812 frame->setDOMWindow(DOMWindow::create(frame)); 812 frame->setDOMWindow(DOMWindow::create(*frame));
813 813
814 RefPtr<Document> document = frame->domWindow()->installNewDocument(mimeType, init); 814 RefPtr<Document> document = frame->domWindow()->installNewDocument(mimeType, init);
815 if (ownerDocument) { 815 if (ownerDocument) {
816 document->setCookieURL(ownerDocument->cookieURL()); 816 document->setCookieURL(ownerDocument->cookieURL());
817 document->setSecurityOrigin(ownerDocument->securityOrigin()); 817 document->setSecurityOrigin(ownerDocument->securityOrigin());
818 } 818 }
819 819
820 frame->loader().didBeginDocument(dispatch); 820 frame->loader().didBeginDocument(dispatch);
821 821
822 return DocumentWriter::create(document.get(), mimeType, encoding, userChosen ); 822 return DocumentWriter::create(document.get(), mimeType, encoding, userChosen );
(...skipping 18 matching lines...) Expand all
841 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt) 841 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt)
842 { 842 {
843 m_frame->loader().stopAllLoaders(); 843 m_frame->loader().stopAllLoaders();
844 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true); 844 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true);
845 if (!source.isNull()) 845 if (!source.isNull())
846 m_writer->appendReplacingData(source); 846 m_writer->appendReplacingData(source);
847 endWriting(m_writer.get()); 847 endWriting(m_writer.get());
848 } 848 }
849 849
850 } // namespace WebCore 850 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.cpp ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698