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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 2469873002: [ImageResource 4] Split ImageResource into Resource and Image parts (Closed)
Patch Set: comments Created 4 years 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate { 78 class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate {
79 WTF_MAKE_NONCOPYABLE(MHTMLFrameSerializerDelegate); 79 WTF_MAKE_NONCOPYABLE(MHTMLFrameSerializerDelegate);
80 80
81 public: 81 public:
82 explicit MHTMLFrameSerializerDelegate( 82 explicit MHTMLFrameSerializerDelegate(
83 WebFrameSerializer::MHTMLPartsGenerationDelegate&); 83 WebFrameSerializer::MHTMLPartsGenerationDelegate&);
84 bool shouldIgnoreAttribute(const Attribute&) override; 84 bool shouldIgnoreAttribute(const Attribute&) override;
85 bool rewriteLink(const Element&, String& rewrittenLink) override; 85 bool rewriteLink(const Element&, String& rewrittenLink) override;
86 bool shouldSkipResourceWithURL(const KURL&) override; 86 bool shouldSkipResourceWithURL(const KURL&) override;
87 bool shouldSkipResource(const Resource&) override; 87 bool shouldSkipResource(bool hasCacheControlNoStoreHeader) override;
88 88
89 private: 89 private:
90 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate; 90 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate;
91 }; 91 };
92 92
93 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( 93 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate(
94 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) 94 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate)
95 : m_webDelegate(webDelegate) {} 95 : m_webDelegate(webDelegate) {}
96 96
97 bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute( 97 bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 return false; 139 return false;
140 } 140 }
141 141
142 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) { 142 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) {
143 return m_webDelegate.shouldSkipResource(url); 143 return m_webDelegate.shouldSkipResource(url);
144 } 144 }
145 145
146 bool MHTMLFrameSerializerDelegate::shouldSkipResource( 146 bool MHTMLFrameSerializerDelegate::shouldSkipResource(
147 const Resource& resource) { 147 bool hasCacheControlNoStoreHeader) {
148 return m_webDelegate.cacheControlPolicy() == 148 return m_webDelegate.cacheControlPolicy() ==
149 WebFrameSerializerCacheControlPolicy:: 149 WebFrameSerializerCacheControlPolicy::
150 SkipAnyFrameOrResourceMarkedNoStore && 150 SkipAnyFrameOrResourceMarkedNoStore &&
151 resource.hasCacheControlNoStoreHeader(); 151 hasCacheControlNoStoreHeader;
152 } 152 }
153 153
154 bool cacheControlNoStoreHeaderPresent( 154 bool cacheControlNoStoreHeaderPresent(
155 const WebLocalFrameImpl& webLocalFrameImpl) { 155 const WebLocalFrameImpl& webLocalFrameImpl) {
156 const ResourceResponse& response = 156 const ResourceResponse& response =
157 webLocalFrameImpl.dataSource()->response().toResourceResponse(); 157 webLocalFrameImpl.dataSource()->response().toResourceResponse();
158 if (response.cacheControlContainsNoStore()) 158 if (response.cacheControlContainsNoStore())
159 return true; 159 return true;
160 160
161 const ResourceRequest& request = 161 const ResourceRequest& request =
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 const WebString& baseTarget) { 308 const WebString& baseTarget) {
309 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. 309 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|.
310 if (baseTarget.isEmpty()) 310 if (baseTarget.isEmpty())
311 return String("<base href=\".\">"); 311 return String("<base href=\".\">");
312 String baseString = "<base href=\".\" target=\"" + 312 String baseString = "<base href=\".\" target=\"" +
313 static_cast<const String&>(baseTarget) + "\">"; 313 static_cast<const String&>(baseTarget) + "\">";
314 return baseString; 314 return baseString;
315 } 315 }
316 316
317 } // namespace blink 317 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698