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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentEncodingData.h

Issue 1456843002: Finch experiment: auto-detect text encoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 class DocumentEncodingData { 41 class DocumentEncodingData {
42 DISALLOW_NEW(); 42 DISALLOW_NEW();
43 public: 43 public:
44 DocumentEncodingData(); 44 DocumentEncodingData();
45 explicit DocumentEncodingData(const TextResourceDecoder&); 45 explicit DocumentEncodingData(const TextResourceDecoder&);
46 46
47 const WTF::TextEncoding& encoding() const { return m_encoding; } 47 const WTF::TextEncoding& encoding() const { return m_encoding; }
48 void setEncoding(const WTF::TextEncoding&); 48 void setEncoding(const WTF::TextEncoding&);
49 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; } 49 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; }
50 bool sawDecodingError() const { return m_sawDecodingError; } 50 bool sawDecodingError() const { return m_sawDecodingError; }
51 bool attemptedToDetermineEncodingFromContentSniffing() const { return m_atte mptedToDetermineEncodingFromContentSniffing; }
52 bool encodingWasDetectedFromContentSniffing() const { return m_encodingWasDe tectedFromContentSniffing; }
51 53
52 private: 54 private:
53 WTF::TextEncoding m_encoding; 55 WTF::TextEncoding m_encoding;
54 bool m_wasDetectedHeuristically; 56 bool m_wasDetectedHeuristically;
57 bool m_attemptedToDetermineEncodingFromContentSniffing;
58 bool m_encodingWasDetectedFromContentSniffing;
55 bool m_sawDecodingError; 59 bool m_sawDecodingError;
56 }; 60 };
57 61
58 template<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat a> : public CrossThreadCopierPassThrough<DocumentEncodingData> { 62 template<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat a> : public CrossThreadCopierPassThrough<DocumentEncodingData> {
59 }; 63 };
60 64
61 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData & b) 65 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData & b)
62 { 66 {
63 return a.encoding() != b.encoding() 67 return a.encoding() != b.encoding()
64 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() 68 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically()
69 || a.attemptedToDetermineEncodingFromContentSniffing() != b.attemptedToD etermineEncodingFromContentSniffing()
70 || a.encodingWasDetectedFromContentSniffing() != b.encodingWasDetectedFr omContentSniffing()
65 || a.sawDecodingError() != b.sawDecodingError(); 71 || a.sawDecodingError() != b.sawDecodingError();
66 } 72 }
67 73
68 } // namespace blink 74 } // namespace blink
69 75
70 #endif // DocumentEncodingData_h 76 #endif // DocumentEncodingData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698