OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010. Adam Barth. All rights reserved. | 2 * Copyright (C) 2010. Adam Barth. 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 27 matching lines...) Expand all Loading... |
38 class Document; | 38 class Document; |
39 class DocumentParser; | 39 class DocumentParser; |
40 class Frame; | 40 class Frame; |
41 class KURL; | 41 class KURL; |
42 class SecurityOrigin; | 42 class SecurityOrigin; |
43 class TextResourceDecoder; | 43 class TextResourceDecoder; |
44 | 44 |
45 class DocumentWriter : public RefCounted<DocumentWriter> { | 45 class DocumentWriter : public RefCounted<DocumentWriter> { |
46 WTF_MAKE_NONCOPYABLE(DocumentWriter); | 46 WTF_MAKE_NONCOPYABLE(DocumentWriter); |
47 public: | 47 public: |
48 static PassRefPtr<DocumentWriter> create(Document*, const String& mimeType =
"", const String& encoding = "", bool encodingUserChoosen = false); | 48 static PassRefPtr<DocumentWriter> create(Document*, const AtomicString& mime
Type = emptyAtom, const AtomicString& encoding = emptyAtom, bool encodingUserCho
osen = false); |
49 | 49 |
50 ~DocumentWriter(); | 50 ~DocumentWriter(); |
51 | 51 |
52 void end(); | 52 void end(); |
53 | 53 |
54 // This is only called by ScriptController::executeScriptIfJavaScriptURL | 54 // This is only called by ScriptController::executeScriptIfJavaScriptURL |
55 // and always contains the result of evaluating a javascript: url. | 55 // and always contains the result of evaluating a javascript: url. |
56 void replaceDocument(const String&, Document* ownerDocument); | 56 void replaceDocument(const String&, Document* ownerDocument); |
57 | 57 |
58 void addData(const char* bytes, size_t length); | 58 void addData(const char* bytes, size_t length); |
59 | 59 |
60 const String& mimeType() const { return m_decoderBuilder.mimeType(); } | 60 const AtomicString& mimeType() const { return m_decoderBuilder.mimeType(); } |
61 const String& encoding() const { return m_decoderBuilder.encoding(); } | 61 const AtomicString& encoding() const { return m_decoderBuilder.encoding(); } |
62 bool encodingWasChosenByUser() const { return m_decoderBuilder.encodingWasCh
osenByUser(); } | 62 bool encodingWasChosenByUser() const { return m_decoderBuilder.encodingWasCh
osenByUser(); } |
63 | 63 |
64 // Exposed for DocumentLoader::replaceDocument. | 64 // Exposed for DocumentLoader::replaceDocument. |
65 void appendReplacingData(const String&); | 65 void appendReplacingData(const String&); |
66 | 66 |
67 void setUserChosenEncoding(const String& charset); | 67 void setUserChosenEncoding(const String& charset); |
68 | 68 |
69 void setDocumentWasLoadedAsPartOfNavigation(); | 69 void setDocumentWasLoadedAsPartOfNavigation(); |
70 | 70 |
71 private: | 71 private: |
72 DocumentWriter(Document*, const String& mimeType, const String& encoding, bo
ol encodingUserChoosen); | 72 DocumentWriter(Document*, const AtomicString& mimeType, const AtomicString&
encoding, bool encodingUserChoosen); |
73 | 73 |
74 PassRefPtr<Document> createDocument(const KURL&); | 74 PassRefPtr<Document> createDocument(const KURL&); |
75 | 75 |
76 Document* m_document; | 76 Document* m_document; |
77 TextResourceDecoderBuilder m_decoderBuilder; | 77 TextResourceDecoderBuilder m_decoderBuilder; |
78 | 78 |
79 RefPtr<DocumentParser> m_parser; | 79 RefPtr<DocumentParser> m_parser; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace WebCore | 82 } // namespace WebCore |
83 | 83 |
84 #endif // DocumentWriter_h | 84 #endif // DocumentWriter_h |
OLD | NEW |