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

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

Issue 2781723007: Plumb initiator out of Blink. (Closed)
Patch Set: Created 3 years, 8 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // browsing context was created. 96 // browsing context was created.
97 // 97 //
98 // Note: We generalize this to all "blank" URLs and invalid URLs because we 98 // Note: We generalize this to all "blank" URLs and invalid URLs because we
99 // treat all of these URLs as about:blank. 99 // treat all of these URLs as about:blank.
100 return url.isEmpty() || url.protocolIsAbout(); 100 return url.isEmpty() || url.protocolIsAbout();
101 } 101 }
102 102
103 DocumentLoader::DocumentLoader(LocalFrame* frame, 103 DocumentLoader::DocumentLoader(LocalFrame* frame,
104 const ResourceRequest& req, 104 const ResourceRequest& req,
105 const SubstituteData& substituteData, 105 const SubstituteData& substituteData,
106 ClientRedirectPolicy clientRedirectPolicy) 106 ClientRedirectPolicy clientRedirectPolicy,
107 Document* originDocument)
107 : m_frame(frame), 108 : m_frame(frame),
108 m_fetcher(FrameFetchContext::createFetcherFromDocumentLoader(this)), 109 m_fetcher(FrameFetchContext::createFetcherFromDocumentLoader(this)),
110 m_originDocument(originDocument),
109 m_originalRequest(req), 111 m_originalRequest(req),
110 m_substituteData(substituteData), 112 m_substituteData(substituteData),
111 m_request(req), 113 m_request(req),
112 m_loadType(FrameLoadTypeStandard), 114 m_loadType(FrameLoadTypeStandard),
113 m_isClientRedirect(clientRedirectPolicy == 115 m_isClientRedirect(clientRedirectPolicy ==
114 ClientRedirectPolicy::ClientRedirect), 116 ClientRedirectPolicy::ClientRedirect),
115 m_replacesCurrentHistoryItem(false), 117 m_replacesCurrentHistoryItem(false),
116 m_dataReceived(false), 118 m_dataReceived(false),
117 m_navigationType(NavigationTypeOther), 119 m_navigationType(NavigationTypeOther),
118 m_documentLoadTiming(*this), 120 m_documentLoadTiming(*this),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DCHECK(!m_mainResource); 153 DCHECK(!m_mainResource);
152 DCHECK(!m_applicationCacheHost); 154 DCHECK(!m_applicationCacheHost);
153 DCHECK_EQ(m_state, SentDidFinishLoad); 155 DCHECK_EQ(m_state, SentDidFinishLoad);
154 } 156 }
155 157
156 DEFINE_TRACE(DocumentLoader) { 158 DEFINE_TRACE(DocumentLoader) {
157 visitor->trace(m_frame); 159 visitor->trace(m_frame);
158 visitor->trace(m_fetcher); 160 visitor->trace(m_fetcher);
159 visitor->trace(m_mainResource); 161 visitor->trace(m_mainResource);
160 visitor->trace(m_writer); 162 visitor->trace(m_writer);
163 visitor->trace(m_originDocument);
161 visitor->trace(m_subresourceFilter); 164 visitor->trace(m_subresourceFilter);
162 visitor->trace(m_documentLoadTiming); 165 visitor->trace(m_documentLoadTiming);
163 visitor->trace(m_applicationCacheHost); 166 visitor->trace(m_applicationCacheHost);
164 visitor->trace(m_contentSecurityPolicy); 167 visitor->trace(m_contentSecurityPolicy);
165 RawResourceClient::trace(visitor); 168 RawResourceClient::trace(visitor);
166 } 169 }
167 170
168 unsigned long DocumentLoader::mainResourceIdentifier() const { 171 unsigned long DocumentLoader::mainResourceIdentifier() const {
169 return m_mainResource ? m_mainResource->identifier() : 0; 172 return m_mainResource ? m_mainResource->identifier() : 0;
170 } 173 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // origin, then block the redirect. 382 // origin, then block the redirect.
380 const KURL& requestURL = m_request.url(); 383 const KURL& requestURL = m_request.url();
381 RefPtr<SecurityOrigin> redirectingOrigin = 384 RefPtr<SecurityOrigin> redirectingOrigin =
382 SecurityOrigin::create(redirectResponse.url()); 385 SecurityOrigin::create(redirectResponse.url());
383 if (!redirectingOrigin->canDisplay(requestURL)) { 386 if (!redirectingOrigin->canDisplay(requestURL)) {
384 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); 387 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString());
385 m_fetcher->stopFetching(); 388 m_fetcher->stopFetching();
386 return false; 389 return false;
387 } 390 }
388 if (frameLoader().shouldContinueForNavigationPolicy( 391 if (frameLoader().shouldContinueForNavigationPolicy(
389 m_request, SubstituteData(), this, CheckContentSecurityPolicy, 392 m_originDocument.get(), m_request, SubstituteData(), this,
390 m_navigationType, NavigationPolicyCurrentTab, m_loadType, 393 CheckContentSecurityPolicy, m_navigationType,
391 isClientRedirect(), nullptr) != NavigationPolicyCurrentTab) { 394 NavigationPolicyCurrentTab, m_loadType, isClientRedirect(),
395 nullptr) != NavigationPolicyCurrentTab) {
392 m_fetcher->stopFetching(); 396 m_fetcher->stopFetching();
393 return false; 397 return false;
394 } 398 }
395 399
396 DCHECK(timing().fetchStart()); 400 DCHECK(timing().fetchStart());
397 appendRedirect(requestURL); 401 appendRedirect(requestURL);
398 timing().addRedirect(redirectResponse.url(), requestURL); 402 timing().addRedirect(redirectResponse.url(), requestURL);
399 403
400 // If a redirection happens during a back/forward navigation, don't restore 404 // If a redirection happens during a back/forward navigation, don't restore
401 // any state from the old HistoryItem. There is a provisional history item for 405 // any state from the old HistoryItem. There is a provisional history item for
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 InstallNewDocumentReason::kJavascriptURL, 948 InstallNewDocumentReason::kJavascriptURL,
945 ForceSynchronousParsing, KURL()); 949 ForceSynchronousParsing, KURL());
946 if (!source.isNull()) 950 if (!source.isNull())
947 m_writer->appendReplacingData(source); 951 m_writer->appendReplacingData(source);
948 endWriting(); 952 endWriting();
949 } 953 }
950 954
951 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 955 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
952 956
953 } // namespace blink 957 } // 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