| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 class Document; | 50 class Document; |
| 51 class LocalFrame; | 51 class LocalFrame; |
| 52 class Page; | 52 class Page; |
| 53 class LayoutObject; | 53 class LayoutObject; |
| 54 class Resource; | 54 class Resource; |
| 55 class SharedBuffer; | 55 class SharedBuffer; |
| 56 class StylePropertySet; | 56 class StylePropertySet; |
| 57 | 57 |
| 58 struct SerializedResource; | 58 struct SerializedResource; |
| 59 | 59 |
| 60 // This hash map is used to map resource URL of original link to its local |
| 61 // file path. |
| 62 typedef HashMap<String, String> LinkLocalPathMap; |
| 63 |
| 60 // This class is used to serialize a page contents back to text (typically HTML)
. | 64 // This class is used to serialize a page contents back to text (typically HTML)
. |
| 61 // It serializes all the page frames and retrieves resources such as images and
CSS stylesheets. | 65 // It serializes all the page frames and retrieves resources such as images and
CSS stylesheets. |
| 62 class CORE_EXPORT PageSerializer final { | 66 class CORE_EXPORT PageSerializer final { |
| 63 STACK_ALLOCATED(); | 67 STACK_ALLOCATED(); |
| 64 public: | 68 public: |
| 65 class Delegate { | 69 class Delegate { |
| 66 public: | 70 public: |
| 67 virtual ~Delegate() { } | 71 virtual ~Delegate() { } |
| 68 virtual bool shouldIgnoreAttribute(const Attribute&) = 0; | 72 virtual bool shouldIgnoreAttribute(const Attribute&) = 0; |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 PageSerializer(Vector<SerializedResource>*, PassOwnPtr<Delegate>); | 75 PageSerializer(Vector<SerializedResource>*, PassOwnPtr<Delegate>, LinkLocalP
athMap* = 0, String directory = ""); |
| 72 | 76 |
| 73 // Initiates the serialization of the frame's page. All serialized content a
nd retrieved | 77 // Initiates the serialization of the frame's page. All serialized content a
nd retrieved |
| 74 // resources are added to the Vector passed to the constructor. The first re
source in that | 78 // resources are added to the Vector passed to the constructor. The first re
source in that |
| 75 // vector is the top frame serialized content. | 79 // vector is the top frame serialized content. |
| 76 void serialize(Page*); | 80 void serialize(Page*); |
| 77 | 81 |
| 78 KURL urlForBlankFrame(LocalFrame*); | 82 KURL urlForBlankFrame(LocalFrame*); |
| 79 | 83 |
| 80 Delegate* delegate(); | 84 Delegate* delegate(); |
| 81 | 85 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 void addFontToResources(FontResource*); | 97 void addFontToResources(FontResource*); |
| 94 | 98 |
| 95 void retrieveResourcesForProperties(const StylePropertySet*, Document&); | 99 void retrieveResourcesForProperties(const StylePropertySet*, Document&); |
| 96 void retrieveResourcesForCSSValue(CSSValue*, Document&); | 100 void retrieveResourcesForCSSValue(CSSValue*, Document&); |
| 97 | 101 |
| 98 Vector<SerializedResource>* m_resources; | 102 Vector<SerializedResource>* m_resources; |
| 99 ListHashSet<KURL> m_resourceURLs; | 103 ListHashSet<KURL> m_resourceURLs; |
| 100 | 104 |
| 101 using BlankFrameURLMap = WillBeHeapHashMap<RawPtrWillBeMember<LocalFrame>, K
URL>; | 105 using BlankFrameURLMap = WillBeHeapHashMap<RawPtrWillBeMember<LocalFrame>, K
URL>; |
| 102 BlankFrameURLMap m_blankFrameURLs; | 106 BlankFrameURLMap m_blankFrameURLs; |
| 107 LinkLocalPathMap* m_URLs; |
| 108 String m_directory; |
| 103 unsigned m_blankFrameCounter; | 109 unsigned m_blankFrameCounter; |
| 104 | 110 |
| 105 OwnPtr<Delegate> m_delegate; | 111 OwnPtr<Delegate> m_delegate; |
| 106 }; | 112 }; |
| 107 | 113 |
| 108 } // namespace blink | 114 } // namespace blink |
| 109 | 115 |
| 110 #endif // PageSerializer_h | 116 #endif // PageSerializer_h |
| OLD | NEW |