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

Side by Side Diff: android/java/src/org/chromium/url/IDNStringUtil.java

Issue 2029803003: Update to Chromium //url at Chromium commit 79dc59ac7602413181079ecb463873e29a1d7d0a. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/gurl@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « BUILD.gn ('k') | gurl.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.url; 5 package org.chromium.url;
6 6
7 import org.chromium.base.CalledByNative; 7 import org.chromium.base.annotations.CalledByNative;
8 import org.chromium.base.JNINamespace; 8 import org.chromium.base.annotations.JNINamespace;
9 9
10 import java.net.IDN; 10 import java.net.IDN;
11 11
12 /** 12 /**
13 * This class is used to convert unicode IDN domain names to ASCII, when not 13 * This class is used to convert unicode IDN domain names to ASCII, when not
14 * building with ICU. 14 * building with ICU.
15 */ 15 */
16 @JNINamespace("url::android") 16 @JNINamespace("url::android")
17 public class IDNStringUtil { 17 public class IDNStringUtil {
18 /** 18 /**
19 * Attempts to convert a Unicode string to an ASCII string using IDN rules. 19 * Attempts to convert a Unicode string to an ASCII string using IDN rules.
20 * As of May 2014, the underlying Java function IDNA2003. 20 * As of May 2014, the underlying Java function IDNA2003.
21 * @param src String to convert. 21 * @param src String to convert.
22 * @return: String containing only ASCII characters on success, null on 22 * @return: String containing only ASCII characters on success, null on
23 * failure. 23 * failure.
24 */ 24 */
25 @CalledByNative 25 @CalledByNative
26 private static String idnToASCII(String src) { 26 private static String idnToASCII(String src) {
27 try { 27 try {
28 return IDN.toASCII(src, IDN.USE_STD3_ASCII_RULES); 28 return IDN.toASCII(src, IDN.USE_STD3_ASCII_RULES);
29 } catch (Exception e) { 29 } catch (Exception e) {
30 return null; 30 return null;
31 } 31 }
32 } 32 }
33 } 33 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | gurl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698