OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/spellchecker.h" | 5 #include "chrome/browser/spellchecker.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 g_supported_spellchecker_languages[i].language_region); | 305 g_supported_spellchecker_languages[i].language_region); |
306 if (spellcheck_language.substr(0, spellcheck_language.find('-')) == | 306 if (spellcheck_language.substr(0, spellcheck_language.find('-')) == |
307 language_part) | 307 language_part) |
308 return spellcheck_language; | 308 return spellcheck_language; |
309 } | 309 } |
310 | 310 |
311 // No match found - return blank. | 311 // No match found - return blank. |
312 return std::string(); | 312 return std::string(); |
313 } | 313 } |
314 | 314 |
| 315 // static |
315 int SpellChecker::GetSpellCheckLanguages( | 316 int SpellChecker::GetSpellCheckLanguages( |
316 Profile* profile, | 317 Profile* profile, |
317 std::vector<std::string>* languages) { | 318 std::vector<std::string>* languages) { |
318 StringPrefMember accept_languages_pref; | 319 StringPrefMember accept_languages_pref; |
319 StringPrefMember dictionary_language_pref; | 320 StringPrefMember dictionary_language_pref; |
320 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(), | 321 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(), |
321 NULL); | 322 NULL); |
322 dictionary_language_pref.Init(prefs::kSpellCheckDictionary, | 323 dictionary_language_pref.Init(prefs::kSpellCheckDictionary, |
323 profile->GetPrefs(), NULL); | 324 profile->GetPrefs(), NULL); |
324 std::string dictionary_language = | 325 std::string dictionary_language = |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 805 |
805 // Populate the vector of WideStrings. | 806 // Populate the vector of WideStrings. |
806 for (int i = 0; i < number_of_suggestions; i++) { | 807 for (int i = 0; i < number_of_suggestions; i++) { |
807 if (i < kMaxSuggestions) | 808 if (i < kMaxSuggestions) |
808 optional_suggestions->push_back(UTF8ToUTF16(suggestions[i])); | 809 optional_suggestions->push_back(UTF8ToUTF16(suggestions[i])); |
809 free(suggestions[i]); | 810 free(suggestions[i]); |
810 } | 811 } |
811 if (suggestions != NULL) | 812 if (suggestions != NULL) |
812 free(suggestions); | 813 free(suggestions); |
813 } | 814 } |
OLD | NEW |