| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #ifndef HTMLViewSourceParser_h | 26 #ifndef HTMLViewSourceParser_h |
| 27 #define HTMLViewSourceParser_h | 27 #define HTMLViewSourceParser_h |
| 28 | 28 |
| 29 #include "core/dom/DecodedDataDocumentParser.h" | 29 #include "core/dom/DecodedDataDocumentParser.h" |
| 30 #include "core/html/HTMLViewSourceDocument.h" | 30 #include "core/html/HTMLViewSourceDocument.h" |
| 31 #include "core/html/parser/HTMLInputStream.h" | 31 #include "core/html/parser/HTMLInputStream.h" |
| 32 #include "core/html/parser/HTMLSourceTracker.h" | 32 #include "core/html/parser/HTMLSourceTracker.h" |
| 33 #include "core/html/parser/HTMLTokenizer.h" | 33 #include "core/html/parser/HTMLTokenizer.h" |
| 34 #include "core/html/parser/XSSAuditor.h" | 34 #include "core/html/parser/XSSAuditor.h" |
| 35 #include <memory> | |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 class HTMLViewSourceParser final : public DecodedDataDocumentParser { | 38 class HTMLViewSourceParser final : public DecodedDataDocumentParser { |
| 40 public: | 39 public: |
| 41 static HTMLViewSourceParser* create(HTMLViewSourceDocument& document, const
String& mimeType) | 40 static HTMLViewSourceParser* create(HTMLViewSourceDocument& document, const
String& mimeType) |
| 42 { | 41 { |
| 43 return new HTMLViewSourceParser(document, mimeType); | 42 return new HTMLViewSourceParser(document, mimeType); |
| 44 } | 43 } |
| 45 ~HTMLViewSourceParser() override { } | 44 ~HTMLViewSourceParser() override { } |
| 46 | 45 |
| 47 private: | 46 private: |
| 48 HTMLViewSourceParser(HTMLViewSourceDocument&, const String& mimeType); | 47 HTMLViewSourceParser(HTMLViewSourceDocument&, const String& mimeType); |
| 49 | 48 |
| 50 // DocumentParser | 49 // DocumentParser |
| 51 void insert(const SegmentedString&) override { ASSERT_NOT_REACHED(); } | 50 void insert(const SegmentedString&) override { ASSERT_NOT_REACHED(); } |
| 52 void append(const String&) override; | 51 void append(const String&) override; |
| 53 void finish() override; | 52 void finish() override; |
| 54 | 53 |
| 55 HTMLViewSourceDocument* document() const { return static_cast<HTMLViewSource
Document*>(DecodedDataDocumentParser::document()); } | 54 HTMLViewSourceDocument* document() const { return static_cast<HTMLViewSource
Document*>(DecodedDataDocumentParser::document()); } |
| 56 | 55 |
| 57 void pumpTokenizer(); | 56 void pumpTokenizer(); |
| 58 void updateTokenizerState(); | 57 void updateTokenizerState(); |
| 59 | 58 |
| 60 HTMLInputStream m_input; | 59 HTMLInputStream m_input; |
| 61 HTMLToken m_token; | 60 HTMLToken m_token; |
| 62 HTMLSourceTracker m_sourceTracker; | 61 HTMLSourceTracker m_sourceTracker; |
| 63 std::unique_ptr<HTMLTokenizer> m_tokenizer; | 62 OwnPtr<HTMLTokenizer> m_tokenizer; |
| 64 XSSAuditor m_xssAuditor; | 63 XSSAuditor m_xssAuditor; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace blink | 66 } // namespace blink |
| 68 | 67 |
| 69 #endif | 68 #endif |
| OLD | NEW |