Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "components/dom_distiller/core/url_utils_android.h" | 5 #include "components/dom_distiller/core/url_utils_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "components/dom_distiller/core/url_utils.h" | 10 #include "components/dom_distiller/core/url_utils.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 return NULL; | 27 return NULL; |
| 28 } | 28 } |
| 29 GURL view_url = | 29 GURL view_url = |
| 30 dom_distiller::url_utils::GetDistillerViewUrlFromUrl(scheme, url); | 30 dom_distiller::url_utils::GetDistillerViewUrlFromUrl(scheme, url); |
| 31 if (!view_url.is_valid()) { | 31 if (!view_url.is_valid()) { |
| 32 return NULL; | 32 return NULL; |
| 33 } | 33 } |
| 34 return base::android::ConvertUTF8ToJavaString(env, view_url.spec()).Release(); | 34 return base::android::ConvertUTF8ToJavaString(env, view_url.spec()).Release(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 jboolean IsReportableUrl(JNIEnv* env, | |
| 38 jclass clazz, | |
| 39 jstring j_scheme, | |
| 40 jstring j_url) { | |
| 41 std::string scheme(base::android::ConvertJavaStringToUTF8(env, j_scheme)); | |
| 42 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); | |
| 43 if (!url.is_valid()) { | |
|
nyquist
2014/03/31 23:08:25
Could you move this last part to the normal url ut
Sungmann Cho
2014/04/01 07:51:39
Done.
| |
| 44 return false; | |
| 45 } | |
| 46 return url.scheme() == scheme; | |
| 47 } | |
| 48 | |
| 37 bool RegisterUrlUtils(JNIEnv* env) { return RegisterNativesImpl(env); } | 49 bool RegisterUrlUtils(JNIEnv* env) { return RegisterNativesImpl(env); } |
| 38 | 50 |
| 39 } // namespace android | 51 } // namespace android |
| 40 | 52 |
| 41 } // namespace url_utils | 53 } // namespace url_utils |
| 42 | 54 |
| 43 } // namespace dom_distiller | 55 } // namespace dom_distiller |
| OLD | NEW |