Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: third_party/WebKit/WebCore/loader/TextResourceDecoder.h

Issue 39293: WebKit merge 41447:41498 [third_party/WebKit] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove CRLF Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding, usesE ncodingDetector, hintDecoder)); 45 return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding, usesE ncodingDetector, hintDecoder));
46 } 46 }
47 ~TextResourceDecoder(); 47 ~TextResourceDecoder();
48 48
49 void setEncoding(const TextEncoding&, EncodingSource); 49 void setEncoding(const TextEncoding&, EncodingSource);
50 const TextEncoding& encoding() const { return m_decoder.encoding(); } 50 const TextEncoding& encoding() const { return m_decoder.encoding(); }
51 51
52 String decode(const char* data, size_t length); 52 String decode(const char* data, size_t length);
53 String flush(); 53 String flush();
54 54
55 void useLenientXMLDecoding() { m_useLenientXMLDecoding = true; }
55 bool sawError() const { return m_sawError; } 56 bool sawError() const { return m_sawError; }
56 57
57 EncodingSource source() const { return m_source; } 58 EncodingSource source() const { return m_source; }
58 59
59 private: 60 private:
60 TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncod ing, bool usesEncodingDetector = false, const TextResourceDecoder* hintDecoder = NULL); 61 TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncod ing, bool usesEncodingDetector = false, const TextResourceDecoder* hintDecoder = NULL);
61 62
62 enum ContentType { PlainText, HTML, XML, CSS }; // PlainText is equivalent t o directly using TextDecoder. 63 enum ContentType { PlainText, HTML, XML, CSS }; // PlainText is equivalent t o directly using TextDecoder.
63 static ContentType determineContentType(const String& mimeType); 64 static ContentType determineContentType(const String& mimeType);
64 static const TextEncoding& defaultEncoding(ContentType, const TextEncoding& defaultEncoding); 65 static const TextEncoding& defaultEncoding(ContentType, const TextEncoding& defaultEncoding);
65 66
66 void checkForBOM(const char*, size_t); 67 void checkForBOM(const char*, size_t);
67 bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer); 68 bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
68 bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer); 69 bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer);
69 void detectJapaneseEncoding(const char*, size_t); 70 void detectJapaneseEncoding(const char*, size_t);
70 void detectEncoding(const char*, size_t); 71 void detectEncoding(const char*, size_t);
71 72
72 ContentType m_contentType; 73 ContentType m_contentType;
73 TextDecoder m_decoder; 74 TextDecoder m_decoder;
74 const TextResourceDecoder* m_hintDecoder; 75 const TextResourceDecoder* m_hintDecoder;
75 EncodingSource m_source; 76 EncodingSource m_source;
76 Vector<char> m_buffer; 77 Vector<char> m_buffer;
77 bool m_checkedForBOM; 78 bool m_checkedForBOM;
78 bool m_checkedForCSSCharset; 79 bool m_checkedForCSSCharset;
79 bool m_checkedForHeadCharset; 80 bool m_checkedForHeadCharset;
81 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors.
80 bool m_sawError; 82 bool m_sawError;
81 bool m_usesEncodingDetector; 83 bool m_usesEncodingDetector;
82 }; 84 };
83 85
84 } 86 }
85 87
86 #endif 88 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/loader/FrameLoader.cpp ('k') | third_party/WebKit/WebCore/loader/TextResourceDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698