OLD | NEW |
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 Loading... |
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 Element&, const Attribute&) override; | 84 bool shouldIgnoreAttribute(const Element&, 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) { | 157 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) { |
158 return m_webDelegate.shouldSkipResource(url); | 158 return m_webDelegate.shouldSkipResource(url); |
159 } | 159 } |
160 | 160 |
161 bool MHTMLFrameSerializerDelegate::shouldSkipResource( | 161 bool MHTMLFrameSerializerDelegate::shouldSkipResource( |
162 const Resource& resource) { | 162 bool hasCacheControlNoStoreHeader) { |
163 return m_webDelegate.cacheControlPolicy() == | 163 return m_webDelegate.cacheControlPolicy() == |
164 WebFrameSerializerCacheControlPolicy:: | 164 WebFrameSerializerCacheControlPolicy:: |
165 SkipAnyFrameOrResourceMarkedNoStore && | 165 SkipAnyFrameOrResourceMarkedNoStore && |
166 resource.hasCacheControlNoStoreHeader(); | 166 hasCacheControlNoStoreHeader; |
167 } | 167 } |
168 | 168 |
169 bool cacheControlNoStoreHeaderPresent( | 169 bool cacheControlNoStoreHeaderPresent( |
170 const WebLocalFrameImpl& webLocalFrameImpl) { | 170 const WebLocalFrameImpl& webLocalFrameImpl) { |
171 const ResourceResponse& response = | 171 const ResourceResponse& response = |
172 webLocalFrameImpl.dataSource()->response().toResourceResponse(); | 172 webLocalFrameImpl.dataSource()->response().toResourceResponse(); |
173 if (response.cacheControlContainsNoStore()) | 173 if (response.cacheControlContainsNoStore()) |
174 return true; | 174 return true; |
175 | 175 |
176 const ResourceRequest& request = | 176 const ResourceRequest& request = |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const WebString& baseTarget) { | 323 const WebString& baseTarget) { |
324 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. | 324 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. |
325 if (baseTarget.isEmpty()) | 325 if (baseTarget.isEmpty()) |
326 return String("<base href=\".\">"); | 326 return String("<base href=\".\">"); |
327 String baseString = "<base href=\".\" target=\"" + | 327 String baseString = "<base href=\".\" target=\"" + |
328 static_cast<const String&>(baseTarget) + "\">"; | 328 static_cast<const String&>(baseTarget) + "\">"; |
329 return baseString; | 329 return baseString; |
330 } | 330 } |
331 | 331 |
332 } // namespace blink | 332 } // namespace blink |
OLD | NEW |