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

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

Issue 2416523002: Expose the initiating origin/URL of a navigation in the Blink public API (Closed)
Patch Set: rebase Created 4 years 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
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // browsing context was created. 90 // browsing context was created.
91 // 91 //
92 // Note: We generalize this to all "blank" URLs and invalid URLs because we 92 // Note: We generalize this to all "blank" URLs and invalid URLs because we
93 // treat all of these URLs as about:blank. 93 // treat all of these URLs as about:blank.
94 return url.isEmpty() || url.protocolIsAbout(); 94 return url.isEmpty() || url.protocolIsAbout();
95 } 95 }
96 96
97 DocumentLoader::DocumentLoader(LocalFrame* frame, 97 DocumentLoader::DocumentLoader(LocalFrame* frame,
98 const ResourceRequest& req, 98 const ResourceRequest& req,
99 const SubstituteData& substituteData, 99 const SubstituteData& substituteData,
100 ClientRedirectPolicy clientRedirectPolicy) 100 ClientRedirectPolicy clientRedirectPolicy,
101 Document* requestorDocument)
101 : m_frame(frame), 102 : m_frame(frame),
102 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)), 103 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)),
104 m_requestorDocument(requestorDocument),
103 m_originalRequest(req), 105 m_originalRequest(req),
104 m_substituteData(substituteData), 106 m_substituteData(substituteData),
105 m_request(req), 107 m_request(req),
106 m_isClientRedirect(clientRedirectPolicy == 108 m_isClientRedirect(clientRedirectPolicy ==
107 ClientRedirectPolicy::ClientRedirect), 109 ClientRedirectPolicy::ClientRedirect),
108 m_replacesCurrentHistoryItem(false), 110 m_replacesCurrentHistoryItem(false),
109 m_dataReceived(false), 111 m_dataReceived(false),
110 m_navigationType(NavigationTypeOther), 112 m_navigationType(NavigationTypeOther),
111 m_documentLoadTiming(*this), 113 m_documentLoadTiming(*this),
112 m_timeOfLastDataReceived(0.0), 114 m_timeOfLastDataReceived(0.0),
(...skipping 18 matching lines...) Expand all
131 DCHECK(!m_frame); 133 DCHECK(!m_frame);
132 DCHECK(!m_mainResource); 134 DCHECK(!m_mainResource);
133 DCHECK(!m_applicationCacheHost); 135 DCHECK(!m_applicationCacheHost);
134 } 136 }
135 137
136 DEFINE_TRACE(DocumentLoader) { 138 DEFINE_TRACE(DocumentLoader) {
137 visitor->trace(m_frame); 139 visitor->trace(m_frame);
138 visitor->trace(m_fetcher); 140 visitor->trace(m_fetcher);
139 visitor->trace(m_mainResource); 141 visitor->trace(m_mainResource);
140 visitor->trace(m_writer); 142 visitor->trace(m_writer);
143 visitor->trace(m_requestorDocument);
141 visitor->trace(m_documentLoadTiming); 144 visitor->trace(m_documentLoadTiming);
142 visitor->trace(m_applicationCacheHost); 145 visitor->trace(m_applicationCacheHost);
143 visitor->trace(m_contentSecurityPolicy); 146 visitor->trace(m_contentSecurityPolicy);
144 RawResourceClient::trace(visitor); 147 RawResourceClient::trace(visitor);
145 } 148 }
146 149
147 unsigned long DocumentLoader::mainResourceIdentifier() const { 150 unsigned long DocumentLoader::mainResourceIdentifier() const {
148 return m_mainResource ? m_mainResource->identifier() : 0; 151 return m_mainResource ? m_mainResource->identifier() : 0;
149 } 152 }
150 153
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this); 638 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this);
636 clearMainResourceHandle(); 639 clearMainResourceHandle();
637 m_frame = nullptr; 640 m_frame = nullptr;
638 } 641 }
639 642
640 void DocumentLoader::clearMainResourceHandle() { 643 void DocumentLoader::clearMainResourceHandle() {
641 if (!m_mainResource) 644 if (!m_mainResource)
642 return; 645 return;
643 m_mainResource->removeClient(this); 646 m_mainResource->removeClient(this);
644 m_mainResource = nullptr; 647 m_mainResource = nullptr;
648
649 // TODO(dcheng): This doesn't really belong here.
650 m_requestorDocument = nullptr;
645 } 651 }
646 652
647 bool DocumentLoader::maybeCreateArchive() { 653 bool DocumentLoader::maybeCreateArchive() {
648 // Give the archive machinery a crack at this document. If the MIME type is 654 // Give the archive machinery a crack at this document. If the MIME type is
649 // not an archive type, it will return 0. 655 // not an archive type, it will return 0.
650 if (!isArchiveMIMEType(m_response.mimeType())) 656 if (!isArchiveMIMEType(m_response.mimeType()))
651 return false; 657 return false;
652 658
653 DCHECK(m_mainResource); 659 DCHECK(m_mainResource);
654 ArchiveResource* mainResource = 660 ArchiveResource* mainResource =
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 m_writer ? m_writer->encoding() : emptyAtom, true, 799 m_writer ? m_writer->encoding() : emptyAtom, true,
794 ForceSynchronousParsing); 800 ForceSynchronousParsing);
795 if (!source.isNull()) 801 if (!source.isNull())
796 m_writer->appendReplacingData(source); 802 m_writer->appendReplacingData(source);
797 endWriting(); 803 endWriting();
798 } 804 }
799 805
800 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 806 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
801 807
802 } // namespace blink 808 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698