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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class TextEncoding; | 48 class TextEncoding; |
49 } | 49 } |
50 | 50 |
51 namespace WebCore { | 51 namespace WebCore { |
52 class Document; | 52 class Document; |
53 class Element; | 53 class Element; |
54 class Node; | 54 class Node; |
55 } | 55 } |
56 | 56 |
57 namespace blink { | 57 namespace blink { |
58 class WebFrameImpl; | 58 class WebLocalFrameImpl; |
59 | 59 |
60 // Get html data by serializing all frames of current page with lists | 60 // Get html data by serializing all frames of current page with lists |
61 // which contain all resource links that have local copy. | 61 // which contain all resource links that have local copy. |
62 // contain all saved auxiliary files included all sub frames and resources. | 62 // contain all saved auxiliary files included all sub frames and resources. |
63 // This function will find out all frames and serialize them to HTML data. | 63 // This function will find out all frames and serialize them to HTML data. |
64 // We have a data buffer to temporary saving generated html data. We will | 64 // We have a data buffer to temporary saving generated html data. We will |
65 // sequentially call WebViewDelegate::SendSerializedHtmlData once the data | 65 // sequentially call WebViewDelegate::SendSerializedHtmlData once the data |
66 // buffer is full. See comments of WebViewDelegate::SendSerializedHtmlData | 66 // buffer is full. See comments of WebViewDelegate::SendSerializedHtmlData |
67 // for getting more information. | 67 // for getting more information. |
68 class WebPageSerializerImpl { | 68 class WebPageSerializerImpl { |
(...skipping 15 matching lines...) Expand all Loading... |
84 // contain all saved auxiliary files included all sub frames and resources. | 84 // contain all saved auxiliary files included all sub frames and resources. |
85 WebPageSerializerImpl(WebFrame* frame, | 85 WebPageSerializerImpl(WebFrame* frame, |
86 bool recursive, | 86 bool recursive, |
87 WebPageSerializerClient* client, | 87 WebPageSerializerClient* client, |
88 const WebVector<WebURL>& links, | 88 const WebVector<WebURL>& links, |
89 const WebVector<WebString>& localPaths, | 89 const WebVector<WebString>& localPaths, |
90 const WebString& localDirectoryName); | 90 const WebString& localDirectoryName); |
91 | 91 |
92 private: | 92 private: |
93 // Specified frame which need to be serialized; | 93 // Specified frame which need to be serialized; |
94 WebFrameImpl* m_specifiedWebFrameImpl; | 94 WebLocalFrameImpl* m_specifiedWebLocalFrameImpl; |
95 // Pointer of WebPageSerializerClient | 95 // Pointer of WebPageSerializerClient |
96 WebPageSerializerClient* m_client; | 96 WebPageSerializerClient* m_client; |
97 // This hash map is used to map resource URL of original link to its local | 97 // This hash map is used to map resource URL of original link to its local |
98 // file path. | 98 // file path. |
99 typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap; | 99 typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap; |
100 // local_links_ include all pair of local resource path and corresponding | 100 // local_links_ include all pair of local resource path and corresponding |
101 // original link. | 101 // original link. |
102 LinkLocalPathMap m_localLinks; | 102 LinkLocalPathMap m_localLinks; |
103 // Data buffer for saving result of serialized DOM data. | 103 // Data buffer for saving result of serialized DOM data. |
104 StringBuilder m_dataBuffer; | 104 StringBuilder m_dataBuffer; |
105 // Passing true to recursive_serialization_ indicates we will serialize not | 105 // Passing true to recursive_serialization_ indicates we will serialize not |
106 // only the specified frame but also all sub-frames in the specific frame. | 106 // only the specified frame but also all sub-frames in the specific frame. |
107 // Otherwise we only serialize the specified frame excluded all sub-frames. | 107 // Otherwise we only serialize the specified frame excluded all sub-frames. |
108 bool m_recursiveSerialization; | 108 bool m_recursiveSerialization; |
109 // Flag indicates whether we have collected all frames which need to be | 109 // Flag indicates whether we have collected all frames which need to be |
110 // serialized or not; | 110 // serialized or not; |
111 bool m_framesCollected; | 111 bool m_framesCollected; |
112 // Local directory name of all local resource files. | 112 // Local directory name of all local resource files. |
113 WTF::String m_localDirectoryName; | 113 WTF::String m_localDirectoryName; |
114 // Vector for saving all frames which need to be serialized. | 114 // Vector for saving all frames which need to be serialized. |
115 Vector<WebFrameImpl*> m_frames; | 115 Vector<WebLocalFrameImpl*> m_frames; |
116 | 116 |
117 // Web entities conversion maps. | 117 // Web entities conversion maps. |
118 WebEntities m_htmlEntities; | 118 WebEntities m_htmlEntities; |
119 WebEntities m_xmlEntities; | 119 WebEntities m_xmlEntities; |
120 | 120 |
121 struct SerializeDomParam { | 121 struct SerializeDomParam { |
122 const WebCore::KURL& url; | 122 const WebCore::KURL& url; |
123 const WTF::TextEncoding& textEncoding; | 123 const WTF::TextEncoding& textEncoding; |
124 WebCore::Document* document; | 124 WebCore::Document* document; |
125 const WTF::String& directoryName; | 125 const WTF::String& directoryName; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void endTagToString(WebCore::Element*, | 183 void endTagToString(WebCore::Element*, |
184 SerializeDomParam* param); | 184 SerializeDomParam* param); |
185 // Build content for a specified node | 185 // Build content for a specified node |
186 void buildContentForNode(WebCore::Node*, | 186 void buildContentForNode(WebCore::Node*, |
187 SerializeDomParam* param); | 187 SerializeDomParam* param); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace blink | 190 } // namespace blink |
191 | 191 |
192 #endif | 192 #endif |
OLD | NEW |