Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #ifndef DecodedDataDocumentParser_h | 26 #ifndef DecodedDataDocumentParser_h |
| 27 #define DecodedDataDocumentParser_h | 27 #define DecodedDataDocumentParser_h |
| 28 | 28 |
| 29 #include "core/dom/DocumentParser.h" | 29 #include "core/dom/DocumentParser.h" |
| 30 #include "wtf/OwnPtr.h" | 30 #include "wtf/OwnPtr.h" |
| 31 #include "wtf/RefPtr.h" | 31 #include "wtf/RefPtr.h" |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 class TextResourceDecoder; | 34 class TextResourceDecoder; |
| 35 | 35 |
| 36 class DecodedDataDocumentParser : public DocumentParser { | 36 class DecodedDataDocumentParser : public DocumentParser { |
|
abarth-chromium
2013/11/18 17:32:24
I wonder if we should restructure how this class w
oystein (OOO til 10th of July)
2013/11/18 22:18:42
It's used by those two plus the HTMLViewSourcePars
| |
| 37 public: | 37 public: |
| 38 // Only used by the XMLDocumentParser to communicate back to | 38 // Only used by the XMLDocumentParser to communicate back to |
| 39 // XMLHttpRequest if the responseXML was well formed. | 39 // XMLHttpRequest if the responseXML was well formed. |
| 40 virtual bool wellFormed() const { return true; } | 40 virtual bool wellFormed() const { return true; } |
| 41 | 41 |
| 42 // The below functions are used by DocumentWriter (the loader). | 42 // The below functions are used by DocumentWriter (the loader). |
| 43 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE; | 43 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE; |
| 44 virtual void flush() OVERRIDE; | 44 virtual void flush() OVERRIDE; |
| 45 virtual bool needsDecoder() const OVERRIDE { return !m_decoder; } | 45 virtual bool needsDecoder() const OVERRIDE { return m_needsDecoder; } |
| 46 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) OVERRIDE; | 46 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) OVERRIDE; |
| 47 virtual TextResourceDecoder* decoder() OVERRIDE; | 47 virtual TextResourceDecoder* decoder() OVERRIDE; |
| 48 virtual void setHasAppendedData() OVERRIDE; | 48 virtual void setHasAppendedData() OVERRIDE; |
| 49 | 49 |
| 50 PassOwnPtr<TextResourceDecoder> adoptDecoder(); | |
| 51 | |
| 50 protected: | 52 protected: |
| 51 explicit DecodedDataDocumentParser(Document*); | 53 explicit DecodedDataDocumentParser(Document*); |
| 52 virtual ~DecodedDataDocumentParser(); | 54 virtual ~DecodedDataDocumentParser(); |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // append is used by DocumentWriter::replaceDocument. | 57 // append is used by DocumentWriter::replaceDocument. |
| 56 virtual void append(PassRefPtr<StringImpl>) = 0; | 58 virtual void append(PassRefPtr<StringImpl>) = 0; |
| 57 | 59 |
| 58 void updateDocument(String& decodedData); | 60 void updateDocument(String& decodedData); |
| 59 | 61 |
| 60 bool m_hasAppendedData; | 62 bool m_hasAppendedData; |
| 63 bool m_needsDecoder; | |
| 61 OwnPtr<TextResourceDecoder> m_decoder; | 64 OwnPtr<TextResourceDecoder> m_decoder; |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 } | 67 } |
| 65 | 68 |
| 66 #endif // DecodedDataDocumentParser_h | 69 #endif // DecodedDataDocumentParser_h |
| OLD | NEW |