| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class Page; | 48 class Page; |
| 49 class RenderObject; | 49 class RenderObject; |
| 50 class Resource; | 50 class Resource; |
| 51 class SharedBuffer; | 51 class SharedBuffer; |
| 52 class StylePropertySet; | 52 class StylePropertySet; |
| 53 class StyleRule; | 53 class StyleRule; |
| 54 class StyleRuleFontFace; | 54 class StyleRuleFontFace; |
| 55 | 55 |
| 56 struct SerializedResource; | 56 struct SerializedResource; |
| 57 | 57 |
| 58 // This hash map is used to map resource URL of original link to its local | |
| 59 // file path. | |
| 60 typedef HashMap<String, String> LinkLocalPathMap; | |
| 61 | |
| 62 // 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)
. |
| 63 // 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. |
| 64 class PageSerializer { | 60 class PageSerializer { |
| 65 public: | 61 public: |
| 66 PageSerializer(Vector<SerializedResource>*, LinkLocalPathMap* = 0, String di
rectory = ""); | 62 explicit PageSerializer(Vector<SerializedResource>*); |
| 67 | 63 |
| 68 // 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 |
| 69 // 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 |
| 70 // vector is the top frame serialized content. | 66 // vector is the top frame serialized content. |
| 71 void serialize(Page*); | 67 void serialize(Page*); |
| 72 | 68 |
| 73 KURL urlForBlankFrame(Frame*); | 69 KURL urlForBlankFrame(Frame*); |
| 74 | 70 |
| 75 private: | 71 private: |
| 76 void serializeFrame(Frame*); | 72 void serializeFrame(Frame*); |
| 77 | 73 |
| 78 // 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. |
| 79 // 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). |
| 80 void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&); | 76 void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&); |
| 81 | 77 |
| 82 bool shouldAddURL(const KURL&); | 78 bool shouldAddURL(const KURL&); |
| 83 | 79 |
| 84 void addToResources(Resource *, PassRefPtr<SharedBuffer>, const KURL&); | 80 void addToResources(Resource *, PassRefPtr<SharedBuffer>, const KURL&); |
| 85 void addImageToResources(ImageResource*, RenderObject*, const KURL&); | 81 void addImageToResources(ImageResource*, RenderObject*, const KURL&); |
| 86 void addFontToResources(FontResource*); | 82 void addFontToResources(FontResource*); |
| 87 | 83 |
| 88 void retrieveResourcesForProperties(const StylePropertySet*, Document*); | 84 void retrieveResourcesForProperties(const StylePropertySet*, Document*); |
| 89 void retrieveResourcesForCSSValue(CSSValue*, Document*); | 85 void retrieveResourcesForCSSValue(CSSValue*, Document*); |
| 90 | 86 |
| 91 Vector<SerializedResource>* m_resources; | 87 Vector<SerializedResource>* m_resources; |
| 92 ListHashSet<KURL> m_resourceURLs; | 88 ListHashSet<KURL> m_resourceURLs; |
| 93 HashMap<Frame*, KURL> m_blankFrameURLs; | 89 HashMap<Frame*, KURL> m_blankFrameURLs; |
| 94 LinkLocalPathMap* m_URLs; | |
| 95 String m_directory; | |
| 96 unsigned m_blankFrameCounter; | 90 unsigned m_blankFrameCounter; |
| 97 }; | 91 }; |
| 98 | 92 |
| 99 } | 93 } |
| 100 | 94 |
| 101 #endif | 95 #endif |
| OLD | NEW |