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 21 matching lines...) Expand all Loading... |
32 #define PageSerializer_h | 32 #define PageSerializer_h |
33 | 33 |
34 #include "weborigin/KURL.h" | 34 #include "weborigin/KURL.h" |
35 #include "weborigin/KURLHash.h" | 35 #include "weborigin/KURLHash.h" |
36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
37 #include "wtf/ListHashSet.h" | 37 #include "wtf/ListHashSet.h" |
38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
| 42 class FontResource; |
42 class ImageResource; | 43 class ImageResource; |
43 class CSSStyleSheet; | 44 class CSSStyleSheet; |
| 45 class CSSValue; |
44 class Document; | 46 class Document; |
45 class Frame; | 47 class Frame; |
46 class Page; | 48 class Page; |
47 class RenderObject; | 49 class RenderObject; |
| 50 class Resource; |
| 51 class SharedBuffer; |
48 class StylePropertySet; | 52 class StylePropertySet; |
49 class StyleRule; | 53 class StyleRule; |
| 54 class StyleRuleFontFace; |
50 | 55 |
51 struct SerializedResource; | 56 struct SerializedResource; |
52 | 57 |
53 // This class is used to serialize a page contents back to text (typically HTML)
. | 58 // This class is used to serialize a page contents back to text (typically HTML)
. |
54 // It serializes all the page frames and retrieves resources such as images and
CSS stylesheets. | 59 // It serializes all the page frames and retrieves resources such as images and
CSS stylesheets. |
55 class PageSerializer { | 60 class PageSerializer { |
56 public: | 61 public: |
57 explicit PageSerializer(Vector<SerializedResource>*); | 62 explicit PageSerializer(Vector<SerializedResource>*); |
58 | 63 |
59 // Initiates the serialization of the frame's page. All serialized content a
nd retrieved | 64 // Initiates the serialization of the frame's page. All serialized content a
nd retrieved |
60 // resources are added to the Vector passed to the constructor. The first re
source in that | 65 // resources are added to the Vector passed to the constructor. The first re
source in that |
61 // vector is the top frame serialized content. | 66 // vector is the top frame serialized content. |
62 void serialize(Page*); | 67 void serialize(Page*); |
63 | 68 |
64 KURL urlForBlankFrame(Frame*); | 69 KURL urlForBlankFrame(Frame*); |
65 | 70 |
66 private: | 71 private: |
67 void serializeFrame(Frame*); | 72 void serializeFrame(Frame*); |
68 | 73 |
69 // Serializes the stylesheet back to text and adds it to the resources if UR
L is not-empty. | 74 // Serializes the stylesheet back to text and adds it to the resources if UR
L is not-empty. |
70 // It also adds any resources included in that stylesheet (including any imp
orted stylesheets and their own resources). | 75 // It also adds any resources included in that stylesheet (including any imp
orted stylesheets and their own resources). |
71 void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&); | 76 void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&); |
72 | 77 |
| 78 bool shouldAddURL(const KURL&); |
| 79 |
| 80 void addToResources(Resource *, PassRefPtr<SharedBuffer>, const KURL&); |
73 void addImageToResources(ImageResource*, RenderObject*, const KURL&); | 81 void addImageToResources(ImageResource*, RenderObject*, const KURL&); |
| 82 void addFontToResources(FontResource*); |
| 83 |
74 void retrieveResourcesForProperties(const StylePropertySet*, Document*); | 84 void retrieveResourcesForProperties(const StylePropertySet*, Document*); |
75 void retrieveResourcesForRule(StyleRule*, Document*); | 85 void retrieveResourcesForCSSValue(CSSValue*, Document*); |
76 | 86 |
77 Vector<SerializedResource>* m_resources; | 87 Vector<SerializedResource>* m_resources; |
78 ListHashSet<KURL> m_resourceURLs; | 88 ListHashSet<KURL> m_resourceURLs; |
79 HashMap<Frame*, KURL> m_blankFrameURLs; | 89 HashMap<Frame*, KURL> m_blankFrameURLs; |
80 unsigned m_blankFrameCounter; | 90 unsigned m_blankFrameCounter; |
81 }; | 91 }; |
82 | 92 |
83 } | 93 } |
84 | 94 |
85 #endif | 95 #endif |
OLD | NEW |