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

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

Issue 16206002: Add more support for FreeBSD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use os_posix and exclude other platforms as needed Created 7 years, 4 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
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.h" 5 #include "ui/base/l10n/l10n_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <iterator> 9 #include <iterator>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 #include "third_party/icu/source/common/unicode/rbbi.h" 28 #include "third_party/icu/source/common/unicode/rbbi.h"
29 #include "third_party/icu/source/common/unicode/uloc.h" 29 #include "third_party/icu/source/common/unicode/uloc.h"
30 #include "ui/base/l10n/l10n_util_collator.h" 30 #include "ui/base/l10n/l10n_util_collator.h"
31 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/base/ui_base_paths.h" 32 #include "ui/base/ui_base_paths.h"
33 33
34 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
35 #include "ui/base/l10n/l10n_util_android.h" 35 #include "ui/base/l10n/l10n_util_android.h"
36 #endif 36 #endif
37 37
38 #if defined(OS_LINUX) 38 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
39 !defined(OS_NACL)
39 #include <glib.h> 40 #include <glib.h>
40 #endif 41 #endif
41 42
42 #if defined(OS_WIN) 43 #if defined(OS_WIN)
43 #include "ui/base/l10n/l10n_util_win.h" 44 #include "ui/base/l10n/l10n_util_win.h"
44 #endif // OS_WIN 45 #endif // OS_WIN
45 46
46 namespace { 47 namespace {
47 48
48 static const char* const kAcceptLanguageList[] = { 49 static const char* const kAcceptLanguageList[] = {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 446
446 // On ChromeOS, use the application locale preference. 447 // On ChromeOS, use the application locale preference.
447 if (!pref_locale.empty()) 448 if (!pref_locale.empty())
448 candidates.push_back(pref_locale); 449 candidates.push_back(pref_locale);
449 450
450 #elif defined(OS_ANDROID) 451 #elif defined(OS_ANDROID)
451 452
452 // On Android, query java.util.Locale for the default locale. 453 // On Android, query java.util.Locale for the default locale.
453 candidates.push_back(GetDefaultLocale()); 454 candidates.push_back(GetDefaultLocale());
454 455
455 #elif defined(OS_LINUX) 456 #elif defined(OS_POSIX) && !defined(OS_NACL)
456 // If we're on a different Linux system, we have glib. 457 // If we're on a different Linux system, we have glib.
457 458
458 // GLib implements correct environment variable parsing with 459 // GLib implements correct environment variable parsing with
459 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. 460 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG.
460 // We used to use our custom parsing code along with ICU for this purpose. 461 // We used to use our custom parsing code along with ICU for this purpose.
461 // If we have a port that does not depend on GTK, we have to 462 // If we have a port that does not depend on GTK, we have to
462 // restore our custom code for that port. 463 // restore our custom code for that port.
463 const char* const* languages = g_get_language_names(); 464 const char* const* languages = g_get_language_names();
464 DCHECK(languages); // A valid pointer is guaranteed. 465 DCHECK(languages); // A valid pointer is guaranteed.
465 DCHECK(*languages); // At least one entry, "C", is guaranteed. 466 DCHECK(*languages); // At least one entry, "C", is guaranteed.
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 } 854 }
854 855
855 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) { 856 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) {
856 int width = 0; 857 int width = 0;
857 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width); 858 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width);
858 DCHECK_GT(width, 0); 859 DCHECK_GT(width, 0);
859 return width; 860 return width;
860 } 861 }
861 862
862 } // namespace l10n_util 863 } // namespace l10n_util
OLDNEW
« chrome/browser/chrome_content_browser_client.cc ('K') | « tools/clang/scripts/plugin_flags.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698