| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/android/jni_android.h" | 5 #include "base/android/jni_android.h" |
| 6 #include "base/android/jni_string.h" | 6 #include "base/android/jni_string.h" |
| 7 #include "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "chrome/common/net/url_fixer_upper.h" | 8 #include "components/url_fixer/url_fixer.h" |
| 9 #include "jni/UrlUtilities_jni.h" | 9 #include "jni/UrlUtilities_jni.h" |
| 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 using base::android::ConvertJavaStringToUTF8; | 13 using base::android::ConvertJavaStringToUTF8; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 net::registry_controlled_domains::PrivateRegistryFilter GetRegistryFilter( | 17 net::registry_controlled_domains::PrivateRegistryFilter GetRegistryFilter( |
| 18 jboolean include_private) { | 18 jboolean include_private) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 GURL gurl = GURL(ConvertJavaStringToUTF8(env, url)); | 67 GURL gurl = GURL(ConvertJavaStringToUTF8(env, url)); |
| 68 if (gurl.is_empty()) | 68 if (gurl.is_empty()) |
| 69 return false; | 69 return false; |
| 70 return google_util::IsGoogleHomePageUrl(gurl); | 70 return google_util::IsGoogleHomePageUrl(gurl); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static jstring FixupUrl(JNIEnv* env, | 73 static jstring FixupUrl(JNIEnv* env, |
| 74 jclass clazz, | 74 jclass clazz, |
| 75 jstring url, | 75 jstring url, |
| 76 jstring desired_tld) { | 76 jstring desired_tld) { |
| 77 GURL fixed_url = URLFixerUpper::FixupURL( | 77 GURL fixed_url = url_fixer::FixupURL( |
| 78 base::android::ConvertJavaStringToUTF8(env, url), | 78 base::android::ConvertJavaStringToUTF8(env, url), |
| 79 base::android::ConvertJavaStringToUTF8(env, desired_tld)); | 79 base::android::ConvertJavaStringToUTF8(env, desired_tld)); |
| 80 | 80 |
| 81 | |
| 82 return fixed_url.is_valid() ? | 81 return fixed_url.is_valid() ? |
| 83 base::android::ConvertUTF8ToJavaString(env, fixed_url.spec()).Release() : | 82 base::android::ConvertUTF8ToJavaString(env, fixed_url.spec()).Release() : |
| 84 NULL; | 83 NULL; |
| 85 } | 84 } |
| 86 | 85 |
| 87 // Register native methods | 86 // Register native methods |
| 88 bool RegisterUrlUtilities(JNIEnv* env) { | 87 bool RegisterUrlUtilities(JNIEnv* env) { |
| 89 return RegisterNativesImpl(env); | 88 return RegisterNativesImpl(env); |
| 90 } | 89 } |
| OLD | NEW |