| 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 Vector<Attribute> getCustomAttributes(const Element&) override; | 89 Vector<Attribute> getCustomAttributes(const Element&) override; |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate; | 92 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( | 95 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( |
| 95 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) | 96 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) |
| 96 : m_webDelegate(webDelegate) {} | 97 : m_webDelegate(webDelegate) {} |
| 97 | 98 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 154 } |
| 154 | 155 |
| 155 return false; | 156 return false; |
| 156 } | 157 } |
| 157 | 158 |
| 158 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) { | 159 bool MHTMLFrameSerializerDelegate::shouldSkipResourceWithURL(const KURL& url) { |
| 159 return m_webDelegate.shouldSkipResource(url); | 160 return m_webDelegate.shouldSkipResource(url); |
| 160 } | 161 } |
| 161 | 162 |
| 162 bool MHTMLFrameSerializerDelegate::shouldSkipResource( | 163 bool MHTMLFrameSerializerDelegate::shouldSkipResource( |
| 163 const Resource& resource) { | 164 FrameSerializer::ResourceHasCacheControlNoStoreHeader |
| 165 hasCacheControlNoStoreHeader) { |
| 164 return m_webDelegate.cacheControlPolicy() == | 166 return m_webDelegate.cacheControlPolicy() == |
| 165 WebFrameSerializerCacheControlPolicy:: | 167 WebFrameSerializerCacheControlPolicy:: |
| 166 SkipAnyFrameOrResourceMarkedNoStore && | 168 SkipAnyFrameOrResourceMarkedNoStore && |
| 167 resource.hasCacheControlNoStoreHeader(); | 169 hasCacheControlNoStoreHeader == |
| 170 FrameSerializer::HasCacheControlNoStoreHeader; |
| 168 } | 171 } |
| 169 | 172 |
| 170 Vector<Attribute> MHTMLFrameSerializerDelegate::getCustomAttributes( | 173 Vector<Attribute> MHTMLFrameSerializerDelegate::getCustomAttributes( |
| 171 const Element& element) { | 174 const Element& element) { |
| 172 Vector<Attribute> attributes; | 175 Vector<Attribute> attributes; |
| 173 | 176 |
| 174 // Disable all form elements in MTHML to tell the user that the form cannot be | 177 // Disable all form elements in MTHML to tell the user that the form cannot be |
| 175 // worked on. MHTML is loaded in full sandboxing mode which disable the form | 178 // worked on. MHTML is loaded in full sandboxing mode which disable the form |
| 176 // submission and script execution. | 179 // submission and script execution. |
| 177 if (element.isFormControlElement() && | 180 if (element.isFormControlElement() && |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 const WebString& baseTarget) { | 343 const WebString& baseTarget) { |
| 341 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. | 344 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. |
| 342 if (baseTarget.isEmpty()) | 345 if (baseTarget.isEmpty()) |
| 343 return String("<base href=\".\">"); | 346 return String("<base href=\".\">"); |
| 344 String baseString = "<base href=\".\" target=\"" + | 347 String baseString = "<base href=\".\" target=\"" + |
| 345 static_cast<const String&>(baseTarget) + "\">"; | 348 static_cast<const String&>(baseTarget) + "\">"; |
| 346 return baseString; | 349 return baseString; |
| 347 } | 350 } |
| 348 | 351 |
| 349 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |