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

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

Issue 18808004: Refactoring: Extract DocumentInit for capture Document construction parameter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed webkit_unit_tests build failure. Created 7 years, 5 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/inspector/DOMPatchSupport.cpp ('k') | Source/core/loader/SinkDocument.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, 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 m_writer.clear(); 1049 m_writer.clear();
1050 } 1050 }
1051 1051
1052 1052
1053 PassRefPtr<DocumentWriter> DocumentLoader::createWriterFor(Frame* frame, const D ocument* ownerDocument, const KURL& url, const String& mimeType, const String& e ncoding, bool userChosen, bool dispatch) 1053 PassRefPtr<DocumentWriter> DocumentLoader::createWriterFor(Frame* frame, const D ocument* ownerDocument, const KURL& url, const String& mimeType, const String& e ncoding, bool userChosen, bool dispatch)
1054 { 1054 {
1055 // Create a new document before clearing the frame, because it may need to 1055 // Create a new document before clearing the frame, because it may need to
1056 // inherit an aliased security context. 1056 // inherit an aliased security context.
1057 RefPtr<Document> document = DOMImplementation::createDocument(mimeType, fram e, url, frame->inViewSourceMode()); 1057 RefPtr<Document> document = DOMImplementation::createDocument(mimeType, fram e, url, frame->inViewSourceMode());
1058 if (document->isPluginDocument() && document->isSandboxed(SandboxPlugins)) 1058 if (document->isPluginDocument() && document->isSandboxed(SandboxPlugins))
1059 document = SinkDocument::create(frame, url); 1059 document = SinkDocument::create(DocumentInit(url, frame));
1060 bool shouldReuseDefaultView = frame->loader()->stateMachine()->isDisplayingI nitialEmptyDocument() && frame->document()->isSecureTransitionTo(url); 1060 bool shouldReuseDefaultView = frame->loader()->stateMachine()->isDisplayingI nitialEmptyDocument() && frame->document()->isSecureTransitionTo(url);
1061 1061
1062 RefPtr<DOMWindow> originalDOMWindow; 1062 RefPtr<DOMWindow> originalDOMWindow;
1063 if (shouldReuseDefaultView) 1063 if (shouldReuseDefaultView)
1064 originalDOMWindow = frame->domWindow(); 1064 originalDOMWindow = frame->domWindow();
1065 frame->loader()->clear(!shouldReuseDefaultView, !shouldReuseDefaultView); 1065 frame->loader()->clear(!shouldReuseDefaultView, !shouldReuseDefaultView);
1066 1066
1067 if (!shouldReuseDefaultView) { 1067 if (!shouldReuseDefaultView) {
1068 frame->setDOMWindow(DOMWindow::create(frame)); 1068 frame->setDOMWindow(DOMWindow::create(frame));
1069 } else { 1069 } else {
(...skipping 29 matching lines...) Expand all
1099 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt) 1099 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt)
1100 { 1100 {
1101 m_frame->loader()->stopAllLoaders(); 1101 m_frame->loader()->stopAllLoaders();
1102 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod ingWasChosenByUser() : false, true); 1102 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod ingWasChosenByUser() : false, true);
1103 if (!source.isNull()) 1103 if (!source.isNull())
1104 m_writer->appendReplacingData(source); 1104 m_writer->appendReplacingData(source);
1105 endWriting(m_writer.get()); 1105 endWriting(m_writer.get());
1106 } 1106 }
1107 1107
1108 } // namespace WebCore 1108 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/DOMPatchSupport.cpp ('k') | Source/core/loader/SinkDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698