| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/language_combobox_model.h" | 5 #include "chrome/browser/language_combobox_model.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Sort using locale specific sorter. | 55 // Sort using locale specific sorter. |
| 56 l10n_util::SortStrings(g_browser_process->GetApplicationLocale(), | 56 l10n_util::SortStrings(g_browser_process->GetApplicationLocale(), |
| 57 &locale_names_); | 57 &locale_names_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void LanguageList::CopySpecifiedLanguagesUp(const std::string& locale_codes) { | 60 void LanguageList::CopySpecifiedLanguagesUp(const std::string& locale_codes) { |
| 61 DCHECK(!locale_names_.empty()); | 61 DCHECK(!locale_names_.empty()); |
| 62 std::vector<std::string> locale_codes_vector; | 62 std::vector<std::string> locale_codes_vector; |
| 63 SplitString(locale_codes, ',', &locale_codes_vector); | 63 base::SplitString(locale_codes, ',', &locale_codes_vector); |
| 64 for (size_t i = 0; i != locale_codes_vector.size(); i++) { | 64 for (size_t i = 0; i != locale_codes_vector.size(); i++) { |
| 65 const int locale_index = GetIndexFromLocale(locale_codes_vector[i]); | 65 const int locale_index = GetIndexFromLocale(locale_codes_vector[i]); |
| 66 CHECK_NE(locale_index, -1); | 66 CHECK_NE(locale_index, -1); |
| 67 locale_names_.insert(locale_names_.begin(), locale_names_[locale_index]); | 67 locale_names_.insert(locale_names_.begin(), locale_names_[locale_index]); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Overridden from ComboboxModel: | 71 // Overridden from ComboboxModel: |
| 72 int LanguageList::get_languages_count() const { | 72 int LanguageList::get_languages_count() const { |
| 73 return static_cast<int>(locale_names_.size()); | 73 return static_cast<int>(locale_names_.size()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (!profile_) | 172 if (!profile_) |
| 173 local_state = g_browser_process->local_state(); | 173 local_state = g_browser_process->local_state(); |
| 174 else | 174 else |
| 175 local_state = profile_->GetPrefs(); | 175 local_state = profile_->GetPrefs(); |
| 176 | 176 |
| 177 DCHECK(local_state); | 177 DCHECK(local_state); |
| 178 const std::string& current_locale = local_state->GetString(prefs.c_str()); | 178 const std::string& current_locale = local_state->GetString(prefs.c_str()); |
| 179 | 179 |
| 180 return GetIndexFromLocale(current_locale); | 180 return GetIndexFromLocale(current_locale); |
| 181 } | 181 } |
| OLD | NEW |