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

Unified Diff: third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h

Issue 2655203002: Merge "Pass more hints to encoding detector." to M57 branch (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
index f1fc9b62cd49f5277f6e2b477d8925d34f912862..a7cc4e80f682d482ff2e5e4cacdff3092f3e739e 100644
--- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
+++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
@@ -50,18 +50,24 @@ class CORE_EXPORT TextResourceDecoder {
static std::unique_ptr<TextResourceDecoder> create(
const String& mimeType,
- const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(),
- bool usesEncodingDetector = false) {
+ const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding()) {
return WTF::wrapUnique(new TextResourceDecoder(
- mimeType, defaultEncoding, usesEncodingDetector
- ? UseAllAutoDetection
- : UseContentAndBOMBasedDetection));
+ mimeType, defaultEncoding, UseContentAndBOMBasedDetection, String()));
}
+
+ static std::unique_ptr<TextResourceDecoder> createWithAutoDetection(
+ const String& mimeType,
+ const WTF::TextEncoding& defaultEncoding,
+ const String& url) {
+ return WTF::wrapUnique(new TextResourceDecoder(mimeType, defaultEncoding,
+ UseAllAutoDetection, url));
+ }
+
// Corresponds to utf-8 decode in Encoding spec:
// https://encoding.spec.whatwg.org/#utf-8-decode.
static std::unique_ptr<TextResourceDecoder> createAlwaysUseUTF8ForText() {
- return WTF::wrapUnique(new TextResourceDecoder("plain/text", UTF8Encoding(),
- AlwaysUseUTF8ForText));
+ return WTF::wrapUnique(new TextResourceDecoder(
+ "plain/text", UTF8Encoding(), AlwaysUseUTF8ForText, String()));
}
~TextResourceDecoder();
@@ -106,7 +112,8 @@ class CORE_EXPORT TextResourceDecoder {
TextResourceDecoder(const String& mimeType,
const WTF::TextEncoding& defaultEncoding,
- EncodingDetectionOption);
+ EncodingDetectionOption,
+ const String& url);
private:
enum ContentType {
@@ -130,7 +137,9 @@ class CORE_EXPORT TextResourceDecoder {
std::unique_ptr<TextCodec> m_codec;
EncodingSource m_source;
const char* m_hintEncoding;
+ const CString m_hintUrl;
Vector<char> m_buffer;
+ char m_hintLanguage[3];
bool m_checkedForBOM;
bool m_checkedForCSSCharset;
bool m_checkedForXMLCharset;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698