| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 3 Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 4 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 4 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 5 | 5 |
| 6 This library is free software; you can redistribute it and/or | 6 This library is free software; you can redistribute it and/or |
| 7 modify it under the terms of the GNU Library General Public | 7 modify it under the terms of the GNU Library General Public |
| 8 License as published by the Free Software Foundation; either | 8 License as published by the Free Software Foundation; either |
| 9 version 2 of the License, or (at your option) any later version. | 9 version 2 of the License, or (at your option) any later version. |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #ifndef TextResourceDecoder_h | 23 #ifndef TextResourceDecoder_h |
| 24 #define TextResourceDecoder_h | 24 #define TextResourceDecoder_h |
| 25 | 25 |
| 26 #include "wtf/RefCounted.h" | 26 #include "wtf/RefCounted.h" |
| 27 #include "wtf/text/TextEncoding.h" | 27 #include "wtf/text/TextEncoding.h" |
| 28 | 28 |
| 29 namespace WebCore { | 29 namespace WebCore { |
| 30 | 30 |
| 31 class HTMLMetaCharsetParser; | 31 class HTMLMetaCharsetParser; |
| 32 | 32 |
| 33 class TextResourceDecoder : public RefCounted<TextResourceDecoder> { | 33 class TextResourceDecoder { |
| 34 public: | 34 public: |
| 35 enum EncodingSource { | 35 enum EncodingSource { |
| 36 DefaultEncoding, | 36 DefaultEncoding, |
| 37 AutoDetectedEncoding, | 37 AutoDetectedEncoding, |
| 38 EncodingFromContentSniffing, | 38 EncodingFromContentSniffing, |
| 39 EncodingFromXMLHeader, | 39 EncodingFromXMLHeader, |
| 40 EncodingFromMetaTag, | 40 EncodingFromMetaTag, |
| 41 EncodingFromCSSCharset, | 41 EncodingFromCSSCharset, |
| 42 EncodingFromHTTPHeader, | 42 EncodingFromHTTPHeader, |
| 43 UserChosenEncoding, | 43 UserChosenEncoding, |
| 44 EncodingFromParentFrame | 44 EncodingFromParentFrame |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 static PassRefPtr<TextResourceDecoder> create(const String& mimeType, const
WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetec
tor = false) | 47 static PassOwnPtr<TextResourceDecoder> create(const String& mimeType, const
WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetec
tor = false) |
| 48 { | 48 { |
| 49 return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding, usesE
ncodingDetector)); | 49 return adoptPtr(new TextResourceDecoder(mimeType, defaultEncoding, usesE
ncodingDetector)); |
| 50 } | 50 } |
| 51 ~TextResourceDecoder(); | 51 ~TextResourceDecoder(); |
| 52 | 52 |
| 53 void setEncoding(const WTF::TextEncoding&, EncodingSource); | 53 void setEncoding(const WTF::TextEncoding&, EncodingSource); |
| 54 const WTF::TextEncoding& encoding() const { return m_encoding; } | 54 const WTF::TextEncoding& encoding() const { return m_encoding; } |
| 55 bool encodingWasDetectedHeuristically() const | 55 bool encodingWasDetectedHeuristically() const |
| 56 { | 56 { |
| 57 return m_source == AutoDetectedEncoding | 57 return m_source == AutoDetectedEncoding |
| 58 || m_source == EncodingFromContentSniffing; | 58 || m_source == EncodingFromContentSniffing; |
| 59 } | 59 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors. | 96 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors. |
| 97 bool m_sawError; | 97 bool m_sawError; |
| 98 bool m_usesEncodingDetector; | 98 bool m_usesEncodingDetector; |
| 99 | 99 |
| 100 OwnPtr<HTMLMetaCharsetParser> m_charsetParser; | 100 OwnPtr<HTMLMetaCharsetParser> m_charsetParser; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } | 103 } |
| 104 | 104 |
| 105 #endif | 105 #endif |
| OLD | NEW |