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 OnWordsAdded(const std::vector<std::string>& words) OVERRIDE; |
34 virtual void OnWordRemoved(const std::string& word) OVERRIDE; | 34 virtual void OnWordsRemoved(const std::vector<std::string>& words) OVERRIDE; |
35 | 35 |
36 private: | 36 private: |
37 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is | 37 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is |
38 // non-null. This blocks. | 38 // non-null. This blocks. |
39 void InitializeHunspell(); | 39 void InitializeHunspell(); |
40 | 40 |
41 // Add the given custom word to |hunspell_|. | 41 // Add the given custom words to |hunspell_|. |
42 void AddWordToHunspell(const std::string& word); | 42 void AddWordsToHunspell(const std::vector<std::string>& words); |
43 | 43 |
44 // Remove the given custom word from |hunspell_|. | 44 // Remove the given custom words from |hunspell_|. |
45 void RemoveWordFromHunspell(const std::string& word); | 45 void RemoveWordsFromHunspell(const std::vector<std::string>& words); |
46 | 46 |
47 // We memory-map the BDict file. | 47 // We memory-map the BDict file. |
48 scoped_ptr<file_util::MemoryMappedFile> bdict_file_; | 48 scoped_ptr<file_util::MemoryMappedFile> bdict_file_; |
49 | 49 |
50 // The hunspell dictionary in use. | 50 // The hunspell dictionary in use. |
51 scoped_ptr<Hunspell> hunspell_; | 51 scoped_ptr<Hunspell> hunspell_; |
52 | 52 |
53 chrome::spellcheck_common::WordList custom_words_; | 53 chrome::spellcheck_common::WordList custom_words_; |
54 | 54 |
55 base::PlatformFile file_; | 55 base::PlatformFile file_; |
56 | 56 |
57 // This flags is true if we have been intialized. | 57 // This flags is true if we have been initialized. |
58 // The value indicates whether we should request a | 58 // The value indicates whether we should request a |
59 // dictionary from the browser when the render view asks us to check the | 59 // dictionary from the browser when the render view asks us to check the |
60 // spelling of a word. | 60 // spelling of a word. |
61 bool initialized_; | 61 bool initialized_; |
62 | 62 |
63 // This flags is true if we have requested dictionary. | 63 // This flags is true if we have requested dictionary. |
64 bool dictionary_requested_; | 64 bool dictionary_requested_; |
65 | 65 |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ | 68 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ |
69 | 69 |
OLD | NEW |