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_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ | 5 #ifndef CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ |
6 #define CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ | 6 #define CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 virtual ~HunspellEngine(); | 23 virtual ~HunspellEngine(); |
24 | 24 |
25 virtual void Init(base::PlatformFile file, | 25 virtual void Init(base::PlatformFile file, |
26 const std::vector<std::string>& custom_words) OVERRIDE; | 26 const std::vector<std::string>& custom_words) OVERRIDE; |
27 | 27 |
28 virtual bool InitializeIfNeeded() OVERRIDE; | 28 virtual bool InitializeIfNeeded() OVERRIDE; |
29 virtual bool IsEnabled() OVERRIDE; | 29 virtual bool IsEnabled() OVERRIDE; |
30 virtual bool CheckSpelling(const string16& word_to_check, int tag) OVERRIDE; | 30 virtual bool CheckSpelling(const string16& word_to_check, int tag) OVERRIDE; |
31 virtual void FillSuggestionList(const string16& wrong_word, | 31 virtual void FillSuggestionList(const string16& wrong_word, |
32 std::vector<string16>* optional_suggestions) OVERRIDE; | 32 std::vector<string16>* optional_suggestions) OVERRIDE; |
33 virtual void OnWordAdded(const std::string& word) OVERRIDE; | 33 virtual void OnWordsAddedRemoved( |
groby-ooo-7-16
2013/01/10 19:53:03
"OnCustomDictionaryChanged" instead?
please use gerrit instead
2013/01/12 02:50:46
Good point. I had AddedRemoved everywhere. Changed
| |
34 virtual void OnWordRemoved(const std::string& word) OVERRIDE; | 34 const std::vector<std::string>& words_added, |
35 const std::vector<std::string>& words_removed) OVERRIDE; | |
35 | 36 |
36 private: | 37 private: |
37 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is | 38 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is |
38 // non-null. This blocks. | 39 // non-null. This blocks. |
39 void InitializeHunspell(); | 40 void InitializeHunspell(); |
40 | 41 |
41 // Add the given custom word to |hunspell_|. | 42 // Add the given custom words to |hunspell_|. |
42 void AddWordToHunspell(const std::string& word); | 43 void AddWordsToHunspell(const std::vector<std::string>& words); |
43 | 44 |
44 // Remove the given custom word from |hunspell_|. | 45 // Remove the given custom words from |hunspell_|. |
45 void RemoveWordFromHunspell(const std::string& word); | 46 void RemoveWordsFromHunspell(const std::vector<std::string>& words); |
46 | 47 |
47 // We memory-map the BDict file. | 48 // We memory-map the BDict file. |
48 scoped_ptr<file_util::MemoryMappedFile> bdict_file_; | 49 scoped_ptr<file_util::MemoryMappedFile> bdict_file_; |
49 | 50 |
50 // The hunspell dictionary in use. | 51 // The hunspell dictionary in use. |
51 scoped_ptr<Hunspell> hunspell_; | 52 scoped_ptr<Hunspell> hunspell_; |
52 | 53 |
53 chrome::spellcheck_common::WordList custom_words_; | 54 chrome::spellcheck_common::WordList custom_words_; |
54 | 55 |
55 base::PlatformFile file_; | 56 base::PlatformFile file_; |
56 | 57 |
57 // This flags is true if we have been intialized. | 58 // This flags is true if we have been initialized. |
58 // The value indicates whether we should request a | 59 // The value indicates whether we should request a |
59 // dictionary from the browser when the render view asks us to check the | 60 // dictionary from the browser when the render view asks us to check the |
60 // spelling of a word. | 61 // spelling of a word. |
61 bool initialized_; | 62 bool initialized_; |
62 | 63 |
63 // This flags is true if we have requested dictionary. | 64 // This flags is true if we have requested dictionary. |
64 bool dictionary_requested_; | 65 bool dictionary_requested_; |
65 | 66 |
66 }; | 67 }; |
67 | 68 |
68 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ | 69 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ |
69 | 70 |
OLD | NEW |