| 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 WebFrame; | |
| 15 class WebFrameImpl; | 14 class WebFrameImpl; |
| 16 | 15 |
| 17 namespace WebCore { | 16 namespace WebCore { |
| 18 class Document; | 17 class Document; |
| 19 class Element; | 18 class Element; |
| 20 class Node; | 19 class Node; |
| 21 class String; | 20 class String; |
| 22 class TextEncoding; | 21 class TextEncoding; |
| 23 } | 22 } |
| 24 | 23 |
| 24 namespace WebKit { |
| 25 class WebFrame; |
| 26 } |
| 27 |
| 25 namespace webkit_glue { | 28 namespace webkit_glue { |
| 26 | 29 |
| 27 class DomSerializerDelegate; | 30 class DomSerializerDelegate; |
| 28 | 31 |
| 29 // Get html data by serializing all frames of current page with lists | 32 // Get html data by serializing all frames of current page with lists |
| 30 // which contain all resource links that have local copy. | 33 // which contain all resource links that have local copy. |
| 31 // contain all saved auxiliary files included all sub frames and resources. | 34 // contain all saved auxiliary files included all sub frames and resources. |
| 32 // This function will find out all frames and serialize them to HTML data. | 35 // This function will find out all frames and serialize them to HTML data. |
| 33 // We have a data buffer to temporary saving generated html data. We will | 36 // We have a data buffer to temporary saving generated html data. We will |
| 34 // sequentially call WebViewDelegate::SendSerializedHtmlData once the data | 37 // sequentially call WebViewDelegate::SendSerializedHtmlData once the data |
| 35 // buffer is full. See comments of WebViewDelegate::SendSerializedHtmlData | 38 // buffer is full. See comments of WebViewDelegate::SendSerializedHtmlData |
| 36 // for getting more information. | 39 // for getting more information. |
| 37 class DomSerializer { | 40 class DomSerializer { |
| 38 public: | 41 public: |
| 39 // Do serialization action. Return false means no available frame has been | 42 // Do serialization action. Return false means no available frame has been |
| 40 // serialized, otherwise return true. | 43 // serialized, otherwise return true. |
| 41 bool SerializeDom(); | 44 bool SerializeDom(); |
| 42 // The parameter specifies which frame need to be serialized. | 45 // The parameter specifies which frame need to be serialized. |
| 43 // The parameter recursive_serialization specifies whether we need to | 46 // The parameter recursive_serialization specifies whether we need to |
| 44 // serialize all sub frames of the specified frame or not. | 47 // serialize all sub frames of the specified frame or not. |
| 45 // The parameter delegate specifies the pointer of interface | 48 // The parameter delegate specifies the pointer of interface |
| 46 // DomSerializerDelegate provide sink interface which can receive the | 49 // DomSerializerDelegate provide sink interface which can receive the |
| 47 // individual chunks of data to be saved. | 50 // individual chunks of data to be saved. |
| 48 // The parameter links contain original URLs of all saved links. | 51 // The parameter links contain original URLs of all saved links. |
| 49 // The parameter local_paths contain corresponding local file paths of all | 52 // The parameter local_paths contain corresponding local file paths of all |
| 50 // saved links, which matched with vector:links one by one. | 53 // saved links, which matched with vector:links one by one. |
| 51 // The parameter local_directory_name is relative path of directory which | 54 // The parameter local_directory_name is relative path of directory which |
| 52 // contain all saved auxiliary files included all sub frames and resources. | 55 // contain all saved auxiliary files included all sub frames and resources. |
| 53 DomSerializer(WebFrame* webframe, | 56 DomSerializer(WebKit::WebFrame* webframe, |
| 54 bool recursive_serialization, | 57 bool recursive_serialization, |
| 55 DomSerializerDelegate* delegate, | 58 DomSerializerDelegate* delegate, |
| 56 const std::vector<GURL>& links, | 59 const std::vector<GURL>& links, |
| 57 const std::vector<FilePath>& local_paths, | 60 const std::vector<FilePath>& local_paths, |
| 58 const FilePath& local_directory_name); | 61 const FilePath& local_directory_name); |
| 59 | 62 |
| 60 // Generate the META for charset declaration. | 63 // Generate the META for charset declaration. |
| 61 static std::wstring GenerateMetaCharsetDeclaration( | 64 static std::wstring GenerateMetaCharsetDeclaration( |
| 62 const std::wstring& charset); | 65 const std::wstring& charset); |
| 63 // Generate the MOTW declaration. | 66 // Generate the MOTW declaration. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Build content for a specified node | 172 // Build content for a specified node |
| 170 void BuildContentForNode(const WebCore::Node* node, | 173 void BuildContentForNode(const WebCore::Node* node, |
| 171 SerializeDomParam* param); | 174 SerializeDomParam* param); |
| 172 | 175 |
| 173 DISALLOW_EVIL_CONSTRUCTORS(DomSerializer); | 176 DISALLOW_EVIL_CONSTRUCTORS(DomSerializer); |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 } // namespace webkit_glue | 179 } // namespace webkit_glue |
| 177 | 180 |
| 178 #endif // WEBKIT_GLUE_DOM_SERIALIZER_H__ | 181 #endif // WEBKIT_GLUE_DOM_SERIALIZER_H__ |
| OLD | NEW |