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

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

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: fix #include "public/web/WebDataSaverFlag.h" Created 3 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) 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 // The remaining modifications are only necessary for HTTP and HTTPS. 218 // The remaining modifications are only necessary for HTTP and HTTPS.
219 if (!request.Url().IsEmpty() && !request.Url().ProtocolIsInHTTPFamily()) 219 if (!request.Url().IsEmpty() && !request.Url().ProtocolIsInHTTPFamily())
220 return; 220 return;
221 221
222 // Reload should reflect the current data saver setting. 222 // Reload should reflect the current data saver setting.
223 if (IsReloadLoadType(MasterDocumentLoader()->LoadType())) 223 if (IsReloadLoadType(MasterDocumentLoader()->LoadType()))
224 request.ClearHTTPHeaderField("Save-Data"); 224 request.ClearHTTPHeaderField("Save-Data");
225 225
226 if (GetFrame()->GetSettings() && 226 if (GetFrame()->GetSettings() &&
227 GetFrame()->GetSettings()->GetDataSaverEnabled()) 227 GetFrame()->GetSettings()->GetDataSaverFlag() ==
228 WebDataSaverFlag::kEnabled)
228 request.SetHTTPHeaderField("Save-Data", "on"); 229 request.SetHTTPHeaderField("Save-Data", "on");
229 } 230 }
230 231
231 // TODO(toyoshim, arthursonzogni): PlzNavigate doesn't use this function to set 232 // TODO(toyoshim, arthursonzogni): PlzNavigate doesn't use this function to set
232 // the ResourceRequest's cache policy. The cache policy determination needs to 233 // the ResourceRequest's cache policy. The cache policy determination needs to
233 // be factored out from FrameFetchContext and moved to the FrameLoader for 234 // be factored out from FrameFetchContext and moved to the FrameLoader for
234 // instance. 235 // instance.
235 WebCachePolicy FrameFetchContext::ResourceRequestCachePolicy( 236 WebCachePolicy FrameFetchContext::ResourceRequestCachePolicy(
236 const ResourceRequest& request, 237 const ResourceRequest& request,
237 Resource::Type type, 238 Resource::Type type,
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() { 780 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() {
780 return Platform::Current()->CreateURLLoader(); 781 return Platform::Current()->CreateURLLoader();
781 } 782 }
782 783
783 DEFINE_TRACE(FrameFetchContext) { 784 DEFINE_TRACE(FrameFetchContext) {
784 visitor->Trace(document_loader_); 785 visitor->Trace(document_loader_);
785 BaseFetchContext::Trace(visitor); 786 BaseFetchContext::Trace(visitor);
786 } 787 }
787 788
788 } // namespace blink 789 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698