| OLD | NEW |
| 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/renderer/spellchecker/spellcheck.h" | 5 #include "chrome/renderer/spellchecker/spellcheck.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 void SpellCheck::PostDelayedSpellCheckTask(SpellcheckRequest* request) { | 379 void SpellCheck::PostDelayedSpellCheckTask(SpellcheckRequest* request) { |
| 380 if (!request) | 380 if (!request) |
| 381 return; | 381 return; |
| 382 | 382 |
| 383 base::ThreadTaskRunnerHandle::Get()->PostTask( | 383 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 384 FROM_HERE, base::Bind(&SpellCheck::PerformSpellCheck, AsWeakPtr(), | 384 FROM_HERE, base::Bind(&SpellCheck::PerformSpellCheck, AsWeakPtr(), |
| 385 base::Owned(request))); | 385 base::Owned(request))); |
| 386 } | 386 } |
| 387 #endif | 387 #endif |
| 388 | 388 |
| 389 #if !defined(OS_MACOSX) // Mac uses its native engine instead. | 389 #if !defined(OS_MACOSX) // Mac uses its platform engine instead. |
| 390 void SpellCheck::PerformSpellCheck(SpellcheckRequest* param) { | 390 void SpellCheck::PerformSpellCheck(SpellcheckRequest* param) { |
| 391 DCHECK(param); | 391 DCHECK(param); |
| 392 | 392 |
| 393 if (!spellcheck_.IsEnabled()) { | 393 if (!spellcheck_.IsEnabled()) { |
| 394 param->completion()->didCancelCheckingText(); | 394 param->completion()->didCancelCheckingText(); |
| 395 } else { | 395 } else { |
| 396 WebVector<blink::WebTextCheckingResult> results; | 396 WebVector<blink::WebTextCheckingResult> results; |
| 397 SpellCheckParagraph(param->text(), &results); | 397 SpellCheckParagraph(param->text(), &results); |
| 398 param->completion()->didFinishCheckingText(results); | 398 param->completion()->didFinishCheckingText(results); |
| 399 } | 399 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 450 } |
| 451 | 451 |
| 452 results.push_back(WebTextCheckingResult( | 452 results.push_back(WebTextCheckingResult( |
| 453 static_cast<WebTextDecorationType>(decoration), | 453 static_cast<WebTextDecorationType>(decoration), |
| 454 line_offset + spellcheck_result.location, spellcheck_result.length, | 454 line_offset + spellcheck_result.location, spellcheck_result.length, |
| 455 replacement, spellcheck_result.hash)); | 455 replacement, spellcheck_result.hash)); |
| 456 } | 456 } |
| 457 | 457 |
| 458 textcheck_results->assign(results); | 458 textcheck_results->assign(results); |
| 459 } | 459 } |
| OLD | NEW |