Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: third_party/WebKit/Source/web/WebPageSerializerImpl.h

Issue 1373573002: ABANDONED: OOPIFs: Moving stitching of local paths from renderer to browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-recursive-begone
Patch Set: Removed no longer needed WebKit dependency. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Do serialization action. 63 // Do serialization action.
64 // 64 //
65 // Returns false to indicate that no data has been serialized (i.e. because 65 // Returns false to indicate that no data has been serialized (i.e. because
66 // the target frame didn't have a valid url). 66 // the target frame didn't have a valid url).
67 // 67 //
68 // Synchronously calls WebPageSerializerClient methods to report 68 // Synchronously calls WebPageSerializerClient methods to report
69 // serialization results. See WebPageSerializerClient comments for more 69 // serialization results. See WebPageSerializerClient 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 first parameter specifies which frame need to be serialized.
74 // The parameter delegate specifies the pointer of interface 74 // The second parameter provides a sink interface which can receive the
75 // DomSerializerDelegate provide sink interface which can receive the
76 // individual chunks of data to be saved. 75 // individual chunks of data to be saved.
77 // The parameter links contain original URLs of all saved links. 76 WebPageSerializerImpl(WebFrame*, WebPageSerializerClient*);
ncarter (slow) 2015/10/08 20:57:55 Why drop the parameter names -- is that just The B
Łukasz Anforowicz 2015/10/09 16:54:08 Yes - this is blink-ism. The error method from pr
dcheng 2015/10/09 16:59:33 Usually, we don't document parameters by position.
Łukasz Anforowicz 2015/10/21 22:50:34 Done.
78 // The parameter local_paths contain corresponding local file paths of all
79 // saved links, which matched with vector:links one by one.
80 // The parameter local_directory_name is relative path of directory which
81 // contain all saved auxiliary files included all sub frames and resources.
82 WebPageSerializerImpl(WebFrame* frame,
83 WebPageSerializerClient* client,
84 const WebVector<WebURL>& links,
85 const WebVector<WebString>& localPaths,
86 const WebString& localDirectoryName);
87 77
88 private: 78 private:
89 // Specified frame which need to be serialized; 79 // Specified frame which need to be serialized;
90 RawPtrWillBeMember<WebLocalFrameImpl> m_specifiedWebLocalFrameImpl; 80 RawPtrWillBeMember<WebLocalFrameImpl> m_specifiedWebLocalFrameImpl;
91 // Pointer of WebPageSerializerClient 81 // Pointer of WebPageSerializerClient
92 WebPageSerializerClient* m_client; 82 WebPageSerializerClient* m_client;
93 // This hash map is used to map resource URL of original link to its local
94 // file path.
95 typedef HashMap<WTF::String, WTF::String> LinkLocalPathMap;
96 // local_links_ include all pair of local resource path and corresponding
97 // original link.
98 LinkLocalPathMap m_localLinks;
99 // Data buffer for saving result of serialized DOM data. 83 // Data buffer for saving result of serialized DOM data.
100 StringBuilder m_dataBuffer; 84 StringBuilder m_dataBuffer;
101 // Local directory name of all local resource files.
102 WTF::String m_localDirectoryName;
103 85
104 // Web entities conversion maps. 86 // Web entities conversion maps.
105 WebEntities m_htmlEntities; 87 WebEntities m_htmlEntities;
106 WebEntities m_xmlEntities; 88 WebEntities m_xmlEntities;
107 89
108 class SerializeDomParam { 90 class SerializeDomParam {
109 STACK_ALLOCATED(); 91 STACK_ALLOCATED();
110 public: 92 public:
111 SerializeDomParam(const KURL&, const WTF::TextEncoding&, Document*, cons t WTF::String& directoryName); 93 SerializeDomParam(const KURL&, const WTF::TextEncoding&, Document*);
112 94
113 const KURL& url; 95 const KURL& url;
114 const WTF::TextEncoding& textEncoding; 96 const WTF::TextEncoding& textEncoding;
115 RawPtrWillBeMember<Document> document; 97 RawPtrWillBeMember<Document> document;
116 const WTF::String& directoryName;
117 bool isHTMLDocument; // document.isHTMLDocument() 98 bool isHTMLDocument; // document.isHTMLDocument()
118 bool haveSeenDocType; 99 bool haveSeenDocType;
119 bool haveAddedCharsetDeclaration; 100 bool haveAddedCharsetDeclaration;
120 // This meta element need to be skipped when serializing DOM. 101 // This meta element need to be skipped when serializing DOM.
121 RawPtrWillBeMember<const Element> skipMetaElement; 102 RawPtrWillBeMember<const Element> skipMetaElement;
122 // Flag indicates we are in script or style tag. 103 // Flag indicates we are in script or style tag.
123 bool isInScriptOrStyleTag; 104 bool isInScriptOrStyleTag;
124 bool haveAddedXMLProcessingDirective; 105 bool haveAddedXMLProcessingDirective;
125 // Flag indicates whether we have added additional contents before end t ag. 106 // Flag indicates whether we have added additional contents before end t ag.
126 // This flag will be re-assigned in each call of function 107 // This flag will be re-assigned in each call of function
(...skipping 25 matching lines...) Expand all
152 void saveHTMLContentToBuffer(const WTF::String& content, 133 void saveHTMLContentToBuffer(const WTF::String& content,
153 SerializeDomParam* param); 134 SerializeDomParam* param);
154 135
155 enum FlushOption { 136 enum FlushOption {
156 ForceFlush, 137 ForceFlush,
157 DoNotForceFlush, 138 DoNotForceFlush,
158 }; 139 };
159 140
160 // Flushes the content buffer by encoding and sending the content to the 141 // Flushes the content buffer by encoding and sending the content to the
161 // WebPageSerializerClient. Content is not flushed if the buffer is not full 142 // WebPageSerializerClient. Content is not flushed if the buffer is not full
162 // unless force is 1. 143 // unless FlushOption::ForceFlush is used.
163 void encodeAndFlushBuffer(WebPageSerializerClient::PageSerializationStatus s tatus, 144 void encodeAndFlushBuffer(SerializeDomParam*, FlushOption);
164 SerializeDomParam* param,
165 FlushOption);
166 // Serialize open tag of an specified element. 145 // Serialize open tag of an specified element.
167 void openTagToString(Element*, 146 void handleOpenTag(Element*, SerializeDomParam*);
168 SerializeDomParam* param); 147 // Serialize value of URL-containing attribute of the specified element.
148 void handleLinkAttr(Element*, SerializeDomParam*, const String& attrValue);
169 // Serialize end tag of an specified element. 149 // Serialize end tag of an specified element.
170 void endTagToString(Element*, 150 void handleEndTag(Element*, SerializeDomParam*);
171 SerializeDomParam* param);
172 // Build content for a specified node 151 // Build content for a specified node
173 void buildContentForNode(Node*, 152 void buildContentForNode(Node*,
174 SerializeDomParam* param); 153 SerializeDomParam* param);
175 }; 154 };
176 155
177 } // namespace blink 156 } // namespace blink
178 157
179 #endif 158 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698