| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebPageSerializerClient_h | 31 #ifndef WebPageSerializerClient_h |
| 32 #define WebPageSerializerClient_h | 32 #define WebPageSerializerClient_h |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class WebCString; | 36 class WebCString; |
| 37 class WebFrame; |
| 37 class WebURL; | 38 class WebURL; |
| 38 | 39 |
| 39 // This class is used for providing sink interface that can be used to receive | 40 // This class is used for providing sink interface that can be used to receive |
| 40 // the individual chunks of data to be saved. | 41 // the individual chunks of data to be saved. |
| 41 class WebPageSerializerClient { | 42 class WebPageSerializerClient { |
| 42 public: | 43 public: |
| 43 // This enum indicates This sink interface can receive the individual chunk
s | 44 WebPageSerializerClient() { } |
| 44 // of serialized data to be saved, so we use values of following enum | |
| 45 // definition to indicate the serialization status of serializing all html | |
| 46 // content. If current frame is not complete serialized, call | |
| 47 // didSerializeDataForFrame with URL of current frame, data, data length and | |
| 48 // flag CurrentFrameIsNotFinished. | |
| 49 // If current frame is complete serialized, call didSerializeDataForFrame | |
| 50 // with URL of current frame, data, data length and flag | |
| 51 // CurrentFrameIsFinished. | |
| 52 // If all frames of page are complete serialized, call | |
| 53 // didSerializeDataForFrame with empty URL, empty data, 0 and flag | |
| 54 // AllFramesAreFinished. | |
| 55 enum PageSerializationStatus { | |
| 56 CurrentFrameIsNotFinished, | |
| 57 CurrentFrameIsFinished, | |
| 58 AllFramesAreFinished, | |
| 59 }; | |
| 60 | 45 |
| 61 // Receive the individual chunks of serialized and encoded data to be saved. | 46 // Called to notify WebPageSerializerClient that the next fragment of |
| 62 // The parameter frameURL specifies what frame the data belongs. The | 47 // the serialized frame is |data|. |
| 63 // parameter data contains the available data for saving. The parameter | 48 virtual void writeHtmlFragment(const WebCString& data) = 0; |
| 64 // status indicates the status of data serialization. | 49 |
| 65 virtual void didSerializeDataForFrame(const WebURL& frameURL, | 50 // Called to notify WebPageSerializerClient that the next fragment of |
| 66 const WebCString& data, | 51 // the serialized frame needs to be a local path corresponding to |
| 67 PageSerializationStatus status) = 0; | 52 // |subframe|. WebPageSerializerClient is responsible for mapping |
| 68 WebPageSerializerClient() { } | 53 // |subframe| to a local path and making sure it is properly escaped for |
| 54 // inclusion as a value of a double-quoted html attribute. |
| 55 virtual void writeLocalPathForSubframe(const WebFrame& subframe) = 0; |
| 56 |
| 57 // Called to notify WebPageSerializerClient that the next fragment of |
| 58 // the serialized frame needs to be a local path corresponding to |
| 59 // |savableResourceURL|. WebPageSerializerClient is responsible for mapping |
| 60 // |savableResourceURL| to a local path and making sure it is properly |
| 61 // escaped for inclusion as a value of a double-quoted html attribute. |
| 62 virtual void writeLocalPathForSavableResource( |
| 63 const WebURL& savableResourceURL) = 0; |
| 64 |
| 65 // Called to notify WebPageSerializerClient that serialization of |
| 66 // the frame has finished (i.e. there is no more data). |
| 67 virtual void endOfFrame() = 0; |
| 69 | 68 |
| 70 protected: | 69 protected: |
| 71 virtual ~WebPageSerializerClient() { } | 70 virtual ~WebPageSerializerClient() { } |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 } // namespace blink | 73 } // namespace blink |
| 75 | 74 |
| 76 #endif | 75 #endif |
| OLD | NEW |