OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_GLUE_DOM_SERIALIZER_H__ | 5 #ifndef WEBKIT_GLUE_DOM_SERIALIZER_H__ |
6 #define WEBKIT_GLUE_DOM_SERIALIZER_H__ | 6 #define WEBKIT_GLUE_DOM_SERIALIZER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class WebFrameImpl; | |
15 | |
16 namespace WebCore { | 14 namespace WebCore { |
17 class Document; | 15 class Document; |
18 class Element; | 16 class Element; |
19 class Node; | 17 class Node; |
20 class String; | 18 class String; |
21 class TextEncoding; | 19 class TextEncoding; |
22 } | 20 } |
23 | 21 |
24 namespace WebKit { | 22 namespace WebKit { |
25 class WebFrame; | 23 class WebFrame; |
| 24 class WebFrameImpl; |
26 } | 25 } |
27 | 26 |
28 namespace webkit_glue { | 27 namespace webkit_glue { |
29 | 28 |
30 class DomSerializerDelegate; | 29 class DomSerializerDelegate; |
31 | 30 |
32 // Get html data by serializing all frames of current page with lists | 31 // Get html data by serializing all frames of current page with lists |
33 // which contain all resource links that have local copy. | 32 // which contain all resource links that have local copy. |
34 // contain all saved auxiliary files included all sub frames and resources. | 33 // contain all saved auxiliary files included all sub frames and resources. |
35 // This function will find out all frames and serialize them to HTML data. | 34 // This function will find out all frames and serialize them to HTML data. |
(...skipping 28 matching lines...) Expand all Loading... |
64 static std::wstring GenerateMetaCharsetDeclaration( | 63 static std::wstring GenerateMetaCharsetDeclaration( |
65 const std::wstring& charset); | 64 const std::wstring& charset); |
66 // Generate the MOTW declaration. | 65 // Generate the MOTW declaration. |
67 static std::string GenerateMarkOfTheWebDeclaration(const GURL& url); | 66 static std::string GenerateMarkOfTheWebDeclaration(const GURL& url); |
68 // Generate the default base tag declaration. | 67 // Generate the default base tag declaration. |
69 static std::wstring GenerateBaseTagDeclaration( | 68 static std::wstring GenerateBaseTagDeclaration( |
70 const std::wstring& base_target); | 69 const std::wstring& base_target); |
71 | 70 |
72 private: | 71 private: |
73 // Specified frame which need to be serialized; | 72 // Specified frame which need to be serialized; |
74 WebFrameImpl* specified_webframeimpl_; | 73 WebKit::WebFrameImpl* specified_webframeimpl_; |
75 // This hash_map is used to map resource URL of original link to its local | 74 // This hash_map is used to map resource URL of original link to its local |
76 // file path. | 75 // file path. |
77 typedef base::hash_map<std::string, FilePath> LinkLocalPathMap; | 76 typedef base::hash_map<std::string, FilePath> LinkLocalPathMap; |
78 // local_links_ include all pair of local resource path and corresponding | 77 // local_links_ include all pair of local resource path and corresponding |
79 // original link. | 78 // original link. |
80 LinkLocalPathMap local_links_; | 79 LinkLocalPathMap local_links_; |
81 // Pointer of DomSerializerDelegate | 80 // Pointer of DomSerializerDelegate |
82 DomSerializerDelegate* delegate_; | 81 DomSerializerDelegate* delegate_; |
83 // Data buffer for saving result of serialized DOM data. | 82 // Data buffer for saving result of serialized DOM data. |
84 std::string data_buffer_; | 83 std::string data_buffer_; |
85 // Passing true to recursive_serialization_ indicates we will serialize not | 84 // Passing true to recursive_serialization_ indicates we will serialize not |
86 // only the specified frame but also all sub-frames in the specific frame. | 85 // only the specified frame but also all sub-frames in the specific frame. |
87 // Otherwise we only serialize the specified frame excluded all sub-frames. | 86 // Otherwise we only serialize the specified frame excluded all sub-frames. |
88 bool recursive_serialization_; | 87 bool recursive_serialization_; |
89 // Flag indicates whether we have collected all frames which need to be | 88 // Flag indicates whether we have collected all frames which need to be |
90 // serialized or not; | 89 // serialized or not; |
91 bool frames_collected_; | 90 bool frames_collected_; |
92 // Local directory name of all local resource files. | 91 // Local directory name of all local resource files. |
93 const FilePath& local_directory_name_; | 92 const FilePath& local_directory_name_; |
94 // Vector for saving all frames which need to be serialized. | 93 // Vector for saving all frames which need to be serialized. |
95 std::vector<WebFrameImpl*> frames_; | 94 std::vector<WebKit::WebFrameImpl*> frames_; |
96 | 95 |
97 struct SerializeDomParam { | 96 struct SerializeDomParam { |
98 // Frame URL of current processing document presented by GURL | 97 // Frame URL of current processing document presented by GURL |
99 const GURL& current_frame_gurl; | 98 const GURL& current_frame_gurl; |
100 // Current using text encoding object. | 99 // Current using text encoding object. |
101 const WebCore::TextEncoding& text_encoding; | 100 const WebCore::TextEncoding& text_encoding; |
102 | 101 |
103 // Document object of current frame. | 102 // Document object of current frame. |
104 WebCore::Document* doc; | 103 WebCore::Document* doc; |
105 // Local directory name of all local resource files. | 104 // Local directory name of all local resource files. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Build content for a specified node | 171 // Build content for a specified node |
173 void BuildContentForNode(const WebCore::Node* node, | 172 void BuildContentForNode(const WebCore::Node* node, |
174 SerializeDomParam* param); | 173 SerializeDomParam* param); |
175 | 174 |
176 DISALLOW_EVIL_CONSTRUCTORS(DomSerializer); | 175 DISALLOW_EVIL_CONSTRUCTORS(DomSerializer); |
177 }; | 176 }; |
178 | 177 |
179 } // namespace webkit_glue | 178 } // namespace webkit_glue |
180 | 179 |
181 #endif // WEBKIT_GLUE_DOM_SERIALIZER_H__ | 180 #endif // WEBKIT_GLUE_DOM_SERIALIZER_H__ |
OLD | NEW |