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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class Document; | 39 class Document; |
40 class DocumentParser; | 40 class DocumentParser; |
41 class LocalFrame; | 41 class LocalFrame; |
42 class KURL; | 42 class KURL; |
43 class SecurityOrigin; | 43 class SecurityOrigin; |
44 class TextResourceDecoder; | 44 class TextResourceDecoder; |
45 | 45 |
46 class DocumentWriter : public RefCounted<DocumentWriter> { | 46 class DocumentWriter : public RefCountedWillBeGarbageCollectedFinalized<Document
Writer> { |
47 WTF_MAKE_NONCOPYABLE(DocumentWriter); | 47 WTF_MAKE_NONCOPYABLE(DocumentWriter); |
48 public: | 48 public: |
49 static PassRefPtr<DocumentWriter> create(Document*, const AtomicString& mime
Type = emptyAtom, const AtomicString& encoding = emptyAtom, bool encodingUserCho
osen = false); | 49 static PassRefPtrWillBeRawPtr<DocumentWriter> create(Document*, const Atomic
String& mimeType = emptyAtom, const AtomicString& encoding = emptyAtom, bool enc
odingUserChoosen = false); |
50 | 50 |
51 ~DocumentWriter(); | 51 ~DocumentWriter(); |
| 52 void trace(Visitor*); |
52 | 53 |
53 void end(); | 54 void end(); |
54 | 55 |
55 // This is only called by ScriptController::executeScriptIfJavaScriptURL | 56 // This is only called by ScriptController::executeScriptIfJavaScriptURL |
56 // and always contains the result of evaluating a javascript: url. | 57 // and always contains the result of evaluating a javascript: url. |
57 void replaceDocument(const String&, Document* ownerDocument); | 58 void replaceDocument(const String&, Document* ownerDocument); |
58 | 59 |
59 void addData(const char* bytes, size_t length); | 60 void addData(const char* bytes, size_t length); |
60 | 61 |
61 const AtomicString& mimeType() const { return m_decoderBuilder.mimeType(); } | 62 const AtomicString& mimeType() const { return m_decoderBuilder.mimeType(); } |
62 const AtomicString& encoding() const { return m_decoderBuilder.encoding(); } | 63 const AtomicString& encoding() const { return m_decoderBuilder.encoding(); } |
63 bool encodingWasChosenByUser() const { return m_decoderBuilder.encodingWasCh
osenByUser(); } | 64 bool encodingWasChosenByUser() const { return m_decoderBuilder.encodingWasCh
osenByUser(); } |
64 | 65 |
65 // Exposed for DocumentLoader::replaceDocument. | 66 // Exposed for DocumentLoader::replaceDocument. |
66 void appendReplacingData(const String&); | 67 void appendReplacingData(const String&); |
67 | 68 |
68 void setUserChosenEncoding(const String& charset); | 69 void setUserChosenEncoding(const String& charset); |
69 | 70 |
70 void setDocumentWasLoadedAsPartOfNavigation(); | 71 void setDocumentWasLoadedAsPartOfNavigation(); |
71 | 72 |
72 private: | 73 private: |
73 DocumentWriter(Document*, const AtomicString& mimeType, const AtomicString&
encoding, bool encodingUserChoosen); | 74 DocumentWriter(Document*, const AtomicString& mimeType, const AtomicString&
encoding, bool encodingUserChoosen); |
74 | 75 |
75 PassRefPtr<Document> createDocument(const KURL&); | 76 RawPtrWillBeMember<Document> m_document; |
76 | |
77 Document* m_document; | |
78 TextResourceDecoderBuilder m_decoderBuilder; | 77 TextResourceDecoderBuilder m_decoderBuilder; |
79 | 78 |
80 RefPtrWillBePersistent<DocumentParser> m_parser; | 79 RefPtrWillBeMember<DocumentParser> m_parser; |
81 }; | 80 }; |
82 | 81 |
83 } // namespace WebCore | 82 } // namespace WebCore |
84 | 83 |
85 #endif // DocumentWriter_h | 84 #endif // DocumentWriter_h |
OLD | NEW |