Chromium Code Reviews| Index: chrome/browser/spellchecker/spellcheck_host_impl.h |
| diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.h b/chrome/browser/spellchecker/spellcheck_host_impl.h |
| index e58cce7204e616f5cebbce1fa301748d6918c6fa..26769f8f1f02c9981d0f97cadd4a8140c071ce72 100644 |
| --- a/chrome/browser/spellchecker/spellcheck_host_impl.h |
| +++ b/chrome/browser/spellchecker/spellcheck_host_impl.h |
| @@ -9,8 +9,10 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/compiler_specific.h" |
| #include "base/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "chrome/browser/spellchecker/spellcheck_host.h" |
| #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" |
| #include "content/public/common/url_fetcher_delegate.h" |
| @@ -46,15 +48,17 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| net::URLRequestContextGetter* request_context_getter, |
| SpellCheckHostMetrics* metrics); |
| + virtual ~SpellCheckHostImpl(); |
| + |
| void Initialize(); |
| // SpellCheckHost implementation |
| - virtual void UnsetProfile(); |
| - virtual void InitForRenderer(RenderProcessHost* process); |
| - virtual void AddWord(const std::string& word); |
| - virtual const base::PlatformFile& GetDictionaryFile() const; |
| - virtual const std::string& GetLanguage() const; |
| - virtual bool IsUsingPlatformChecker() const; |
| + virtual void UnsetProfile() OVERRIDE; |
| + virtual void InitForRenderer(RenderProcessHost* process) OVERRIDE; |
| + virtual void AddWord(const std::string& word) OVERRIDE; |
| + virtual const base::PlatformFile& GetDictionaryFile() const OVERRIDE; |
| + virtual const std::string& GetLanguage() const OVERRIDE; |
| + virtual bool IsUsingPlatformChecker() const OVERRIDE; |
| private: |
| typedef SpellCheckProfileProvider::CustomWordList CustomWordList; |
| @@ -63,8 +67,6 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| friend class content::BrowserThread; |
| friend class DeleteTask<SpellCheckHostImpl>; |
| - virtual ~SpellCheckHostImpl(); |
| - |
| // Figure out the location for the dictionary. This is only non-trivial for |
| // Windows: |
| // The default place whether the spellcheck dictionary can reside is |
| @@ -72,12 +74,9 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| // this directory may not have permissions for download. In that case, the |
| // alternate directory for download is chrome::DIR_USER_DATA. |
| void InitializeDictionaryLocation(); |
| + void InitializeDictionaryLocationComplete(); |
| - // Load and parse the custom words dictionary and open the bdic file. |
| - // Executed on the file thread. |
| - void InitializeInternal(); |
| - |
| - void InitializeOnFileThread(); |
| + void AddWordComplete(const std::string& word); |
|
Hironori Bono
2011/11/08 07:20:25
nit: can you add a comment for this function, such
|
| // Inform |profile_| that initialization has finished. |
| // |custom_words| holds the custom word list which was |
| @@ -116,6 +115,7 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| // Saves |data_| to disk. Run on the file thread. |
| void SaveDictionaryData(); |
| + void SaveDictionaryDataComplete(); |
| // Verifies the specified BDict file exists and it is sane. This function |
| // should be called before opening the file so we can delete it and download a |
| @@ -131,6 +131,8 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| // The location of the custom words file. |
| FilePath custom_dictionary_file_; |
| + bool dictionary_saved_; |
|
Hironori Bono
2011/11/08 07:20:25
nit: can you add a comment for this variable, such
|
| + |
| // The language of the dictionary file. |
| std::string language_; |
| @@ -159,6 +161,10 @@ class SpellCheckHostImpl : public SpellCheckHost, |
| // An optional metrics counter given by the constructor. |
| SpellCheckHostMetrics* metrics_; |
| + base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_; |
| + |
| + scoped_ptr<CustomWordList> custom_words_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); |
| }; |