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

Unified Diff: Source/core/fetch/Resource.cpp

Issue 951303003: Added basic client hints support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed expected files Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/core/fetch/ResourceFetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/Resource.cpp
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index 63f7bf6dc8785eadfd0a034e928c96748e26e681..e7025397a44cebfef585efe994ab88260702c160 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -444,6 +444,14 @@ void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web
ResourceFetcher* fetcher = ResourceFetcher::toResourceFetcher(m_loader->host());
if (fetcher && fetcher->frame()) {
LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), fetcher->frame()->document());
+ if (RuntimeEnabledFeatures::clientHintsEnabled() && type() == Resource::MainResource) {
+ String acceptCH = response.httpHeaderField("accept-ch").lower();
+ // FIXME: Write an actual parser for this comma delimited header. crbug.com/461741
+ if (acceptCH.contains("dpr"))
+ fetcher->frame()->setShouldSendDPRHint();
+ if (acceptCH.contains("rw"))
+ fetcher->frame()->setShouldSendRWHint();
+ }
}
}
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/core/fetch/ResourceFetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698