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

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: Rebase after AcceptClientHints move 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
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 if (m_document->clientHintsPreferences().shouldSendDPR() || fetchRequest.cli entHintsPreferences().shouldSendDPR())
Mike West 2015/05/05 15:22:36 I'd suggest extracting this into a `shouldSendDPR`
620 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio()))); 620 fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicSt ring(String::number(m_document->devicePixelRatio())));
621 621
622 if (m_document->clientHintsPreferences().shouldSendRW() && frame()->view()) { 622 if ((m_document->clientHintsPreferences().shouldSendRW() || fetchRequest.cli entHintsPreferences().shouldSendRW()) && frame()->view()) {
623 FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth() ; 623 FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth() ;
624 float usedResourceWidth = resourceWidth.isSet ? resourceWidth.width : fr ame()->view()->viewportWidth(); 624 float usedResourceWidth = resourceWidth.isSet ? resourceWidth.width : fr ame()->view()->viewportWidth();
625 fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicStr ing(String::number(usedResourceWidth))); 625 fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicStr ing(String::number(usedResourceWidth)));
626 } 626 }
627 } 627 }
628 628
629 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest) 629 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest)
630 { 630 {
631 if (!m_document) 631 if (!m_document)
632 return; 632 return;
633 633
634 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); 634 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy();
635 if (csp->shouldSendCSPHeader(type)) 635 if (csp->shouldSendCSPHeader(type))
636 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" ); 636 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" );
637 } 637 }
638 638
639 DEFINE_TRACE(FrameFetchContext) 639 DEFINE_TRACE(FrameFetchContext)
640 { 640 {
641 visitor->trace(m_document); 641 visitor->trace(m_document);
642 FetchContext::trace(visitor); 642 FetchContext::trace(visitor);
643 } 643 }
644 644
645 } // namespace blink 645 } // namespace blink
OLDNEW
« Source/core/html/parser/PreloadRequest.h ('K') | « Source/core/html/parser/PreloadRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698