| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef PageSerializer_h | 31 #ifndef FrameSerializer_h |
| 32 #define PageSerializer_h | 32 #define FrameSerializer_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 36 #include "platform/weborigin/KURL.h" | 36 #include "platform/weborigin/KURL.h" |
| 37 #include "platform/weborigin/KURLHash.h" | 37 #include "platform/weborigin/KURLHash.h" |
| 38 #include "wtf/ListHashSet.h" | 38 #include "wtf/ListHashSet.h" |
| 39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class Attribute; | 45 class Attribute; |
| 46 class CSSRule; | 46 class CSSRule; |
| 47 class CSSStyleSheet; | 47 class CSSStyleSheet; |
| 48 class CSSValue; | 48 class CSSValue; |
| 49 class Document; | 49 class Document; |
| 50 class Element; | 50 class Element; |
| 51 class FontResource; | 51 class FontResource; |
| 52 class ImageResource; | 52 class ImageResource; |
| 53 class LocalFrame; | 53 class LocalFrame; |
| 54 class Node; | 54 class Node; |
| 55 class Page; | |
| 56 class LayoutObject; | 55 class LayoutObject; |
| 57 class Resource; | 56 class Resource; |
| 58 class SharedBuffer; | 57 class SharedBuffer; |
| 59 class StylePropertySet; | 58 class StylePropertySet; |
| 60 | 59 |
| 61 struct SerializedResource; | 60 struct SerializedResource; |
| 62 | 61 |
| 63 // This class is used to serialize frame's contents back to text (typically HTML
). | 62 // This class is used to serialize frame's contents back to text (typically HTML
). |
| 64 // It serializes frame's document and resources such as images and CSS styleshee
ts. | 63 // It serializes frame's document and resources such as images and CSS styleshee
ts. |
| 65 // TODO(lukasza): Rename this class to FrameSerializer. | 64 class CORE_EXPORT FrameSerializer final { |
| 66 class CORE_EXPORT PageSerializer final { | |
| 67 STACK_ALLOCATED(); | 65 STACK_ALLOCATED(); |
| 68 public: | 66 public: |
| 69 class Delegate { | 67 class Delegate { |
| 70 public: | 68 public: |
| 71 // Controls whether HTML serialization should skip the given attribute. | 69 // Controls whether HTML serialization should skip the given attribute. |
| 72 virtual bool shouldIgnoreAttribute(const Attribute&) | 70 virtual bool shouldIgnoreAttribute(const Attribute&) |
| 73 { | 71 { |
| 74 return false; | 72 return false; |
| 75 } | 73 } |
| 76 | 74 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 // Used to deduplicate resources across multiple frames. | 90 // Used to deduplicate resources across multiple frames. |
| 93 virtual bool shouldSkipResource(const KURL&) | 91 virtual bool shouldSkipResource(const KURL&) |
| 94 { | 92 { |
| 95 return false; | 93 return false; |
| 96 } | 94 } |
| 97 }; | 95 }; |
| 98 | 96 |
| 99 // Constructs a serializer that will write output to the given vector of | 97 // Constructs a serializer that will write output to the given vector of |
| 100 // SerializedResources and uses the Delegate for controlling some | 98 // SerializedResources and uses the Delegate for controlling some |
| 101 // serialization aspects. Callers need to ensure that both arguments stay | 99 // serialization aspects. Callers need to ensure that both arguments stay |
| 102 // alive until the PageSerializer gets destroyed. | 100 // alive until the FrameSerializer gets destroyed. |
| 103 PageSerializer(Vector<SerializedResource>&, Delegate&); | 101 FrameSerializer(Vector<SerializedResource>&, Delegate&); |
| 104 | 102 |
| 105 // Initiates the serialization of the frame. All serialized content and | 103 // Initiates the serialization of the frame. All serialized content and |
| 106 // retrieved resources are added to the Vector passed to the constructor. | 104 // retrieved resources are added to the Vector passed to the constructor. |
| 107 // The first resource in that vector is the frame's serialized content. | 105 // The first resource in that vector is the frame's serialized content. |
| 108 // Subsequent resources are images, css, etc. | 106 // Subsequent resources are images, css, etc. |
| 109 void serializeFrame(const LocalFrame&); | 107 void serializeFrame(const LocalFrame&); |
| 110 | 108 |
| 111 static String markOfTheWebDeclaration(const KURL&); | 109 static String markOfTheWebDeclaration(const KURL&); |
| 112 | 110 |
| 113 private: | 111 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 128 void retrieveResourcesForCSSValue(CSSValue*, Document&); | 126 void retrieveResourcesForCSSValue(CSSValue*, Document&); |
| 129 | 127 |
| 130 Vector<SerializedResource>* m_resources; | 128 Vector<SerializedResource>* m_resources; |
| 131 ListHashSet<KURL> m_resourceURLs; | 129 ListHashSet<KURL> m_resourceURLs; |
| 132 | 130 |
| 133 Delegate& m_delegate; | 131 Delegate& m_delegate; |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 } // namespace blink | 134 } // namespace blink |
| 137 | 135 |
| 138 #endif // PageSerializer_h | 136 #endif // FrameSerializer_h |
| OLD | NEW |