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

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

Issue 1738623004: Rename enums/functions that collide in chromium style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-4
Patch Set: get-names-5: rebase-and-stuff Created 4 years, 9 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 frame()->loader().applyUserAgent(request); 125 frame()->loader().applyUserAgent(request);
126 } 126 }
127 127
128 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request) 128 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request)
129 { 129 {
130 if (frame()->tree().top()->isLocalFrame()) 130 if (frame()->tree().top()->isLocalFrame())
131 request.setFirstPartyForCookies(toLocalFrame(frame()->tree().top())->doc ument()->firstPartyForCookies()); 131 request.setFirstPartyForCookies(toLocalFrame(frame()->tree().top())->doc ument()->firstPartyForCookies());
132 } 132 }
133 133
134 CachePolicy FrameFetchContext::cachePolicy() const 134 CachePolicy FrameFetchContext::getCachePolicy() const
135 { 135 {
136 if (m_document && m_document->loadEventFinished()) 136 if (m_document && m_document->loadEventFinished())
137 return CachePolicyVerify; 137 return CachePolicyVerify;
138 138
139 FrameLoadType loadType = frame()->loader().loadType(); 139 FrameLoadType loadType = frame()->loader().loadType();
140 if (loadType == FrameLoadTypeReloadFromOrigin) 140 if (loadType == FrameLoadTypeReloadFromOrigin)
141 return CachePolicyReload; 141 return CachePolicyReload;
142 142
143 Frame* parentFrame = frame()->tree().parent(); 143 Frame* parentFrame = frame()->tree().parent();
144 if (parentFrame && parentFrame->isLocalFrame()) { 144 if (parentFrame && parentFrame->isLocalFrame()) {
145 CachePolicy parentCachePolicy = toLocalFrame(parentFrame)->document()->f etcher()->context().cachePolicy(); 145 CachePolicy parentCachePolicy = toLocalFrame(parentFrame)->document()->f etcher()->context().getCachePolicy();
146 if (parentCachePolicy != CachePolicyVerify) 146 if (parentCachePolicy != CachePolicyVerify)
147 return parentCachePolicy; 147 return parentCachePolicy;
148 } 148 }
149 149
150 if (loadType == FrameLoadTypeReload) 150 if (loadType == FrameLoadTypeReload)
151 return CachePolicyRevalidate; 151 return CachePolicyRevalidate;
152 152
153 if (m_documentLoader && m_documentLoader->request().cachePolicy() == ReturnC acheDataElseLoad) 153 if (m_documentLoader && m_documentLoader->request().getCachePolicy() == Retu rnCacheDataElseLoad)
154 return CachePolicyHistoryBuffer; 154 return CachePolicyHistoryBuffer;
155 return CachePolicyVerify; 155 return CachePolicyVerify;
156 156
157 } 157 }
158 158
159 static ResourceRequestCachePolicy memoryCachePolicyToResourceRequestCachePolicy( 159 static ResourceRequestCachePolicy memoryCachePolicyToResourceRequestCachePolicy(
160 const CachePolicy policy) { 160 const CachePolicy policy) {
161 if (policy == CachePolicyVerify) 161 if (policy == CachePolicyVerify)
162 return UseProtocolCachePolicy; 162 return UseProtocolCachePolicy;
163 if (policy == CachePolicyRevalidate) 163 if (policy == CachePolicyRevalidate)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (isInDocumentWrite && disallowFetchForDocWriteScripts) 209 if (isInDocumentWrite && disallowFetchForDocWriteScripts)
210 return ReturnCacheDataDontLoad; 210 return ReturnCacheDataDontLoad;
211 } 211 }
212 212
213 if (request.isConditional()) 213 if (request.isConditional())
214 return ReloadIgnoringCacheData; 214 return ReloadIgnoringCacheData;
215 215
216 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { 216 if (m_documentLoader && m_document && !m_document->loadEventFinished()) {
217 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission. 217 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission.
218 // This policy should not be inherited by subresources. 218 // This policy should not be inherited by subresources.
219 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().cachePolicy(); 219 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().getCachePolicy();
220 if (m_documentLoader->request().httpMethod() == "POST") { 220 if (m_documentLoader->request().httpMethod() == "POST") {
221 if (mainResourceCachePolicy == ReturnCacheDataDontLoad) 221 if (mainResourceCachePolicy == ReturnCacheDataDontLoad)
222 return ReturnCacheDataElseLoad; 222 return ReturnCacheDataElseLoad;
223 return UseProtocolCachePolicy; 223 return UseProtocolCachePolicy;
224 } 224 }
225 return memoryCachePolicyToResourceRequestCachePolicy(cachePolicy()); 225 return memoryCachePolicyToResourceRequestCachePolicy(getCachePolicy());
226 } 226 }
227 return UseProtocolCachePolicy; 227 return UseProtocolCachePolicy;
228 } 228 }
229 229
230 // FIXME(http://crbug.com/274173): 230 // FIXME(http://crbug.com/274173):
231 // |loader| can be null if the resource is loaded from imported document. 231 // |loader| can be null if the resource is loaded from imported document.
232 // This means inspector, which uses DocumentLoader as an grouping entity, 232 // This means inspector, which uses DocumentLoader as an grouping entity,
233 // cannot see imported documents. 233 // cannot see imported documents.
234 inline DocumentLoader* FrameFetchContext::ensureLoaderForNotifications() const 234 inline DocumentLoader* FrameFetchContext::ensureLoaderForNotifications() const
235 { 235 {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 return; 683 return;
684 684
685 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.clientHintsPreferences().shouldSendDPR(); 685 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.clientHintsPreferences().shouldSendDPR();
686 bool shouldSendResourceWidth = m_document->clientHintsPreferences().shouldSe ndResourceWidth() || fetchRequest.clientHintsPreferences().shouldSendResourceWid th(); 686 bool shouldSendResourceWidth = m_document->clientHintsPreferences().shouldSe ndResourceWidth() || fetchRequest.clientHintsPreferences().shouldSendResourceWid th();
687 bool shouldSendViewportWidth = m_document->clientHintsPreferences().shouldSe ndViewportWidth() || fetchRequest.clientHintsPreferences().shouldSendViewportWid th(); 687 bool shouldSendViewportWidth = m_document->clientHintsPreferences().shouldSe ndViewportWidth() || fetchRequest.clientHintsPreferences().shouldSendViewportWid th();
688 688
689 if (shouldSendDPR) 689 if (shouldSendDPR)
690 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio()))); 690 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio())));
691 691
692 if (shouldSendResourceWidth) { 692 if (shouldSendResourceWidth) {
693 FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth() ; 693 FetchRequest::ResourceWidth resourceWidth = fetchRequest.getResourceWidt h();
694 if (resourceWidth.isSet) { 694 if (resourceWidth.isSet) {
695 float physicalWidth = resourceWidth.width * m_document->devicePixelR atio(); 695 float physicalWidth = resourceWidth.width * m_document->devicePixelR atio();
696 fetchRequest.mutableResourceRequest().addHTTPHeaderField("Width", At omicString(String::number(ceil(physicalWidth)))); 696 fetchRequest.mutableResourceRequest().addHTTPHeaderField("Width", At omicString(String::number(ceil(physicalWidth))));
697 } 697 }
698 } 698 }
699 699
700 if (shouldSendViewportWidth && frame()->view()) 700 if (shouldSendViewportWidth && frame()->view())
701 fetchRequest.mutableResourceRequest().addHTTPHeaderField("Viewport-Width ", AtomicString(String::number(frame()->view()->viewportWidth()))); 701 fetchRequest.mutableResourceRequest().addHTTPHeaderField("Viewport-Width ", AtomicString(String::number(frame()->view()->viewportWidth())));
702 } 702 }
703 703
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 803
804 DEFINE_TRACE(FrameFetchContext) 804 DEFINE_TRACE(FrameFetchContext)
805 { 805 {
806 visitor->trace(m_document); 806 visitor->trace(m_document);
807 visitor->trace(m_documentLoader); 807 visitor->trace(m_documentLoader);
808 FetchContext::trace(visitor); 808 FetchContext::trace(visitor);
809 } 809 }
810 810
811 } // namespace blink 811 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698