summaryrefslogtreecommitdiffstats
path: root/chrome/browser/spellchecker.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 20:14:16 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 20:14:16 +0000
commit1480c1f9c25ce91f827e28602d5de83e7e88b800 (patch)
treeae575e4a55fbc9052c1212d9f28db015623eca50 /chrome/browser/spellchecker.cc
parent8a0098f59d6170cf0050d3ebd25b45ee77919137 (diff)
downloadchromium_src-1480c1f9c25ce91f827e28602d5de83e7e88b800.zip
chromium_src-1480c1f9c25ce91f827e28602d5de83e7e88b800.tar.gz
chromium_src-1480c1f9c25ce91f827e28602d5de83e7e88b800.tar.bz2
Switch some more ASCII locale code wstrings to strings.
Also, don't alphabetize available spellchecker locale codes. Review URL: http://codereview.chromium.org/42531 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker.cc')
-rw-r--r--chrome/browser/spellchecker.cc32
1 files changed, 12 insertions, 20 deletions
diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc
index e1f428d..39aec18 100644
--- a/chrome/browser/spellchecker.cc
+++ b/chrome/browser/spellchecker.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <set>
-
#include "chrome/browser/spellchecker.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -149,43 +147,37 @@ SpellChecker::Language SpellChecker::GetCorrespondingSpellCheckLanguage(
return Language();
}
-int SpellChecker::GetSpellCheckLanguagesToDisplayInContextMenu(
+int SpellChecker::GetSpellCheckLanguages(
Profile* profile,
- DisplayLanguages* display_languages) {
+ Languages* languages) {
StringPrefMember accept_languages_pref;
StringPrefMember dictionary_language_pref;
accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(),
NULL);
dictionary_language_pref.Init(prefs::kSpellCheckDictionary,
profile->GetPrefs(), NULL);
- std::wstring dictionary_language = dictionary_language_pref.GetValue();
+ std::string dictionary_language =
+ WideToASCII(dictionary_language_pref.GetValue());
// The current dictionary language should be there.
- display_languages->push_back(dictionary_language);
+ languages->push_back(dictionary_language);
// Now scan through the list of accept languages, and find possible mappings
// from this list to the existing list of spell check languages.
Languages accept_languages;
- std::set<Language> unique_languages;
SplitString(WideToASCII(accept_languages_pref.GetValue()), ',',
&accept_languages);
for (Languages::const_iterator i = accept_languages.begin();
i != accept_languages.end(); ++i) {
- Language language(GetCorrespondingSpellCheckLanguage(*i));
- if (!language.empty() && language != WideToASCII(dictionary_language))
- unique_languages.insert(language);
+ std::string language = GetCorrespondingSpellCheckLanguage(*i);
+ if (!language.empty() &&
+ std::find(languages->begin(), languages->end(), language) ==
+ languages->end())
+ languages->push_back(language);
}
- for (std::set<Language>::const_iterator i = unique_languages.begin();
- i != unique_languages.end(); ++i)
- display_languages->push_back(ASCIIToWide(*i));
-
- // Sort using locale specific sorter.
- l10n_util::SortStrings(g_browser_process->GetApplicationLocale(),
- display_languages);
-
- for (size_t i = 0; i < display_languages->size(); ++i) {
- if ((*display_languages)[i] == dictionary_language)
+ for (size_t i = 0; i < languages->size(); ++i) {
+ if ((*languages)[i] == dictionary_language)
return i;
}
return -1;