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

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

Issue 2769033004: Should reset "Save-Data" header on all kinds of reloads (Closed)
Patch Set: test Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 if (m_document) { 369 if (m_document) {
370 request.setExternalRequestStateFromRequestorAddressSpace( 370 request.setExternalRequestStateFromRequestorAddressSpace(
371 m_document->addressSpace()); 371 m_document->addressSpace());
372 } 372 }
373 373
374 // The remaining modifications are only necessary for HTTP and HTTPS. 374 // The remaining modifications are only necessary for HTTP and HTTPS.
375 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) 375 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily())
376 return; 376 return;
377 377
378 if (masterDocumentLoader()->loadType() == FrameLoadTypeReload) 378 // Reload should reflect the current data saver setting.
379 if (isReloadLoadType(masterDocumentLoader()->loadType()))
379 request.clearHTTPHeaderField("Save-Data"); 380 request.clearHTTPHeaderField("Save-Data");
380 381
381 if (frame()->settings() && frame()->settings()->getDataSaverEnabled()) 382 if (frame()->settings() && frame()->settings()->getDataSaverEnabled())
382 request.setHTTPHeaderField("Save-Data", "on"); 383 request.setHTTPHeaderField("Save-Data", "on");
383 } 384 }
384 385
385 WebCachePolicy FrameFetchContext::resourceRequestCachePolicy( 386 WebCachePolicy FrameFetchContext::resourceRequestCachePolicy(
386 ResourceRequest& request, 387 ResourceRequest& request,
387 Resource::Type type, 388 Resource::Type type,
388 FetchRequest::DeferOption defer) const { 389 FetchRequest::DeferOption defer) const {
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 response); 1081 response);
1081 } 1082 }
1082 1083
1083 DEFINE_TRACE(FrameFetchContext) { 1084 DEFINE_TRACE(FrameFetchContext) {
1084 visitor->trace(m_document); 1085 visitor->trace(m_document);
1085 visitor->trace(m_documentLoader); 1086 visitor->trace(m_documentLoader);
1086 FetchContext::trace(visitor); 1087 FetchContext::trace(visitor);
1087 } 1088 }
1088 1089
1089 } // namespace blink 1090 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698