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

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

Issue 2130623003: Teach HistoryItem about a request's initiator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: String, not RefPtr, because lifetimes... Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload 117 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload
118 || type == FrameLoadTypeReloadBypassingCache; 118 || type == FrameLoadTypeReloadBypassingCache;
119 } 119 }
120 120
121 // static 121 // static
122 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, W ebCachePolicy cachePolicy) 122 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, W ebCachePolicy cachePolicy)
123 { 123 {
124 RefPtr<EncodedFormData> formData = item->formData(); 124 RefPtr<EncodedFormData> formData = item->formData();
125 ResourceRequest request(item->url()); 125 ResourceRequest request(item->url());
126 request.setHTTPReferrer(item->referrer()); 126 request.setHTTPReferrer(item->referrer());
127 request.setRequestorOrigin(item->requestorOrigin());
127 request.setCachePolicy(cachePolicy); 128 request.setCachePolicy(cachePolicy);
128 if (formData) { 129 if (formData) {
129 request.setHTTPMethod(HTTPNames::POST); 130 request.setHTTPMethod(HTTPNames::POST);
130 request.setHTTPBody(formData); 131 request.setHTTPBody(formData);
131 request.setHTTPContentType(item->formContentType()); 132 request.setHTTPContentType(item->formContentType());
132 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); 133 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
133 request.addHTTPOriginIfNeeded(securityOrigin); 134 request.addHTTPOriginIfNeeded(securityOrigin);
134 } 135 }
135 return request; 136 return request;
136 } 137 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 { 368 {
368 HistoryItem* oldItem = m_currentItem; 369 HistoryItem* oldItem = m_currentItem;
369 if (historyCommitType == BackForwardCommit && m_provisionalItem) 370 if (historyCommitType == BackForwardCommit && m_provisionalItem)
370 m_currentItem = m_provisionalItem.release(); 371 m_currentItem = m_provisionalItem.release();
371 else 372 else
372 m_currentItem = HistoryItem::create(); 373 m_currentItem = HistoryItem::create();
373 m_currentItem->setURL(m_documentLoader->urlForHistory()); 374 m_currentItem->setURL(m_documentLoader->urlForHistory());
374 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); 375 m_currentItem->setDocumentState(m_frame->document()->formElementsState());
375 m_currentItem->setTarget(m_frame->tree().uniqueName()); 376 m_currentItem->setTarget(m_frame->tree().uniqueName());
376 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().getReferrerPolicy(), m_currentItem->url(), m_documentLoader->request ().httpReferrer())); 377 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().getReferrerPolicy(), m_currentItem->url(), m_documentLoader->request ().httpReferrer()));
378 m_currentItem->setRequestorOrigin(m_documentLoader->request().requestorOrigi n());
377 m_currentItem->setFormInfoFromRequest(m_documentLoader->request()); 379 m_currentItem->setFormInfoFromRequest(m_documentLoader->request());
378 380
379 // Don't propagate state from the old item to the new item if there isn't an old item (obviously), 381 // Don't propagate state from the old item to the new item if there isn't an old item (obviously),
380 // or if this is a back/forward navigation, since we explicitly want to rest ore the state we just 382 // or if this is a back/forward navigation, since we explicitly want to rest ore the state we just
381 // committed. 383 // committed.
382 if (!oldItem || historyCommitType == BackForwardCommit) 384 if (!oldItem || historyCommitType == BackForwardCommit)
383 return; 385 return;
384 // Don't propagate state from the old item if this is a different-document n avigation, unless the before 386 // Don't propagate state from the old item if this is a different-document n avigation, unless the before
385 // and after pages are logically related. This means they have the same url (ignoring fragment) and 387 // and after pages are logically related. This means they have the same url (ignoring fragment) and
386 // the new item was loaded via reload or client redirect. 388 // the new item was loaded via reload or client redirect.
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1616 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1615 return tracedValue; 1617 return tracedValue;
1616 } 1618 }
1617 1619
1618 inline void FrameLoader::takeObjectSnapshot() const 1620 inline void FrameLoader::takeObjectSnapshot() const
1619 { 1621 {
1620 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1622 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1621 } 1623 }
1622 1624
1623 } // namespace blink 1625 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698