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

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

Issue 14230008: Fix CHECK failure in l10n_util::IsLocaleAvailable(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 <string> 10 #include <string>
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return false; 239 return false;
240 240
241 // IsLocalePartiallyPopulated() can be called here for an early return w/o 241 // IsLocalePartiallyPopulated() can be called here for an early return w/o
242 // checking the resource availability below. It'd help when Chrome is run 242 // checking the resource availability below. It'd help when Chrome is run
243 // under a system locale Chrome is not localized to (e.g.Farsi on Linux), 243 // under a system locale Chrome is not localized to (e.g.Farsi on Linux),
244 // but it'd slow down the start up time a little bit for locales Chrome is 244 // but it'd slow down the start up time a little bit for locales Chrome is
245 // localized to. So, we don't call it here. 245 // localized to. So, we don't call it here.
246 if (!l10n_util::IsLocaleSupportedByOS(locale)) 246 if (!l10n_util::IsLocaleSupportedByOS(locale))
247 return false; 247 return false;
248 248
249 // If the ResourceBundle is not yet initialized, return false to avoid the
250 // CHECK failure in ResourceBundle::GetSharedInstance().
251 if (!ResourceBundle::HasSharedInstance())
252 return false;
jungshik at Google 2013/04/16 20:04:55 With this, in https://codereview.chromium.org/1382
hshi1 2013/04/16 20:36:39 It seems very difficult to make LocaleDataPakExist
253
249 return ResourceBundle::GetSharedInstance().LocaleDataPakExists(locale); 254 return ResourceBundle::GetSharedInstance().LocaleDataPakExists(locale);
250 } 255 }
251 256
252 bool CheckAndResolveLocale(const std::string& locale, 257 bool CheckAndResolveLocale(const std::string& locale,
253 std::string* resolved_locale) { 258 std::string* resolved_locale) {
254 if (IsLocaleAvailable(locale)) { 259 if (IsLocaleAvailable(locale)) {
255 *resolved_locale = locale; 260 *resolved_locale = locale;
256 return true; 261 return true;
257 } 262 }
258 263
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 851 }
847 852
848 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) { 853 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) {
849 int width = 0; 854 int width = 0;
850 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width); 855 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width);
851 DCHECK_GT(width, 0); 856 DCHECK_GT(width, 0);
852 return width; 857 return width;
853 } 858 }
854 859
855 } // namespace l10n_util 860 } // namespace l10n_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698