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: third_party/WebKit/Source/core/html/LinkStyle.cpp

Issue 2780533002: Use Referrer-Policy headers for CSS stylesheets (Closed)
Patch Set: updates Created 3 years, 8 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/LinkStyle.h" 5 #include "core/html/LinkStyle.h"
6 6
7 #include "core/css/StyleSheetContents.h" 7 #include "core/css/StyleSheetContents.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/LocalFrameClient.h" 9 #include "core/frame/LocalFrameClient.h"
10 #include "core/frame/SubresourceIntegrity.h" 10 #include "core/frame/SubresourceIntegrity.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 enum StyleSheetCacheStatus { 48 enum StyleSheetCacheStatus {
49 StyleSheetNewEntry, 49 StyleSheetNewEntry,
50 StyleSheetInDiskCache, 50 StyleSheetInDiskCache,
51 StyleSheetInMemoryCache, 51 StyleSheetInMemoryCache,
52 StyleSheetCacheStatusCount, 52 StyleSheetCacheStatusCount,
53 }; 53 };
54 54
55 void LinkStyle::setCSSStyleSheet( 55 void LinkStyle::setCSSStyleSheet(
56 const String& href, 56 const String& href,
57 const KURL& baseURL, 57 const KURL& baseURL,
58 ReferrerPolicy referrerPolicy,
58 const String& charset, 59 const String& charset,
59 const CSSStyleSheetResource* cachedStyleSheet) { 60 const CSSStyleSheetResource* cachedStyleSheet) {
60 if (!m_owner->isConnected()) { 61 if (!m_owner->isConnected()) {
61 // While the stylesheet is asynchronously loading, the owner can be 62 // While the stylesheet is asynchronously loading, the owner can be
62 // disconnected from a document. 63 // disconnected from a document.
63 // In that case, cancel any processing on the loaded content. 64 // In that case, cancel any processing on the loaded content.
64 m_loading = false; 65 m_loading = false;
65 removePendingSheet(); 66 removePendingSheet();
66 if (m_sheet) 67 if (m_sheet)
67 clearSheet(); 68 clearSheet();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (disposition == ResourceIntegrityDisposition::Failed) { 104 if (disposition == ResourceIntegrityDisposition::Failed) {
104 m_loading = false; 105 m_loading = false;
105 removePendingSheet(); 106 removePendingSheet();
106 notifyLoadedSheetAndAllCriticalSubresources( 107 notifyLoadedSheetAndAllCriticalSubresources(
107 Node::ErrorOccurredLoadingSubresource); 108 Node::ErrorOccurredLoadingSubresource);
108 return; 109 return;
109 } 110 }
110 } 111 }
111 112
112 CSSParserContext* parserContext = CSSParserContext::create( 113 CSSParserContext* parserContext = CSSParserContext::create(
113 m_owner->document(), baseURL, m_owner->document().getReferrerPolicy(), 114 m_owner->document(), baseURL, referrerPolicy, charset);
114 charset);
115 115
116 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheetHistogram, 116 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheetHistogram,
117 ("Blink.RestoredCachedStyleSheet", 2)); 117 ("Blink.RestoredCachedStyleSheet", 2));
118 DEFINE_STATIC_LOCAL( 118 DEFINE_STATIC_LOCAL(
119 EnumerationHistogram, restoredCachedStyleSheet2Histogram, 119 EnumerationHistogram, restoredCachedStyleSheet2Histogram,
120 ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount)); 120 ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount));
121 121
122 if (StyleSheetContents* restoredSheet = 122 if (StyleSheetContents* restoredSheet =
123 const_cast<CSSStyleSheetResource*>(cachedStyleSheet) 123 const_cast<CSSStyleSheetResource*>(cachedStyleSheet)
124 ->restoreParsedStyleSheet(parserContext)) { 124 ->restoreParsedStyleSheet(parserContext)) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 removePendingSheet(); 418 removePendingSheet();
419 } 419 }
420 420
421 DEFINE_TRACE(LinkStyle) { 421 DEFINE_TRACE(LinkStyle) {
422 visitor->trace(m_sheet); 422 visitor->trace(m_sheet);
423 LinkResource::trace(visitor); 423 LinkResource::trace(visitor);
424 ResourceOwner<StyleSheetResource>::trace(visitor); 424 ResourceOwner<StyleSheetResource>::trace(visitor);
425 } 425 }
426 426
427 } // namespace blink 427 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/LinkStyle.h ('k') | third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698