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

Side by Side Diff: net/base/net_util.cc

Issue 1655: Fix IDNtoUnicode and unittest. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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
« no previous file with comments | « AUTHORS ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <unicode/ucnv.h> 6 #include <unicode/ucnv.h>
7 #include <unicode/uidna.h> 7 #include <unicode/uidna.h>
8 #include <unicode/ulocdata.h> 8 #include <unicode/ulocdata.h>
9 #include <unicode/uniset.h> 9 #include <unicode/uniset.h>
10 #include <unicode/uscript.h> 10 #include <unicode/uscript.h>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 USet *lang_set = uset_open(1, 0); // create an empty set 534 USet *lang_set = uset_open(1, 0); // create an empty set
535 UnicodeSet ascii_letters(0x61, 0x7a); // [a-z] 535 UnicodeSet ascii_letters(0x61, 0x7a); // [a-z]
536 bool safe = false; 536 bool safe = false;
537 std::string languages_list(WideToASCII(languages)); 537 std::string languages_list(WideToASCII(languages));
538 StringTokenizer t(languages_list, ","); 538 StringTokenizer t(languages_list, ",");
539 while (t.GetNext()) { 539 while (t.GetNext()) {
540 std::string lang = t.token(); 540 std::string lang = t.token();
541 status = U_ZERO_ERROR; 541 status = U_ZERO_ERROR;
542 // TODO(jungshik) Cache exemplar sets for locales. 542 // TODO(jungshik) Cache exemplar sets for locales.
543 ULocaleData* uld = ulocdata_open(lang.c_str(), &status); 543 ULocaleData* uld = ulocdata_open(lang.c_str(), &status);
544 if (U_SUCCESS(status)) { 544 // TODO(jungshik) Turn this check on when the ICU data file is
545 // rebuilt with the minimal subset of locale data for languages
546 // to which Chrome is not localized but which we offer in the list
547 // of languages selectable for Accept-Languages. With the rebuilt ICU
548 // data, ulocdata_open never should fall back to the default locale. (issue 2078)
549 // DCHECK(U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING);
550 if (U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING) {
545 // Should we use auxiliary set, instead? 551 // Should we use auxiliary set, instead?
546 ulocdata_getExemplarSet(uld, lang_set, 0, ULOCDATA_ES_STANDARD, &status); 552 ulocdata_getExemplarSet(uld, lang_set, 0, ULOCDATA_ES_STANDARD, &status);
547 ulocdata_close(uld); 553 ulocdata_close(uld);
548 if (U_SUCCESS(status)) { 554 if (U_SUCCESS(status)) {
549 UnicodeSet* allowed_characters = 555 UnicodeSet* allowed_characters =
550 reinterpret_cast<UnicodeSet*>(lang_set); 556 reinterpret_cast<UnicodeSet*>(lang_set);
551 // If |lang| is compatible with ASCII Latin letters, add them. 557 // If |lang| is compatible with ASCII Latin letters, add them.
552 if (IsCompatibleWithASCIILetters(lang)) 558 if (IsCompatibleWithASCIILetters(lang))
553 allowed_characters->addAll(ascii_letters); 559 allowed_characters->addAll(ascii_letters);
554 if (allowed_characters->containsAll(component_characters)) { 560 if (allowed_characters->containsAll(component_characters)) {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 for (int i = 0; i < array_size; i++) { 907 for (int i = 0; i < array_size; i++) {
902 if (kAllowedFtpPorts[i] == port) { 908 if (kAllowedFtpPorts[i] == port) {
903 return true; 909 return true;
904 } 910 }
905 } 911 }
906 // Port not explicitly allowed by FTP, so return the default restrictions. 912 // Port not explicitly allowed by FTP, so return the default restrictions.
907 return IsPortAllowedByDefault(port); 913 return IsPortAllowedByDefault(port);
908 } 914 }
909 915
910 } // namespace net 916 } // namespace net
911
OLDNEW
« no previous file with comments | « AUTHORS ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698