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

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

Issue 1975753006: Pull to refresh: Use new reload type RELOAD_MAIN_RESOURCE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #14 and #16 Created 4 years, 7 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 request.setHTTPContentType(item->formContentType()); 130 request.setHTTPContentType(item->formContentType());
131 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); 131 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
132 request.addHTTPOriginIfNeeded(securityOrigin); 132 request.addHTTPOriginIfNeeded(securityOrigin);
133 } 133 }
134 return request; 134 return request;
135 } 135 }
136 136
137 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp e, 137 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp e,
138 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy) 138 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy)
139 { 139 {
140 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp eReloadBypassingCache); 140 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp eReloadMainResource || frameLoadType == FrameLoadTypeReloadBypassingCache);
141 WebCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloadBypassingCa che ? WebCachePolicy::BypassingCache : WebCachePolicy::ValidatingCacheData; 141 WebCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloadBypassingCa che ? WebCachePolicy::BypassingCache : WebCachePolicy::ValidatingCacheData;
142 if (!m_currentItem) 142 if (!m_currentItem)
143 return ResourceRequest(); 143 return ResourceRequest();
144 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get() , cachePolicy); 144 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get() , cachePolicy);
145 145
146 // ClientRedirectPolicy is an indication that this load was triggered by 146 // ClientRedirectPolicy is an indication that this load was triggered by
147 // some direct interaction with the page. If this reload is not a client 147 // some direct interaction with the page. If this reload is not a client
148 // redirect, we should reuse the referrer from the original load of the 148 // redirect, we should reuse the referrer from the original load of the
149 // current document. If this reload is a client redirect (e.g., location.rel oad()), 149 // current document. If this reload is a client redirect (e.g., location.rel oad()),
150 // it was initiated by something in the current document and should 150 // it was initiated by something in the current document and should
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 // "If the browsing context's session history contains only one Document, 796 // "If the browsing context's session history contains only one Document,
797 // and that was the about:blank Document created when the browsing context 797 // and that was the about:blank Document created when the browsing context
798 // was created, then the navigation must be done with replacement enabled. " 798 // was created, then the navigation must be done with replacement enabled. "
799 if (request.replacesCurrentItem() 799 if (request.replacesCurrentItem()
800 || (!m_stateMachine.committedMultipleRealLoads() 800 || (!m_stateMachine.committedMultipleRealLoads()
801 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) 801 && equalIgnoringCase(m_frame->document()->url(), blankURL())))
802 return FrameLoadTypeReplaceCurrentItem; 802 return FrameLoadTypeReplaceCurrentItem;
803 803
804 if (request.resourceRequest().url() == m_documentLoader->urlForHistory()) { 804 if (request.resourceRequest().url() == m_documentLoader->urlForHistory()) {
805 if (!request.originDocument()) 805 if (!request.originDocument())
806 return FrameLoadTypeSame; 806 return FrameLoadTypeReloadMainResource;
807 return request.resourceRequest().httpMethod() == HTTPNames::POST ? Frame LoadTypeStandard : FrameLoadTypeReplaceCurrentItem; 807 return request.resourceRequest().httpMethod() == HTTPNames::POST ? Frame LoadTypeStandard : FrameLoadTypeReplaceCurrentItem;
808 } 808 }
809 809
810 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory () && m_loadType == FrameLoadTypeReload) 810 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory () && m_loadType == FrameLoadTypeReload)
811 return FrameLoadTypeReload; 811 return FrameLoadTypeReload;
812 return FrameLoadTypeStandard; 812 return FrameLoadTypeStandard;
813 } 813 }
814 814
815 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) 815 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request)
816 { 816 {
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 checkCompleted(); 1274 checkCompleted();
1275 } 1275 }
1276 1276
1277 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url) 1277 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S tring& httpMethod, FrameLoadType loadType, const KURL& url)
1278 { 1278 {
1279 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, 1279 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading,
1280 // currently displaying a frameset, or if the URL does not have a fragment. 1280 // currently displaying a frameset, or if the URL does not have a fragment.
1281 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET)) 1281 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET))
1282 && loadType != FrameLoadTypeReload 1282 && loadType != FrameLoadTypeReload
1283 && loadType != FrameLoadTypeReloadBypassingCache 1283 && loadType != FrameLoadTypeReloadBypassingCache
1284 && loadType != FrameLoadTypeSame 1284 && loadType != FrameLoadTypeReloadMainResource
1285 && loadType != FrameLoadTypeBackForward 1285 && loadType != FrameLoadTypeBackForward
1286 && url.hasFragmentIdentifier() 1286 && url.hasFragmentIdentifier()
1287 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url) 1287 && equalIgnoringFragmentIdentifier(m_frame->document()->url(), url)
1288 // We don't want to just scroll if a link from within a 1288 // We don't want to just scroll if a link from within a
1289 // frameset is trying to reload the frameset into _top. 1289 // frameset is trying to reload the frameset into _top.
1290 && !m_frame->document()->isFrameSet(); 1290 && !m_frame->document()->isFrameSet();
1291 } 1291 }
1292 1292
1293 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType) 1293 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType)
1294 { 1294 {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1564 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1565 return tracedValue.release(); 1565 return tracedValue.release();
1566 } 1566 }
1567 1567
1568 inline void FrameLoader::takeObjectSnapshot() const 1568 inline void FrameLoader::takeObjectSnapshot() const
1569 { 1569 {
1570 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1570 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1571 } 1571 }
1572 1572
1573 } // namespace blink 1573 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698