| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 EncodingFromMetaTag, | 45 EncodingFromMetaTag, |
| 46 EncodingFromCSSCharset, | 46 EncodingFromCSSCharset, |
| 47 EncodingFromHTTPHeader, | 47 EncodingFromHTTPHeader, |
| 48 EncodingFromParentFrame | 48 EncodingFromParentFrame |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static std::unique_ptr<TextResourceDecoder> create( | 51 static std::unique_ptr<TextResourceDecoder> create( |
| 52 const String& mimeType, | 52 const String& mimeType, |
| 53 const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), | 53 const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), |
| 54 bool usesEncodingDetector = false) { | 54 bool usesEncodingDetector = false) { |
| 55 return wrapUnique(new TextResourceDecoder( | 55 return WTF::wrapUnique(new TextResourceDecoder( |
| 56 mimeType, defaultEncoding, usesEncodingDetector | 56 mimeType, defaultEncoding, usesEncodingDetector |
| 57 ? UseAllAutoDetection | 57 ? UseAllAutoDetection |
| 58 : UseContentAndBOMBasedDetection)); | 58 : UseContentAndBOMBasedDetection)); |
| 59 } | 59 } |
| 60 // Corresponds to utf-8 decode in Encoding spec: | 60 // Corresponds to utf-8 decode in Encoding spec: |
| 61 // https://encoding.spec.whatwg.org/#utf-8-decode. | 61 // https://encoding.spec.whatwg.org/#utf-8-decode. |
| 62 static std::unique_ptr<TextResourceDecoder> createAlwaysUseUTF8ForText() { | 62 static std::unique_ptr<TextResourceDecoder> createAlwaysUseUTF8ForText() { |
| 63 return wrapUnique(new TextResourceDecoder("plain/text", UTF8Encoding(), | 63 return WTF::wrapUnique(new TextResourceDecoder("plain/text", UTF8Encoding(), |
| 64 AlwaysUseUTF8ForText)); | 64 AlwaysUseUTF8ForText)); |
| 65 } | 65 } |
| 66 ~TextResourceDecoder(); | 66 ~TextResourceDecoder(); |
| 67 | 67 |
| 68 void setEncoding(const WTF::TextEncoding&, EncodingSource); | 68 void setEncoding(const WTF::TextEncoding&, EncodingSource); |
| 69 const WTF::TextEncoding& encoding() const { return m_encoding; } | 69 const WTF::TextEncoding& encoding() const { return m_encoding; } |
| 70 bool encodingWasDetectedHeuristically() const { | 70 bool encodingWasDetectedHeuristically() const { |
| 71 return m_source == AutoDetectedEncoding || | 71 return m_source == AutoDetectedEncoding || |
| 72 m_source == EncodingFromContentSniffing; | 72 m_source == EncodingFromContentSniffing; |
| 73 } | 73 } |
| 74 | 74 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors. | 138 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors. |
| 139 bool m_sawError; | 139 bool m_sawError; |
| 140 EncodingDetectionOption m_encodingDetectionOption; | 140 EncodingDetectionOption m_encodingDetectionOption; |
| 141 | 141 |
| 142 std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; | 142 std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace blink | 145 } // namespace blink |
| 146 | 146 |
| 147 #endif | 147 #endif |
| OLD | NEW |