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

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

Issue 334283004: Rename DOMWindow to LocalDOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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/PageRuntimeAgent.cpp ('k') | Source/core/loader/DocumentWriter.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 26 matching lines...) Expand all
37 #include "core/fetch/MemoryCache.h" 37 #include "core/fetch/MemoryCache.h"
38 #include "core/fetch/ResourceFetcher.h" 38 #include "core/fetch/ResourceFetcher.h"
39 #include "core/fetch/ResourceLoader.h" 39 #include "core/fetch/ResourceLoader.h"
40 #include "core/html/HTMLFrameOwnerElement.h" 40 #include "core/html/HTMLFrameOwnerElement.h"
41 #include "core/html/parser/TextResourceDecoder.h" 41 #include "core/html/parser/TextResourceDecoder.h"
42 #include "core/inspector/InspectorInstrumentation.h" 42 #include "core/inspector/InspectorInstrumentation.h"
43 #include "core/loader/FrameLoader.h" 43 #include "core/loader/FrameLoader.h"
44 #include "core/loader/FrameLoaderClient.h" 44 #include "core/loader/FrameLoaderClient.h"
45 #include "core/loader/UniqueIdentifier.h" 45 #include "core/loader/UniqueIdentifier.h"
46 #include "core/loader/appcache/ApplicationCacheHost.h" 46 #include "core/loader/appcache/ApplicationCacheHost.h"
47 #include "core/frame/DOMWindow.h" 47 #include "core/frame/LocalDOMWindow.h"
48 #include "core/frame/LocalFrame.h" 48 #include "core/frame/LocalFrame.h"
49 #include "core/frame/csp/ContentSecurityPolicy.h" 49 #include "core/frame/csp/ContentSecurityPolicy.h"
50 #include "core/page/FrameTree.h" 50 #include "core/page/FrameTree.h"
51 #include "core/page/Page.h" 51 #include "core/page/Page.h"
52 #include "core/frame/Settings.h" 52 #include "core/frame/Settings.h"
53 #include "platform/Logging.h" 53 #include "platform/Logging.h"
54 #include "platform/UserGestureIndicator.h" 54 #include "platform/UserGestureIndicator.h"
55 #include "platform/mhtml/ArchiveResourceCollection.h" 55 #include "platform/mhtml/ArchiveResourceCollection.h"
56 #include "platform/mhtml/MHTMLArchive.h" 56 #include "platform/mhtml/MHTMLArchive.h"
57 #include "platform/plugins/PluginData.h" 57 #include "platform/plugins/PluginData.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 m_frame->owner()->dispatchLoad(); 313 m_frame->owner()->dispatchLoad();
314 return false; 314 return false;
315 } 315 }
316 316
317 NavigationPolicy policy = m_triggeringAction.policy(); 317 NavigationPolicy policy = m_triggeringAction.policy();
318 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p olicy); 318 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p olicy);
319 if (policy == NavigationPolicyCurrentTab) 319 if (policy == NavigationPolicyCurrentTab)
320 return true; 320 return true;
321 if (policy == NavigationPolicyIgnore) 321 if (policy == NavigationPolicyIgnore)
322 return false; 322 return false;
323 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse rGesture()) 323 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi ngUserGesture())
324 return false; 324 return false;
325 frameLoader()->client()->loadURLExternally(request, policy); 325 frameLoader()->client()->loadURLExternally(request, policy);
326 return false; 326 return false;
327 } 327 }
328 328
329 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse) 329 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse)
330 { 330 {
331 ASSERT_UNUSED(resource, resource == m_mainResource); 331 ASSERT_UNUSED(resource, resource == m_mainResource);
332 willSendRequest(request, redirectResponse); 332 willSendRequest(request, redirectResponse);
333 } 333 }
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 m_writer.clear(); 774 m_writer.clear();
775 } 775 }
776 776
777 PassRefPtrWillBeRawPtr<DocumentWriter> DocumentLoader::createWriterFor(LocalFram e* frame, const Document* ownerDocument, const KURL& url, const AtomicString& mi meType, const AtomicString& encoding, bool userChosen, bool dispatch) 777 PassRefPtrWillBeRawPtr<DocumentWriter> DocumentLoader::createWriterFor(LocalFram e* frame, const Document* ownerDocument, const KURL& url, const AtomicString& mi meType, const AtomicString& encoding, bool userChosen, bool dispatch)
778 { 778 {
779 // Create a new document before clearing the frame, because it may need to 779 // Create a new document before clearing the frame, because it may need to
780 // inherit an aliased security context. 780 // inherit an aliased security context.
781 DocumentInit init(url, frame); 781 DocumentInit init(url, frame);
782 init.withNewRegistrationContext(); 782 init.withNewRegistrationContext();
783 783
784 // In some rare cases, we'll re-used a DOMWindow for a new Document. For exa mple, 784 // In some rare cases, we'll re-used a LocalDOMWindow for a new Document. Fo r example,
785 // when a script calls window.open("..."), the browser gives JavaScript a wi ndow 785 // when a script calls window.open("..."), the browser gives JavaScript a wi ndow
786 // synchronously but kicks off the load in the window asynchronously. Web si tes 786 // synchronously but kicks off the load in the window asynchronously. Web si tes
787 // expect that modifications that they make to the window object synchronous ly 787 // expect that modifications that they make to the window object synchronous ly
788 // won't be blown away when the network load commits. To make that happen, w e 788 // won't be blown away when the network load commits. To make that happen, w e
789 // "securely transition" the existing DOMWindow to the Document that results from 789 // "securely transition" the existing LocalDOMWindow to the Document that re sults from
790 // the network load. See also SecurityContext::isSecureTransitionTo. 790 // the network load. See also SecurityContext::isSecureTransitionTo.
791 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn itialEmptyDocument() && frame->document()->isSecureTransitionTo(url); 791 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn itialEmptyDocument() && frame->document()->isSecureTransitionTo(url);
792 792
793 frame->loader().clear(); 793 frame->loader().clear();
794 794
795 if (frame->document()) 795 if (frame->document())
796 frame->document()->prepareForDestruction(); 796 frame->document()->prepareForDestruction();
797 797
798 if (!shouldReuseDefaultView) 798 if (!shouldReuseDefaultView)
799 frame->setDOMWindow(DOMWindow::create(*frame)); 799 frame->setDOMWindow(LocalDOMWindow::create(*frame));
800 800
801 RefPtrWillBeRawPtr<Document> document = frame->domWindow()->installNewDocume nt(mimeType, init); 801 RefPtrWillBeRawPtr<Document> document = frame->domWindow()->installNewDocume nt(mimeType, init);
802 if (ownerDocument) { 802 if (ownerDocument) {
803 document->setCookieURL(ownerDocument->cookieURL()); 803 document->setCookieURL(ownerDocument->cookieURL());
804 document->setSecurityOrigin(ownerDocument->securityOrigin()); 804 document->setSecurityOrigin(ownerDocument->securityOrigin());
805 } 805 }
806 806
807 frame->loader().didBeginDocument(dispatch); 807 frame->loader().didBeginDocument(dispatch);
808 808
809 return DocumentWriter::create(document.get(), mimeType, encoding, userChosen ); 809 return DocumentWriter::create(document.get(), mimeType, encoding, userChosen );
(...skipping 18 matching lines...) Expand all
828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt) 828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt)
829 { 829 {
830 m_frame->loader().stopAllLoaders(); 830 m_frame->loader().stopAllLoaders();
831 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true); 831 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true);
832 if (!source.isNull()) 832 if (!source.isNull())
833 m_writer->appendReplacingData(source); 833 m_writer->appendReplacingData(source);
834 endWriting(m_writer.get()); 834 endWriting(m_writer.get());
835 } 835 }
836 836
837 } // namespace WebCore 837 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/PageRuntimeAgent.cpp ('k') | Source/core/loader/DocumentWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698