| Index: chrome/browser/spellchecker/spelling_service_client.cc
|
| ===================================================================
|
| --- chrome/browser/spellchecker/spelling_service_client.cc (revision 141803)
|
| +++ chrome/browser/spellchecker/spelling_service_client.cc (working copy)
|
| @@ -72,7 +72,7 @@
|
| uloc_getLanguage(id, language, arraysize(language), &error);
|
| country = uloc_getISO3Country(id);
|
| }
|
| - if (type == SPELLCHECK && base::strcasecmp(language, ULOC_ENGLISH))
|
| + if (!IsAvailable(profile, SPELLCHECK))
|
| return false;
|
|
|
| // Format the JSON request to be sent to the Spelling service.
|
| @@ -112,6 +112,22 @@
|
| return true;
|
| }
|
|
|
| +bool SpellingServiceClient::IsAvailable(Profile* profile, ServiceType type) {
|
| + const PrefService* pref = profile->GetPrefs();
|
| + if (!pref->GetBoolean(prefs::kEnableSpellCheck) ||
|
| + !pref->GetBoolean(prefs::kSpellCheckUseSpellingService))
|
| + return false;
|
| +
|
| + // Enable the suggest service only on languages not supported by the
|
| + // spellcheck service. When this client calls the spellcheck service, it
|
| + // returns not only spellcheck results but also spelling suggestions provided
|
| + // by the suggest service. That is, it is not useful to use the suggest
|
| + // service when this client can use the spellcheck service.
|
| + std::string locale = pref->GetString(prefs::kSpellCheckDictionary);
|
| + bool spellcheck_available = locale.empty() || !locale.compare(0, 2, "en");
|
| + return type == SUGGEST ? !spellcheck_available : spellcheck_available;
|
| +}
|
| +
|
| void SpellingServiceClient::OnURLFetchComplete(
|
| const net::URLFetcher* source) {
|
| scoped_ptr<net::URLFetcher> clean_up_fetcher(fetcher_.release());
|
|
|