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 | |
56 private: | 51 private: |
57 HTMLMetaCharsetParser(); | 52 HTMLMetaCharsetParser(); |
58 | 53 |
59 bool processMeta(); | 54 bool processMeta(); |
60 static String extractCharset(const String&); | |
61 | |
62 enum Mode { | |
63 None, | |
64 Charset, | |
65 Pragma, | |
66 }; | |
67 | 55 |
68 OwnPtr<HTMLTokenizer> m_tokenizer; | 56 OwnPtr<HTMLTokenizer> m_tokenizer; |
69 OwnPtr<TextCodec> m_assumedCodec; | 57 OwnPtr<TextCodec> m_assumedCodec; |
70 SegmentedString m_input; | 58 SegmentedString m_input; |
71 HTMLToken m_token; | 59 HTMLToken m_token; |
72 bool m_inHeadSection; | 60 bool m_inHeadSection; |
73 | 61 |
74 bool m_doneChecking; | 62 bool m_doneChecking; |
75 WTF::TextEncoding m_encoding; | 63 WTF::TextEncoding m_encoding; |
76 }; | 64 }; |
77 | 65 |
78 } | 66 } |
79 #endif | 67 #endif |
OLD | NEW |