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

Side by Side Diff: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 years, 1 month 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 {"ru", "windows-1251"}, {"se", "windows-1252"}, {"si", "ISO-8859-2"}, 70 {"ru", "windows-1251"}, {"se", "windows-1252"}, {"si", "ISO-8859-2"},
71 {"sk", "windows-1250"}, {"th", "windows-874"}, {"tr", "ISO-8859-9"}, 71 {"sk", "windows-1250"}, {"th", "windows-874"}, {"tr", "ISO-8859-9"},
72 {"tw", "Big5"}, {"tz", "windows-1252"}, {"ua", "windows-1251"}, 72 {"tw", "Big5"}, {"tz", "windows-1252"}, {"ua", "windows-1251"},
73 {"us", "windows-1252"}, {"vn", "windows-1258"}, {"xa", "windows-1252"}, 73 {"us", "windows-1252"}, {"vn", "windows-1258"}, {"xa", "windows-1252"},
74 {"xb", "windows-1257"}}; 74 {"xb", "windows-1257"}};
75 75
76 static const WTF::TextEncoding getEncodingFromDomain(const KURL& url) { 76 static const WTF::TextEncoding getEncodingFromDomain(const KURL& url) {
77 Vector<String> tokens; 77 Vector<String> tokens;
78 url.host().split(".", tokens); 78 url.host().split(".", tokens);
79 if (!tokens.isEmpty()) { 79 if (!tokens.isEmpty()) {
80 auto tld = tokens.last(); 80 auto tld = tokens.back();
81 for (size_t i = 0; i < WTF_ARRAY_LENGTH(encodings); i++) { 81 for (size_t i = 0; i < WTF_ARRAY_LENGTH(encodings); i++) {
82 if (tld == encodings[i].domain) 82 if (tld == encodings[i].domain)
83 return WTF::TextEncoding(encodings[i].encoding); 83 return WTF::TextEncoding(encodings[i].encoding);
84 } 84 }
85 } 85 }
86 return WTF::TextEncoding(); 86 return WTF::TextEncoding();
87 } 87 }
88 88
89 } // namespace 89 } // namespace
90 90
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 createDecoderInstance(document); 152 createDecoderInstance(document);
153 setupEncoding(decoder.get(), document); 153 setupEncoding(decoder.get(), document);
154 return decoder; 154 return decoder;
155 } 155 }
156 156
157 void TextResourceDecoderBuilder::clear() { 157 void TextResourceDecoderBuilder::clear() {
158 m_encoding = nullAtom; 158 m_encoding = nullAtom;
159 } 159 }
160 160
161 } // namespace blink 161 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698