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

Side by Side Diff: chrome/browser/views/options/language_combobox_model.cc

Issue 113991: Make Combobox portable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/options/language_combobox_model.h" 5 #include "chrome/browser/views/options/language_combobox_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/metrics/user_metrics.h" 10 #include "chrome/browser/metrics/user_metrics.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 locale_names_.push_back(name_local); 66 locale_names_.push_back(name_local);
67 native_names_[name_local] = LocaleData(name_native, locale_codes[i]); 67 native_names_[name_local] = LocaleData(name_native, locale_codes[i]);
68 } 68 }
69 69
70 // Sort using locale specific sorter. 70 // Sort using locale specific sorter.
71 l10n_util::SortStrings(g_browser_process->GetApplicationLocale(), 71 l10n_util::SortStrings(g_browser_process->GetApplicationLocale(),
72 &locale_names_); 72 &locale_names_);
73 } 73 }
74 74
75 // Overridden from views::Combobox::Model: 75 // Overridden from views::Combobox::Model:
76 int LanguageComboboxModel::GetItemCount(views::ComboBox* source) { 76 int LanguageComboboxModel::GetItemCount(views::Combobox* source) {
77 return static_cast<int>(locale_names_.size()); 77 return static_cast<int>(locale_names_.size());
78 } 78 }
79 79
80 std::wstring LanguageComboboxModel::GetItemAt(views::ComboBox* source, 80 std::wstring LanguageComboboxModel::GetItemAt(views::Combobox* source,
81 int index) { 81 int index) {
82 DCHECK(static_cast<int>(locale_names_.size()) > index); 82 DCHECK(static_cast<int>(locale_names_.size()) > index);
83 LocaleDataMap::const_iterator it = 83 LocaleDataMap::const_iterator it =
84 native_names_.find(locale_names_[index]); 84 native_names_.find(locale_names_[index]);
85 DCHECK(it != native_names_.end()); 85 DCHECK(it != native_names_.end());
86 86
87 // If the name is the same in the native language and local language, 87 // If the name is the same in the native language and local language,
88 // don't show it twice. 88 // don't show it twice.
89 if (it->second.native_name == locale_names_[index]) 89 if (it->second.native_name == locale_names_[index])
90 return it->second.native_name; 90 return it->second.native_name;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 local_state = g_browser_process->local_state(); 156 local_state = g_browser_process->local_state();
157 else 157 else
158 local_state = profile_->GetPrefs(); 158 local_state = profile_->GetPrefs();
159 159
160 DCHECK(local_state); 160 DCHECK(local_state);
161 const std::string& current_locale = 161 const std::string& current_locale =
162 WideToASCII(local_state->GetString(prefs.c_str())); 162 WideToASCII(local_state->GetString(prefs.c_str()));
163 163
164 return GetIndexFromLocale(current_locale); 164 return GetIndexFromLocale(current_locale);
165 } 165 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/language_combobox_model.h ('k') | chrome/browser/views/options/languages_page_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698