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

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

Issue 1121263002: Add Accept-CH meta http-equiv support to the preloader. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review nits Created 5 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
« no previous file with comments | « Source/core/html/parser/PreloadRequest.cpp ('k') | no next file » | 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 fetchRequest.mutableResourceRequest().setURL(url); 609 fetchRequest.mutableResourceRequest().setURL(url);
610 } 610 }
611 } 611 }
612 } 612 }
613 613
614 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) 614 void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest)
615 { 615 {
616 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document) 616 if (!RuntimeEnabledFeatures::clientHintsEnabled() || !m_document)
617 return; 617 return;
618 618
619 if (m_document->clientHintsPreferences().shouldSendDPR()) 619 bool shouldSendDPR = m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.clientHintsPreferences().shouldSendDPR();
620 bool shouldSendRW = m_document->clientHintsPreferences().shouldSendRW() || f etchRequest.clientHintsPreferences().shouldSendRW();
621
622 if (shouldSendDPR)
620 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio()))); 623 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio())));
621 624
622 if (m_document->clientHintsPreferences().shouldSendRW() && frame()->view()) { 625 if (shouldSendRW && frame()->view()) {
623 FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth() ; 626 FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth() ;
624 float usedResourceWidth = resourceWidth.isSet ? resourceWidth.width : fr ame()->view()->viewportWidth(); 627 float usedResourceWidth = resourceWidth.isSet ? resourceWidth.width : fr ame()->view()->viewportWidth();
625 fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicStr ing(String::number(usedResourceWidth))); 628 fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicStr ing(String::number(usedResourceWidth)));
626 } 629 }
627 } 630 }
628 631
629 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest) 632 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest)
630 { 633 {
631 if (!m_document) 634 if (!m_document)
632 return; 635 return;
633 636
634 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); 637 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy();
635 if (csp->shouldSendCSPHeader(type)) 638 if (csp->shouldSendCSPHeader(type))
636 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" ); 639 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" );
637 } 640 }
638 641
639 DEFINE_TRACE(FrameFetchContext) 642 DEFINE_TRACE(FrameFetchContext)
640 { 643 {
641 visitor->trace(m_document); 644 visitor->trace(m_document);
642 FetchContext::trace(visitor); 645 FetchContext::trace(visitor);
643 } 646 }
644 647
645 } // namespace blink 648 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/parser/PreloadRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698