Chromium Code Reviews| Index: chrome/browser/spellchecker/spellcheck_profile.h |
| diff --git a/chrome/browser/spellchecker/spellcheck_profile.h b/chrome/browser/spellchecker/spellcheck_profile.h |
| index 7a7bf0d511aca8cd8ba34b7f3e735de0823670ef..cc7b04f4a4d666e3f4a3356a8ae9de0116c62d75 100644 |
| --- a/chrome/browser/spellchecker/spellcheck_profile.h |
| +++ b/chrome/browser/spellchecker/spellcheck_profile.h |
| @@ -9,9 +9,13 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/ref_counted.h" |
| #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" |
| +#include "chrome/common/chrome_constants.h" |
| +#include "chrome/common/chrome_paths.h" |
| +#include "content/browser/browser_thread.h" |
|
gmorrita
2011/10/12 03:41:11
Isn't it possible to have this in .cc file?
shinyak (Google)
2011/10/12 10:46:54
Done.
|
| class Profile; |
| class SpellCheckHost; |
| @@ -39,7 +43,10 @@ class URLRequestContextGetter; |
| // The class is intended to be owned and managed by ProfileImpl internally. |
| // Any usable APIs are provided by SpellCheckHost interface, |
| // which can be retrieved from Profile::GetSpellCheckHost(). |
| -class SpellCheckProfile : public SpellCheckProfileProvider { |
| +class SpellCheckProfile |
| + : public SpellCheckProfileProvider, |
|
Hironori Bono
2011/10/12 02:56:56
nit: need four spaces before ':'.
shinyak (Google)
2011/10/12 10:46:54
Done.
|
| + public base::RefCountedThreadSafe<SpellCheckProfile> |
| +{ |
|
Hironori Bono
2011/10/12 02:56:56
nit: this '{' should be placed at the end of the p
shinyak (Google)
2011/10/12 10:46:54
Done.
|
| public: |
| // Return value of ReinitializeHost() |
| enum ReinitializeResult { |
| @@ -57,7 +64,6 @@ class SpellCheckProfile : public SpellCheckProfileProvider { |
| }; |
| SpellCheckProfile(); |
| - virtual ~SpellCheckProfile(); |
| // Retrieves SpellCheckHost object. |
| // This can return NULL when the spell-checking is disabled |
| @@ -82,11 +88,15 @@ class SpellCheckProfile : public SpellCheckProfileProvider { |
| void StartRecordingMetrics(bool spellcheck_enabled); |
| // SpellCheckProfileProvider implementation. |
| - virtual void SpellCheckHostInitialized(CustomWordList* custom_words); |
| + virtual void LoadCustomDictionary(); |
| + virtual void SpellCheckHostInitialized(); |
| virtual const CustomWordList& GetCustomWords() const; |
| virtual void CustomWordAddedLocally(const std::string& word); |
| protected: |
| + friend class base::RefCountedThreadSafe<SpellCheckProfile>; |
| + virtual ~SpellCheckProfile(); |
| + |
| // Only tests should override this. |
| virtual SpellCheckHost* CreateHost( |
| SpellCheckProfileProvider* provider, |
| @@ -96,7 +106,15 @@ class SpellCheckProfile : public SpellCheckProfileProvider { |
| virtual bool IsTesting() const; |
| + // Tests should override this. |
| + virtual void WriteWordToCustomDictionary(const std::string& word); |
| private: |
| + // Load a custom dictionary on file thread. |
| + void LoadCustomDictionaryOnFileThread(); |
| + |
| + // Write a custom dictionary addition to disk. |
| + void WriteWordToCustomDictionaryOnFileThread(const std::string& word); |
| + |
| scoped_refptr<SpellCheckHost> host_; |
| scoped_ptr<SpellCheckHostMetrics> metrics_; |
| @@ -104,6 +122,9 @@ class SpellCheckProfile : public SpellCheckProfileProvider { |
| // finished. |
| bool host_ready_; |
| + // The location of the custom words file. |
| + FilePath custom_dictionary_file_; |
| + |
| // In-memory cache of the custom words file. |
| scoped_ptr<CustomWordList> custom_words_; |