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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "components/google/core/browser/google_util.h" | 9 #include "components/google/core/browser/google_util.h" |
10 #include "components/url_formatter/elide_url.h" | 10 #include "components/url_formatter/elide_url.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return false; | 81 return false; |
82 return google_util::IsGoogleSearchUrl(gurl); | 82 return google_util::IsGoogleSearchUrl(gurl); |
83 } | 83 } |
84 | 84 |
85 static ScopedJavaLocalRef<jstring> FormatUrlForSecurityDisplay( | 85 static ScopedJavaLocalRef<jstring> FormatUrlForSecurityDisplay( |
86 JNIEnv* env, | 86 JNIEnv* env, |
87 const JavaParamRef<jclass>& clazz, | 87 const JavaParamRef<jclass>& clazz, |
88 const JavaParamRef<jstring>& url) { | 88 const JavaParamRef<jstring>& url) { |
89 return base::android::ConvertUTF16ToJavaString( | 89 return base::android::ConvertUTF16ToJavaString( |
90 env, url_formatter::FormatUrlForSecurityDisplay( | 90 env, url_formatter::FormatUrlForSecurityDisplay( |
91 ConvertJavaStringToGURL(env, url), std::string())); | 91 ConvertJavaStringToGURL(env, url))); |
92 } | 92 } |
93 | 93 |
94 static ScopedJavaLocalRef<jstring> FormatUrlForSecurityDisplayOmitScheme( | 94 static ScopedJavaLocalRef<jstring> FormatUrlForSecurityDisplayOmitScheme( |
95 JNIEnv* env, | 95 JNIEnv* env, |
96 const JavaParamRef<jclass>& clazz, | 96 const JavaParamRef<jclass>& clazz, |
97 const JavaParamRef<jstring>& url) { | 97 const JavaParamRef<jstring>& url) { |
98 return base::android::ConvertUTF16ToJavaString( | 98 return base::android::ConvertUTF16ToJavaString( |
99 env, url_formatter::FormatUrlForSecurityDisplayOmitScheme( | 99 env, url_formatter::FormatUrlForSecurityDisplayOmitScheme( |
100 ConvertJavaStringToGURL(env, url), std::string())); | 100 ConvertJavaStringToGURL(env, url))); |
101 } | 101 } |
102 | 102 |
103 static jboolean IsGoogleHomePageUrl(JNIEnv* env, | 103 static jboolean IsGoogleHomePageUrl(JNIEnv* env, |
104 const JavaParamRef<jclass>& clazz, | 104 const JavaParamRef<jclass>& clazz, |
105 const JavaParamRef<jstring>& url) { | 105 const JavaParamRef<jstring>& url) { |
106 GURL gurl = ConvertJavaStringToGURL(env, url); | 106 GURL gurl = ConvertJavaStringToGURL(env, url); |
107 if (gurl.is_empty()) | 107 if (gurl.is_empty()) |
108 return false; | 108 return false; |
109 return google_util::IsGoogleHomePageUrl(gurl); | 109 return google_util::IsGoogleHomePageUrl(gurl); |
110 } | 110 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return !gurl2.is_empty(); | 153 return !gurl2.is_empty(); |
154 if (!gurl.is_valid() || !gurl2.is_valid()) | 154 if (!gurl.is_valid() || !gurl2.is_valid()) |
155 return true; | 155 return true; |
156 return gurl.ref() != gurl2.ref(); | 156 return gurl.ref() != gurl2.ref(); |
157 } | 157 } |
158 | 158 |
159 // Register native methods | 159 // Register native methods |
160 bool RegisterUrlUtilities(JNIEnv* env) { | 160 bool RegisterUrlUtilities(JNIEnv* env) { |
161 return RegisterNativesImpl(env); | 161 return RegisterNativesImpl(env); |
162 } | 162 } |
OLD | NEW |