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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // | 67 // |
68 // Synchronously calls WebFrameSerializerClient methods to report | 68 // Synchronously calls WebFrameSerializerClient methods to report |
69 // serialization results. See WebFrameSerializerClient comments for more | 69 // serialization results. See WebFrameSerializerClient comments for more |
70 // details. | 70 // details. |
71 bool serialize(); | 71 bool serialize(); |
72 | 72 |
73 // The parameter specifies which frame need to be serialized. | 73 // The parameter specifies which frame need to be serialized. |
74 // The parameter delegate specifies the pointer of interface | 74 // The parameter delegate specifies the pointer of interface |
75 // DomSerializerDelegate provide sink interface which can receive the | 75 // DomSerializerDelegate provide sink interface which can receive the |
76 // individual chunks of data to be saved. | 76 // individual chunks of data to be saved. |
77 // The parameter urlsToLocalPaths contains a mapping between original URLs | |
78 // of saved resources and corresponding local file paths. | |
79 WebFrameSerializerImpl( | 77 WebFrameSerializerImpl( |
80 WebLocalFrame*, | 78 WebLocalFrame*, |
81 WebFrameSerializerClient*, | 79 WebFrameSerializerClient*, |
82 const WebVector<std::pair<WebURL, WebString>>& urlsToLocalPaths); | 80 WebFrameSerializer::LinkRewritingDelegate*); |
83 | 81 |
84 private: | 82 private: |
85 // Specified frame which need to be serialized; | 83 // Specified frame which need to be serialized; |
86 RawPtrWillBeMember<WebLocalFrameImpl> m_specifiedWebLocalFrameImpl; | 84 RawPtrWillBeMember<WebLocalFrameImpl> m_specifiedWebLocalFrameImpl; |
87 // Pointer of WebFrameSerializerClient | 85 // Pointer of WebFrameSerializerClient |
88 WebFrameSerializerClient* m_client; | 86 WebFrameSerializerClient* m_client; |
89 // This hash map is used to map resource URL of original link to its local | 87 // Pointer of WebFrameSerializer::LinkRewritingDelegate |
90 // file path. | 88 WebFrameSerializer::LinkRewritingDelegate* m_delegate; |
91 typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap; | |
92 // local_links_ include all pair of local resource path and corresponding | |
93 // original link. | |
94 LinkLocalPathMap m_localLinks; | |
95 // Data buffer for saving result of serialized DOM data. | 89 // Data buffer for saving result of serialized DOM data. |
96 StringBuilder m_dataBuffer; | 90 StringBuilder m_dataBuffer; |
97 | 91 |
98 // Web entities conversion maps. | 92 // Web entities conversion maps. |
99 WebEntities m_htmlEntities; | 93 WebEntities m_htmlEntities; |
100 WebEntities m_xmlEntities; | 94 WebEntities m_xmlEntities; |
101 | 95 |
102 class SerializeDomParam { | 96 class SerializeDomParam { |
103 STACK_ALLOCATED(); | 97 STACK_ALLOCATED(); |
104 public: | 98 public: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 166 |
173 // Serialize end tag of an specified element. | 167 // Serialize end tag of an specified element. |
174 void endTagToString( | 168 void endTagToString( |
175 Element*, | 169 Element*, |
176 SerializeDomParam*); | 170 SerializeDomParam*); |
177 | 171 |
178 // Build content for a specified node | 172 // Build content for a specified node |
179 void buildContentForNode( | 173 void buildContentForNode( |
180 Node*, | 174 Node*, |
181 SerializeDomParam*); | 175 SerializeDomParam*); |
| 176 |
| 177 // Appends attrName="escapedAttrValue" to result. |
| 178 void appendAttribute( |
| 179 StringBuilder& result, |
| 180 bool isHTMLDocument, |
| 181 const String& attrName, |
| 182 const String& attrValue); |
182 }; | 183 }; |
183 | 184 |
184 } // namespace blink | 185 } // namespace blink |
185 | 186 |
186 #endif | 187 #endif |
OLD | NEW |