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

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

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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/formatter.h ('k') | ui/base/l10n/l10n_util_mac.mm » ('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.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 <memory> 10 #include <memory>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 270 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
271 if (base::i18n::IsRTL() && 271 if (base::i18n::IsRTL() &&
272 base::i18n::StringContainsStrongRTLChars(*paragraph)) { 272 base::i18n::StringContainsStrongRTLChars(*paragraph)) {
273 paragraph->insert(0, 1, 273 paragraph->insert(0, 1,
274 static_cast<base::char16>(base::i18n::kRightToLeftMark)); 274 static_cast<base::char16>(base::i18n::kRightToLeftMark));
275 } 275 }
276 #endif 276 #endif
277 } 277 }
278 278
279 struct AvailableLocalesTraits 279 struct AvailableLocalesTraits
280 : base::DefaultLazyInstanceTraits<std::vector<std::string> > { 280 : base::internal::DestructorAtExitLazyInstanceTraits<
281 std::vector<std::string>> {
281 static std::vector<std::string>* New(void* instance) { 282 static std::vector<std::string>* New(void* instance) {
282 std::vector<std::string>* locales = 283 std::vector<std::string>* locales =
283 base::DefaultLazyInstanceTraits<std::vector<std::string> >::New( 284 base::internal::DestructorAtExitLazyInstanceTraits<
284 instance); 285 std::vector<std::string>>::New(instance);
285 int num_locales = uloc_countAvailable(); 286 int num_locales = uloc_countAvailable();
286 for (int i = 0; i < num_locales; ++i) { 287 for (int i = 0; i < num_locales; ++i) {
287 std::string locale_name = uloc_getAvailable(i); 288 std::string locale_name = uloc_getAvailable(i);
288 // Filter out the names that have aliases. 289 // Filter out the names that have aliases.
289 if (IsDuplicateName(locale_name)) 290 if (IsDuplicateName(locale_name))
290 continue; 291 continue;
291 // Filter out locales for which we have only partially populated data 292 // Filter out locales for which we have only partially populated data
292 // and to which Chrome is not localized. 293 // and to which Chrome is not localized.
293 if (IsLocalePartiallyPopulated(locale_name)) 294 if (IsLocalePartiallyPopulated(locale_name))
294 continue; 295 continue;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 880
880 const char* const* GetAcceptLanguageListForTesting() { 881 const char* const* GetAcceptLanguageListForTesting() {
881 return kAcceptLanguageList; 882 return kAcceptLanguageList;
882 } 883 }
883 884
884 size_t GetAcceptLanguageListSizeForTesting() { 885 size_t GetAcceptLanguageListSizeForTesting() {
885 return arraysize(kAcceptLanguageList); 886 return arraysize(kAcceptLanguageList);
886 } 887 }
887 888
888 } // namespace l10n_util 889 } // namespace l10n_util
OLDNEW
« no previous file with comments | « ui/base/l10n/formatter.h ('k') | ui/base/l10n/l10n_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698