| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 | 8 |
| 9 #include "app/app_paths.h" |
| 9 #include "app/app_switches.h" | 10 #include "app/app_switches.h" |
| 10 #include "app/gfx/canvas.h" | 11 #include "app/gfx/canvas.h" |
| 11 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 15 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 16 #include "base/string16.h" | 17 #include "base/string16.h" |
| 17 #include "base/string_piece.h" | 18 #include "base/string_piece.h" |
| 18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 19 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
| 20 #include "chrome/common/chrome_paths.h" | |
| 21 #include "unicode/uscript.h" | 21 #include "unicode/uscript.h" |
| 22 | 22 |
| 23 // TODO(playmobil): remove this undef once SkPostConfig.h is fixed. | 23 // TODO(playmobil): remove this undef once SkPostConfig.h is fixed. |
| 24 // skia/include/corecg/SkPostConfig.h #defines strcasecmp() so we can't use | 24 // skia/include/corecg/SkPostConfig.h #defines strcasecmp() so we can't use |
| 25 // base::strcasecmp() without #undefing it here. | 25 // base::strcasecmp() without #undefing it here. |
| 26 #undef strcasecmp | 26 #undef strcasecmp |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 std::wstring GetApplicationLocale(const std::wstring& pref_locale) { | 222 std::wstring GetApplicationLocale(const std::wstring& pref_locale) { |
| 223 #if defined(OS_MACOSX) | 223 #if defined(OS_MACOSX) |
| 224 // On the mac, we don't want to test preferences or ICU for the language, | 224 // On the mac, we don't want to test preferences or ICU for the language, |
| 225 // we want to use whatever Cocoa is using when it loaded the main nib file. | 225 // we want to use whatever Cocoa is using when it loaded the main nib file. |
| 226 // It handles all the mapping and fallbacks for us, we just need to ask | 226 // It handles all the mapping and fallbacks for us, we just need to ask |
| 227 // Cocoa. | 227 // Cocoa. |
| 228 // TODO(pinkerton): break this out into a .mm and ask Cocoa. | 228 // TODO(pinkerton): break this out into a .mm and ask Cocoa. |
| 229 return L"en"; | 229 return L"en"; |
| 230 #else | 230 #else |
| 231 FilePath locale_path; | 231 FilePath locale_path; |
| 232 PathService::Get(chrome::DIR_LOCALES, &locale_path); | 232 PathService::Get(app::DIR_LOCALES, &locale_path); |
| 233 std::wstring resolved_locale; | 233 std::wstring resolved_locale; |
| 234 | 234 |
| 235 // First, check to see if there's a --lang flag. | 235 // First, check to see if there's a --lang flag. |
| 236 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 236 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 237 const std::wstring& lang_arg = | 237 const std::wstring& lang_arg = |
| 238 parsed_command_line.GetSwitchValue(switches::kLang); | 238 parsed_command_line.GetSwitchValue(switches::kLang); |
| 239 if (!lang_arg.empty()) { | 239 if (!lang_arg.empty()) { |
| 240 if (CheckAndResolveLocale(lang_arg, locale_path.ToWStringHack(), | 240 if (CheckAndResolveLocale(lang_arg, locale_path.ToWStringHack(), |
| 241 &resolved_locale)) | 241 &resolved_locale)) |
| 242 return resolved_locale; | 242 return resolved_locale; |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 } | 736 } |
| 737 | 737 |
| 738 void BiDiLineIterator::GetLogicalRun(int start, | 738 void BiDiLineIterator::GetLogicalRun(int start, |
| 739 int* end, | 739 int* end, |
| 740 UBiDiLevel* level) { | 740 UBiDiLevel* level) { |
| 741 DCHECK(bidi_ != NULL); | 741 DCHECK(bidi_ != NULL); |
| 742 ubidi_getLogicalRun(bidi_, start, end, level); | 742 ubidi_getLogicalRun(bidi_, start, end, level); |
| 743 } | 743 } |
| 744 | 744 |
| 745 } | 745 } |
| OLD | NEW |