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

Side by Side Diff: chrome/common/spellcheck_common.cc

Issue 1156473007: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replied to old comments and fixed small issues. Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/spellcheck_common.h" 5 #include "chrome/common/spellcheck_common.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/prefs/pref_member.h"
12 #include "base/prefs/pref_service.h"
11 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h"
12 #include "third_party/icu/source/common/unicode/uloc.h" 15 #include "third_party/icu/source/common/unicode/uloc.h"
13 #include "third_party/icu/source/common/unicode/urename.h" 16 #include "third_party/icu/source/common/unicode/urename.h"
14 #include "third_party/icu/source/common/unicode/utypes.h" 17 #include "third_party/icu/source/common/unicode/utypes.h"
15 18
16 namespace chrome { 19 namespace chrome {
17 namespace spellcheck_common { 20 namespace spellcheck_common {
18 21
19 struct LanguageRegion { 22 struct LanguageRegion {
20 const char* language; // The language. 23 const char* language; // The language.
21 const char* language_region; // language & region, used by dictionaries. 24 const char* language_region; // language & region, used by dictionaries.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 char id[ULOC_LANG_CAPACITY + ULOC_SCRIPT_CAPACITY + ULOC_COUNTRY_CAPACITY]; 179 char id[ULOC_LANG_CAPACITY + ULOC_SCRIPT_CAPACITY + ULOC_COUNTRY_CAPACITY];
177 uloc_addLikelySubtags(locale.c_str(), id, arraysize(id), &error); 180 uloc_addLikelySubtags(locale.c_str(), id, arraysize(id), &error);
178 error = U_ZERO_ERROR; 181 error = U_ZERO_ERROR;
179 uloc_getLanguage(id, language, arraysize(language), &error); 182 uloc_getLanguage(id, language, arraysize(language), &error);
180 country = uloc_getISO3Country(id); 183 country = uloc_getISO3Country(id);
181 } 184 }
182 *language_code = std::string(language); 185 *language_code = std::string(language);
183 *country_code = std::string(country); 186 *country_code = std::string(country);
184 } 187 }
185 188
189 std::vector<std::string> GetDictionaryLanguagesPref(PrefService* prefs) {
please use gerrit instead 2015/07/06 23:28:15 Now that we are not storing the list in string, th
Julius 2015/07/07 01:14:21 Done.
190 StringListPrefMember dictionaries_pref;
191 dictionaries_pref.Init(prefs::kSpellCheckDictionaries, prefs);
192 return dictionaries_pref.GetValue();
193 }
194
186 bool IsMultilingualSpellcheckEnabled() { 195 bool IsMultilingualSpellcheckEnabled() {
187 return base::CommandLine::ForCurrentProcess()->HasSwitch( 196 return base::CommandLine::ForCurrentProcess()->HasSwitch(
188 switches::kEnableMultilingualSpellChecker); 197 switches::kEnableMultilingualSpellChecker);
189 } 198 }
190 199
191 } // namespace spellcheck_common 200 } // namespace spellcheck_common
192 } // namespace chrome 201 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698