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

Side by Side Diff: components/spellcheck/browser/spelling_service_client.cc

Issue 2848943002: Allow storing multiple replacements on SpellCheckResult (Closed)
Patch Set: Created 3 years, 7 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 "components/spellcheck/browser/spelling_service_client.h" 5 #include "components/spellcheck/browser/spelling_service_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return false; 264 return false;
265 } 265 }
266 266
267 base::DictionaryValue* suggestion = NULL; 267 base::DictionaryValue* suggestion = NULL;
268 base::string16 replacement; 268 base::string16 replacement;
269 if (!suggestions->GetDictionary(0, &suggestion) || 269 if (!suggestions->GetDictionary(0, &suggestion) ||
270 !suggestion->GetString("suggestion", &replacement)) { 270 !suggestion->GetString("suggestion", &replacement)) {
271 return false; 271 return false;
272 } 272 }
273 SpellCheckResult result(SpellCheckResult::SPELLING, start, length, 273 SpellCheckResult result(SpellCheckResult::SPELLING, start, length,
274 replacement); 274 std::vector<base::string16>({replacement}));
275 results->push_back(result); 275 results->push_back(result);
276 } 276 }
277 return true; 277 return true;
278 } 278 }
279 279
280 SpellingServiceClient::TextCheckCallbackData::TextCheckCallbackData( 280 SpellingServiceClient::TextCheckCallbackData::TextCheckCallbackData(
281 std::unique_ptr<net::URLFetcher> fetcher, 281 std::unique_ptr<net::URLFetcher> fetcher,
282 TextCheckCompleteCallback callback, 282 TextCheckCompleteCallback callback,
283 base::string16 text) 283 base::string16 text)
284 : fetcher(std::move(fetcher)), callback(callback), text(text) {} 284 : fetcher(std::move(fetcher)), callback(callback), text(text) {}
(...skipping 18 matching lines...) Expand all
303 // MUST be the last function called. 303 // MUST be the last function called.
304 callback_data->callback.Run(success, callback_data->text, results); 304 callback_data->callback.Run(success, callback_data->text, results);
305 } 305 }
306 306
307 std::unique_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher( 307 std::unique_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher(
308 const GURL& url, 308 const GURL& url,
309 net::NetworkTrafficAnnotationTag traffic_annotation) { 309 net::NetworkTrafficAnnotationTag traffic_annotation) {
310 return net::URLFetcher::Create(url, net::URLFetcher::POST, this, 310 return net::URLFetcher::Create(url, net::URLFetcher::POST, this,
311 traffic_annotation); 311 traffic_annotation);
312 } 312 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698