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