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 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void Initialize(); | 70 void Initialize(); |
71 | 71 |
72 // Instantiates SpellCheckHostMetrics object and makes it ready for recording | 72 // Instantiates SpellCheckHostMetrics object and makes it ready for recording |
73 // metrics. This should be called only if the metrics recording is active. | 73 // metrics. This should be called only if the metrics recording is active. |
74 void StartRecordingMetrics(bool spellcheck_enabled); | 74 void StartRecordingMetrics(bool spellcheck_enabled); |
75 | 75 |
76 // Pass the renderer some basic intialization information. Note that the | 76 // Pass the renderer some basic intialization information. Note that the |
77 // renderer will not load Hunspell until it needs to. | 77 // renderer will not load Hunspell until it needs to. |
78 void InitForRenderer(content::RenderProcessHost* process); | 78 void InitForRenderer(content::RenderProcessHost* process); |
79 | 79 |
80 // Returns in-memory cache of custom word list. | |
81 const chrome::spellcheck_common::WordList& GetCustomWords(); | |
82 | |
83 // Invoked on the Ui thread when new custom word is registered. | |
84 void CustomWordAddedLocally(const std::string& word); | |
85 | |
86 // Loads the custom dictionary associated with this profile into the | |
87 // passed in WordList. | |
88 void LoadDictionaryIntoCustomWordList( | |
89 chrome::spellcheck_common::WordList* custom_words); | |
90 | |
91 // Writes a word to the custom dictionary associated with this profile. | |
92 void WriteWordToCustomDictionary(const std::string& word); | |
93 | |
94 // Adds the given word to the custom words list and inform renderer of the | |
95 // update. | |
96 void AddWord(const std::string& word); | |
97 | |
98 // Returns true if the dictionary is ready to use. | 80 // Returns true if the dictionary is ready to use. |
99 bool IsReady() const; | 81 bool IsReady() const; |
100 | 82 |
101 // Hunspell dictionary functions. | 83 // Hunspell dictionary functions. |
102 virtual const base::PlatformFile& GetDictionaryFile() const; | 84 virtual const base::PlatformFile& GetDictionaryFile() const; |
103 virtual const std::string& GetLanguage() const; | 85 virtual const std::string& GetLanguage() const; |
104 virtual bool IsUsingPlatformChecker() const; | 86 virtual bool IsUsingPlatformChecker() const; |
105 | 87 |
106 // The reply point for PostTaskAndReply. Called when AddWord is finished | |
107 // adding a word in the background. | |
108 void AddWordComplete(const std::string& word); | |
109 | |
110 // Returns a metrics counter associated with this object, | 88 // Returns a metrics counter associated with this object, |
111 // or null when metrics recording is disabled. | 89 // or null when metrics recording is disabled. |
112 SpellCheckHostMetrics* GetMetrics() const; | 90 SpellCheckHostMetrics* GetMetrics() const; |
113 | 91 |
114 // Returns the instance of the custom dictionary. Custom dictionary | 92 // Returns the instance of the custom dictionary. Custom dictionary |
115 // will be lazily initialized. | 93 // will be lazily initialized. |
116 SpellcheckCustomDictionary* GetCustomDictionary(); | 94 SpellcheckCustomDictionary* GetCustomDictionary(); |
117 | 95 |
118 // Inform |profile_| that initialization has finished. | 96 // Inform |profile_| that initialization has finished. |
119 // |custom_words| holds the custom word list which was | 97 // |custom_words| holds the custom word list which was |
(...skipping 30 matching lines...) Expand all Loading... |
150 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_; | 128 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_; |
151 | 129 |
152 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; | 130 scoped_ptr<SpellcheckHunspellDictionary> hunspell_dictionary_; |
153 | 131 |
154 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; | 132 base::WeakPtrFactory<SpellcheckService> weak_ptr_factory_; |
155 | 133 |
156 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); | 134 DISALLOW_COPY_AND_ASSIGN(SpellcheckService); |
157 }; | 135 }; |
158 | 136 |
159 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ | 137 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_SERVICE_H_ |
OLD | NEW |