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

Side by Side Diff: chrome/browser/spellchecker/spelling_service_client.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: Fixed nits and rebased. Created 5 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
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/browser/spellchecker/spelling_service_client.h" 5 #include "chrome/browser/spellchecker/spelling_service_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 spellcheck_fetchers_[fetcher] = new TextCheckCallbackData(callback, text); 108 spellcheck_fetchers_[fetcher] = new TextCheckCallbackData(callback, text);
109 fetcher->Start(); 109 fetcher->Start();
110 return true; 110 return true;
111 } 111 }
112 112
113 bool SpellingServiceClient::IsAvailable( 113 bool SpellingServiceClient::IsAvailable(
114 content::BrowserContext* context, 114 content::BrowserContext* context,
115 ServiceType type) { 115 ServiceType type) {
116 const PrefService* pref = user_prefs::UserPrefs::Get(context); 116 const PrefService* pref = user_prefs::UserPrefs::Get(context);
117 DCHECK(pref); 117 DCHECK(pref);
118 // If prefs don't allow spellchecking or if the context is off the record, 118 // If prefs don't allow spellchecking, if the context is off the record, or if
119 // the spelling service should be unavailable. 119 // multilingual spellchecking is enabled the spelling service should be
groby-ooo-7-16 2015/06/24 22:12:23 Why do we not want the spelling service for multil
Julius 2015/07/06 22:38:53 I believe we've talked about this (spelling server
120 // unavailable.
120 if (!pref->GetBoolean(prefs::kEnableContinuousSpellcheck) || 121 if (!pref->GetBoolean(prefs::kEnableContinuousSpellcheck) ||
121 !pref->GetBoolean(prefs::kSpellCheckUseSpellingService) || 122 !pref->GetBoolean(prefs::kSpellCheckUseSpellingService) ||
122 context->IsOffTheRecord()) 123 context->IsOffTheRecord() ||
124 chrome::spellcheck_common::IsMultilingualSpellcheckEnabled())
123 return false; 125 return false;
124 126
125 // If the locale for spelling has not been set, the user has not decided to 127 // If the locale for spelling has not been set, the user has not decided to
126 // use spellcheck so we don't do anything remote (suggest or spelling). 128 // use spellcheck so we don't do anything remote (suggest or spelling).
127 std::string locale = pref->GetString(prefs::kSpellCheckDictionary); 129 std::string locale = pref->GetString(prefs::kSpellCheckDictionary);
128 if (locale.empty()) 130 if (locale.empty())
129 return false; 131 return false;
130 132
131 // Finally, if all options are available, we only enable only SUGGEST 133 // Finally, if all options are available, we only enable only SUGGEST
132 // if SPELLCHECK is not available for our language because SPELLCHECK results 134 // if SPELLCHECK is not available for our language because SPELLCHECK results
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 262
261 // The callback may release the last (transitive) dependency on |this|. It 263 // The callback may release the last (transitive) dependency on |this|. It
262 // MUST be the last function called. 264 // MUST be the last function called.
263 callback_data->callback.Run(success, callback_data->text, results); 265 callback_data->callback.Run(success, callback_data->text, results);
264 } 266 }
265 267
266 scoped_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher( 268 scoped_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher(
267 const GURL& url) { 269 const GURL& url) {
268 return net::URLFetcher::Create(url, net::URLFetcher::POST, this); 270 return net::URLFetcher::Create(url, net::URLFetcher::POST, this);
269 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698