| Index: chrome/renderer/spellchecker/spellcheck.h
|
| diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h
|
| index c4c0e87d2f6a256e8c472ff15922e0938ad3972b..23f7f95479bae3cb2e0f98a367aed646a0c9f2c9 100644
|
| --- a/chrome/renderer/spellchecker/spellcheck.h
|
| +++ b/chrome/renderer/spellchecker/spellcheck.h
|
| @@ -10,6 +10,7 @@
|
| #include <vector>
|
|
|
| #include "base/gtest_prod_util.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/platform_file.h"
|
| #include "base/string16.h"
|
| @@ -26,6 +27,7 @@ class MemoryMappedFile;
|
| }
|
|
|
| namespace WebKit {
|
| +class WebTextCheckingCompletion;
|
| struct WebTextCheckingResult;
|
| }
|
|
|
| @@ -74,6 +76,12 @@ class SpellCheck : public content::RenderProcessObserver {
|
| // behind its command line flag.
|
| string16 GetAutoCorrectionWord(const string16& word, int tag);
|
|
|
| + // Requests to spellcheck the specified text in the background. This function
|
| + // posts a background task and calls SpellCheckParagraph() in the task.
|
| + void RequestTextChecking(const string16& text,
|
| + int document_tag,
|
| + WebKit::WebTextCheckingCompletion* completion);
|
| +
|
| // Returns true if the spellchecker delegate checking to a system-provided
|
| // checker on the browser process.
|
| bool is_using_platform_spelling_engine() const {
|
| @@ -82,6 +90,10 @@ class SpellCheck : public content::RenderProcessObserver {
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(SpellCheckTest, GetAutoCorrectionWord_EN_US);
|
| + FRIEND_TEST_ALL_PREFIXES(SpellCheckTest,
|
| + RequestSpellCheckMultipleTimesWithoutInitialization);
|
| +
|
| + class SpellCheckRequest;
|
|
|
| // RenderProcessObserver implementation:
|
| virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
|
| @@ -110,6 +122,9 @@ class SpellCheck : public content::RenderProcessObserver {
|
| // backend, either hunspell or a platform-specific backend.
|
| bool CheckSpelling(const string16& word_to_check, int tag);
|
|
|
| + // Posts delayed spellcheck task and clear it if any.
|
| + void PostDelayedSpellCheckTask();
|
| +
|
| // When called, relays the request to fill the list with suggestions to
|
| // the proper backend, either hunspell or a platform-specific backend.
|
| void FillSuggestionList(const string16& wrong_word,
|
| @@ -150,12 +165,22 @@ class SpellCheck : public content::RenderProcessObserver {
|
| // and False if hunspell is being used.
|
| bool is_using_platform_spelling_engine_;
|
|
|
| - // This flags whether we have ever been initialized, or have asked the browser
|
| - // for a dictionary. The value indicates whether we should request a
|
| + // This flags is true if we have been intialized.
|
| + // The value indicates whether we should request a
|
| // dictionary from the browser when the render view asks us to check the
|
| // spelling of a word.
|
| bool initialized_;
|
|
|
| + // This flags is true if we have requested dictionary.
|
| + bool dictionary_requested_;
|
| +
|
| + // The parameters of a pending background-spellchecking request. When WebKit
|
| + // sends a background-spellchecking request before initializing hunspell,
|
| + // we save its parameters and start spellchecking after we finish initializing
|
| + // hunspell. (When WebKit sends two or more requests, we cancel the previous
|
| + // requests so we do not have to use vectors.)
|
| + scoped_refptr<SpellCheckRequest> pending_request_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(SpellCheck);
|
| };
|
|
|
|
|