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

Side by Side Diff: chrome/browser/android/url_utilities.cc

Issue 54513003: Export "Enter URL..." string to Android Java side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "jni/UrlUtilities_jni.h" 9 #include "jni/UrlUtilities_jni.h"
9 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
10 #include "url/gurl.h" 11 #include "url/gurl.h"
11 12
12 using base::android::ConvertJavaStringToUTF8; 13 using base::android::ConvertJavaStringToUTF8;
13 14
14 namespace { 15 namespace {
15 16
16 net::registry_controlled_domains::PrivateRegistryFilter GetRegistryFilter( 17 net::registry_controlled_domains::PrivateRegistryFilter GetRegistryFilter(
17 jboolean include_private) { 18 jboolean include_private) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return google_util::IsGoogleSearchUrl(gurl); 63 return google_util::IsGoogleSearchUrl(gurl);
63 } 64 }
64 65
65 static jboolean IsGoogleHomePageUrl(JNIEnv* env, jclass clazz, jstring url) { 66 static jboolean IsGoogleHomePageUrl(JNIEnv* env, jclass clazz, jstring url) {
66 GURL gurl = GURL(ConvertJavaStringToUTF8(env, url)); 67 GURL gurl = GURL(ConvertJavaStringToUTF8(env, url));
67 if (gurl.is_empty()) 68 if (gurl.is_empty())
68 return false; 69 return false;
69 return google_util::IsGoogleHomePageUrl(gurl); 70 return google_util::IsGoogleHomePageUrl(gurl);
70 } 71 }
71 72
73 static jstring FixupUrl(JNIEnv* env,
74 jclass clazz,
75 jstring url,
76 jstring desired_tld) {
77 GURL fixed_url = URLFixerUpper::FixupURL(
78 base::android::ConvertJavaStringToUTF8(env, url),
79 base::android::ConvertJavaStringToUTF8(env, desired_tld));
80
81 return base::android::ConvertUTF8ToJavaString(env, fixed_url.spec())
82 .Release();
83 }
84
72 // Register native methods 85 // Register native methods
73 bool RegisterUrlUtilities(JNIEnv* env) { 86 bool RegisterUrlUtilities(JNIEnv* env) {
74 return RegisterNativesImpl(env); 87 return RegisterNativesImpl(env);
75 } 88 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698