From 8d97adeeabe5d28a50711423268168448bf56fd5 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Thu, 14 Apr 2011 18:17:08 +0000 Subject: Move a bunch of Chrome specific code out of RenderThread, in preparation of moving it to content. Review URL: http://codereview.chromium.org/6850003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81614 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/spellchecker/spellcheck.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'chrome/renderer/spellchecker/spellcheck.h') diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h index 29980b5..0af6ef8 100644 --- a/chrome/renderer/spellchecker/spellcheck.h +++ b/chrome/renderer/spellchecker/spellcheck.h @@ -9,11 +9,14 @@ #include #include +#include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" #include "base/string16.h" #include "base/time.h" #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" +#include "content/renderer/render_process_observer.h" +#include "ipc/ipc_platform_file.h" #include "unicode/uscript.h" class Hunspell; @@ -24,10 +27,9 @@ class MemoryMappedFile; // TODO(morrita): Needs reorg with SpellCheckProvider. // See http://crbug.com/73699. -class SpellCheck { +class SpellCheck : public RenderProcessObserver { public: SpellCheck(); - ~SpellCheck(); void Init(base::PlatformFile file, @@ -59,14 +61,6 @@ class SpellCheck { // behind its command line flag. string16 GetAutoCorrectionWord(const string16& word, int tag); - // Turn auto spell correct support ON or OFF. - // |turn_on| = true means turn ON; false means turn OFF. - void EnableAutoSpellCorrect(bool turn_on); - - // Add a word to the custom list. This may be called before or after - // |hunspell_| has been initialized. - void WordAdded(const std::string& word); - // Returns true if the spellchecker delegate checking to a system-provided // checker on the browser process. bool is_using_platform_spelling_engine() const { @@ -74,6 +68,19 @@ class SpellCheck { } private: + FRIEND_TEST(SpellCheckTest, GetAutoCorrectionWord_EN_US); + + // RenderProcessObserver implementation: + virtual bool OnControlMessageReceived(const IPC::Message& message); + + // Message handlers. + void OnInit(IPC::PlatformFileForTransit bdict_file, + const std::vector& custom_words, + const std::string& language, + bool auto_spell_correct); + void OnWordAdded(const std::string& word); + void OnEnableAutoSpellCorrect(bool enable); + // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is // non-null. This blocks. void InitializeHunspell(); -- cgit v1.1