| 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 30 matching lines...) Expand all Loading... |
| 41 public: | 41 public: |
| 42 static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTML
MetaCharsetParser()); } | 42 static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTML
MetaCharsetParser()); } |
| 43 | 43 |
| 44 ~HTMLMetaCharsetParser(); | 44 ~HTMLMetaCharsetParser(); |
| 45 | 45 |
| 46 // Returns true if done checking, regardless whether an encoding is found. | 46 // Returns true if done checking, regardless whether an encoding is found. |
| 47 bool checkForMetaCharset(const char*, size_t); | 47 bool checkForMetaCharset(const char*, size_t); |
| 48 | 48 |
| 49 const WTF::TextEncoding& encoding() { return m_encoding; } | 49 const WTF::TextEncoding& encoding() { return m_encoding; } |
| 50 | 50 |
| 51 typedef Vector<pair<String, String> > AttributeList; |
| 52 // The returned encoding might not be valid. |
| 53 static WTF::TextEncoding encodingFromMetaAttributes(const AttributeList& |
| 54 ); |
| 55 |
| 51 private: | 56 private: |
| 52 HTMLMetaCharsetParser(); | 57 HTMLMetaCharsetParser(); |
| 53 | 58 |
| 54 bool processMeta(); | 59 bool processMeta(); |
| 60 static String extractCharset(const String&); |
| 61 |
| 62 enum Mode { |
| 63 None, |
| 64 Charset, |
| 65 Pragma, |
| 66 }; |
| 55 | 67 |
| 56 OwnPtr<HTMLTokenizer> m_tokenizer; | 68 OwnPtr<HTMLTokenizer> m_tokenizer; |
| 57 OwnPtr<TextCodec> m_assumedCodec; | 69 OwnPtr<TextCodec> m_assumedCodec; |
| 58 SegmentedString m_input; | 70 SegmentedString m_input; |
| 59 HTMLToken m_token; | 71 HTMLToken m_token; |
| 60 bool m_inHeadSection; | 72 bool m_inHeadSection; |
| 61 | 73 |
| 62 bool m_doneChecking; | 74 bool m_doneChecking; |
| 63 WTF::TextEncoding m_encoding; | 75 WTF::TextEncoding m_encoding; |
| 64 }; | 76 }; |
| 65 | 77 |
| 66 } | 78 } |
| 67 #endif | 79 #endif |
| OLD | NEW |