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

Side by Side Diff: ui/base/l10n/l10n_util_android.cc

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « sync/android/model_type_helper.cc ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/base/l10n/l10n_util_android.h" 5 #include "ui/base/l10n/l10n_util_android.h"
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 "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 NewJavaLocale(env, display_locale); 85 NewJavaLocale(env, display_locale);
86 86
87 ScopedJavaLocalRef<jstring> java_result( 87 ScopedJavaLocalRef<jstring> java_result(
88 Java_LocalizationUtils_getDisplayNameForLocale( 88 Java_LocalizationUtils_getDisplayNameForLocale(
89 env, 89 env,
90 java_locale.obj(), 90 java_locale.obj(),
91 java_display_locale.obj())); 91 java_display_locale.obj()));
92 return ConvertJavaStringToUTF16(java_result); 92 return ConvertJavaStringToUTF16(java_result);
93 } 93 }
94 94
95 ScopedJavaLocalRef<jstring> GetDurationString(JNIEnv* env, 95 jstring GetDurationString(JNIEnv* env, jclass clazz, jlong timeInMillis) {
96 jclass clazz,
97 jlong timeInMillis) {
98 ScopedJavaLocalRef<jstring> jtime_remaining = 96 ScopedJavaLocalRef<jstring> jtime_remaining =
99 base::android::ConvertUTF16ToJavaString( 97 base::android::ConvertUTF16ToJavaString(
100 env, 98 env,
101 ui::TimeFormat::Simple( 99 ui::TimeFormat::Simple(
102 ui::TimeFormat::FORMAT_REMAINING, ui::TimeFormat::LENGTH_SHORT, 100 ui::TimeFormat::FORMAT_REMAINING, ui::TimeFormat::LENGTH_SHORT,
103 base::TimeDelta::FromMilliseconds(timeInMillis))); 101 base::TimeDelta::FromMilliseconds(timeInMillis)));
104 return jtime_remaining; 102 return jtime_remaining.Release();
105 } 103 }
106 104
107 bool RegisterLocalizationUtil(JNIEnv* env) { 105 bool RegisterLocalizationUtil(JNIEnv* env) {
108 return RegisterNativesImpl(env); 106 return RegisterNativesImpl(env);
109 } 107 }
110 108
111 } // namespace l10n_util 109 } // namespace l10n_util
OLDNEW
« no previous file with comments | « sync/android/model_type_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698