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

Unified Diff: chrome/browser/chromeos/login/language_switch_menu.cc

Issue 5939002: Error handling added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: return code CHECK fixed Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/language_switch_menu.cc
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index c18d20da42d4925457a8c879dde0b1c298a28df1..b56ed416cac0f73ce867bfbcf0b6630f533d3769 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -67,8 +67,9 @@ void LanguageSwitchMenu::InitLanguageMenu() {
std::wstring LanguageSwitchMenu::GetCurrentLocaleName() const {
DCHECK(g_browser_process);
const std::string locale = g_browser_process->GetApplicationLocale();
- return language_list_->GetLanguageNameAt(
- language_list_->GetIndexFromLocale(locale));
+ int index = language_list_->GetIndexFromLocale(locale);
+ CHECK_NE(index, -1) << "Unknown locale: " << locale;
Peter Kasting 2010/12/21 18:35:58 Nit: (expected, actual)
glotov 2010/12/21 20:33:34 Done.
+ return language_list_->GetLanguageNameAt(index);
};
void LanguageSwitchMenu::SetFirstLevelMenuWidth(int width) {
@@ -93,7 +94,8 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) {
prefs->SavePersistentPrefs();
// Switch the locale.
- ResourceBundle::ReloadSharedInstance(locale);
+ const std::string res = ResourceBundle::ReloadSharedInstance(locale);
Peter Kasting 2010/12/21 18:35:58 Nit: Same nits
glotov 2010/12/21 20:33:34 Done.
+ CHECK(!res.empty()) << "Locale could not be found for " << locale;
// Enable the keyboard layouts that are necessary for the new locale.
input_method::EnableInputMethods(

Powered by Google App Engine
This is Rietveld 408576698