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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 setResponse(response); 437 setResponse(response);
438 m_responseTimestamp = currentTime(); 438 m_responseTimestamp = currentTime();
439 String encoding = response.textEncodingName(); 439 String encoding = response.textEncodingName();
440 if (!encoding.isNull()) 440 if (!encoding.isNull())
441 setEncoding(encoding); 441 setEncoding(encoding);
442 442
443 if (m_loader) { 443 if (m_loader) {
444 ResourceFetcher* fetcher = ResourceFetcher::toResourceFetcher(m_loader-> host()); 444 ResourceFetcher* fetcher = ResourceFetcher::toResourceFetcher(m_loader-> host());
445 if (fetcher && fetcher->frame()) { 445 if (fetcher && fetcher->frame()) {
446 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), fet cher->frame()->document()); 446 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), fet cher->frame()->document());
447 if (RuntimeEnabledFeatures::clientHintsEnabled() && type() == Resour ce::MainResource) {
448 String acceptCH = response.httpHeaderField("accept-ch").lower();
449 // FIXME: Write an actual parser for this comma delimited header .
Mike West 2015/02/25 09:03:14 Nit: Can you add a bug ID here? When you add an a
450 if (acceptCH.contains("dpr"))
451 fetcher->frame()->setShouldSendDPRHint();
452 if (acceptCH.contains("rw"))
453 fetcher->frame()->setShouldSendRWHint();
454 }
447 } 455 }
448 } 456 }
449 457
450 if (!m_resourceToRevalidate) 458 if (!m_resourceToRevalidate)
451 return; 459 return;
452 if (response.httpStatusCode() == 304) 460 if (response.httpStatusCode() == 304)
453 revalidationSucceeded(response); 461 revalidationSucceeded(response);
454 else 462 else
455 revalidationFailed(); 463 revalidationFailed();
456 } 464 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return "ImportResource"; 1081 return "ImportResource";
1074 case Resource::Media: 1082 case Resource::Media:
1075 return "Media"; 1083 return "Media";
1076 } 1084 }
1077 ASSERT_NOT_REACHED(); 1085 ASSERT_NOT_REACHED();
1078 return "Unknown"; 1086 return "Unknown";
1079 } 1087 }
1080 #endif // !LOG_DISABLED 1088 #endif // !LOG_DISABLED
1081 1089
1082 } 1090 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698