| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 void Init(base::File file) override; | 28 void Init(base::File file) override; |
| 29 | 29 |
| 30 bool InitializeIfNeeded() override; | 30 bool InitializeIfNeeded() override; |
| 31 bool IsEnabled() override; | 31 bool IsEnabled() override; |
| 32 bool CheckSpelling(const base::string16& word_to_check, int tag) override; | 32 bool CheckSpelling(const base::string16& word_to_check, int tag) override; |
| 33 void FillSuggestionList( | 33 void FillSuggestionList( |
| 34 const base::string16& wrong_word, | 34 const base::string16& wrong_word, |
| 35 std::vector<base::string16>* optional_suggestions) override; | 35 std::vector<base::string16>* optional_suggestions) override; |
| 36 | 36 |
| 37 Hunspell* get_hunspell() { |
| 38 LOG(ERROR) << "It woiks!"; |
| 39 return hunspell_.get(); |
| 40 } |
| 41 |
| 37 private: | 42 private: |
| 38 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is | 43 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is |
| 39 // non-null. This blocks. | 44 // non-null. This blocks. |
| 40 void InitializeHunspell(); | 45 void InitializeHunspell(); |
| 41 | 46 |
| 42 // We memory-map the BDict file. | 47 // We memory-map the BDict file. |
| 43 std::unique_ptr<base::MemoryMappedFile> bdict_file_; | 48 std::unique_ptr<base::MemoryMappedFile> bdict_file_; |
| 44 | 49 |
| 45 // The hunspell dictionary in use. | 50 // The hunspell dictionary in use. |
| 46 std::unique_ptr<Hunspell> hunspell_; | 51 std::unique_ptr<Hunspell> hunspell_; |
| 47 | 52 |
| 48 base::File file_; | 53 base::File file_; |
| 49 | 54 |
| 50 // This flag is true if hunspell is enabled. | 55 // This flag is true if hunspell is enabled. |
| 51 bool hunspell_enabled_; | 56 bool hunspell_enabled_; |
| 52 | 57 |
| 53 // This flag is true if we have been initialized. | 58 // This flag is true if we have been initialized. |
| 54 // The value indicates whether we should request a | 59 // The value indicates whether we should request a |
| 55 // 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 |
| 56 // spelling of a word. | 61 // spelling of a word. |
| 57 bool initialized_; | 62 bool initialized_; |
| 58 | 63 |
| 59 // This flag is true if we have requested dictionary. | 64 // This flag is true if we have requested dictionary. |
| 60 bool dictionary_requested_; | 65 bool dictionary_requested_; |
| 61 }; | 66 }; |
| 62 | 67 |
| 63 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ | 68 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_ |
| OLD | NEW |