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

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

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « ui/base/l10n/l10n_util.cc ('k') | ui/base/l10n/time_format.cc » ('j') | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Common prototype of ICU uloc_getXXX() functions. 42 // Common prototype of ICU uloc_getXXX() functions.
43 typedef int32_t (*UlocGetComponentFunc)(const char*, char*, int32_t, 43 typedef int32_t (*UlocGetComponentFunc)(const char*, char*, int32_t,
44 UErrorCode*); 44 UErrorCode*);
45 45
46 std::string GetLocaleComponent(const std::string& locale, 46 std::string GetLocaleComponent(const std::string& locale,
47 UlocGetComponentFunc uloc_func, 47 UlocGetComponentFunc uloc_func,
48 int32_t max_capacity) { 48 int32_t max_capacity) {
49 std::string result; 49 std::string result;
50 UErrorCode error = U_ZERO_ERROR; 50 UErrorCode error = U_ZERO_ERROR;
51 int32_t actual_length = uloc_func(locale.c_str(), 51 int32_t actual_length = uloc_func(locale.c_str(),
52 WriteInto(&result, max_capacity), 52 base::WriteInto(&result, max_capacity),
53 max_capacity, 53 max_capacity,
54 &error); 54 &error);
55 DCHECK(U_SUCCESS(error)); 55 DCHECK(U_SUCCESS(error));
56 DCHECK(actual_length < max_capacity); 56 DCHECK(actual_length < max_capacity);
57 result.resize(actual_length); 57 result.resize(actual_length);
58 return result; 58 return result;
59 } 59 }
60 60
61 ScopedJavaLocalRef<jobject> NewJavaLocale( 61 ScopedJavaLocalRef<jobject> NewJavaLocale(
62 JNIEnv* env, 62 JNIEnv* env,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ui::TimeFormat::FORMAT_REMAINING, ui::TimeFormat::LENGTH_SHORT, 100 ui::TimeFormat::FORMAT_REMAINING, ui::TimeFormat::LENGTH_SHORT,
101 base::TimeDelta::FromMilliseconds(timeInMillis))); 101 base::TimeDelta::FromMilliseconds(timeInMillis)));
102 return jtime_remaining.Release(); 102 return jtime_remaining.Release();
103 } 103 }
104 104
105 bool RegisterLocalizationUtil(JNIEnv* env) { 105 bool RegisterLocalizationUtil(JNIEnv* env) {
106 return RegisterNativesImpl(env); 106 return RegisterNativesImpl(env);
107 } 107 }
108 108
109 } // namespace l10n_util 109 } // namespace l10n_util
OLDNEW
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | ui/base/l10n/time_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698