| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/chrome/browser/ui/util/i18n_string.h" | 5 #import "ios/chrome/browser/ui/util/i18n_string.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 | 10 |
| 11 NSString* AdjustStringForLocaleDirection(NSString* text) { | 11 NSString* AdjustStringForLocaleDirection(NSString* text) { |
| 12 base::string16 converted_text = base::SysNSStringToUTF16(text); | 12 base::string16 converted_text = base::SysNSStringToUTF16(text); |
| 13 bool has_changed = | 13 bool has_changed = |
| 14 base::i18n::AdjustStringForLocaleDirection(&converted_text); | 14 base::i18n::AdjustStringForLocaleDirection(&converted_text); |
| 15 if (has_changed) { | 15 if (has_changed) { |
| 16 return base::SysUTF16ToNSString(converted_text); | 16 return base::SysUTF16ToNSString(converted_text); |
| 17 } | 17 } |
| 18 return text; | 18 return [[text copy] autorelease]; |
| 19 } | 19 } |
| OLD | NEW |