| 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 #include "chrome/renderer/spellchecker/hunspell_engine.h" | 5 #include "chrome/renderer/spellchecker/hunspell_engine.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Maximum length of words we provide suggestions for. | 24 // Maximum length of words we provide suggestions for. |
| 25 // 24 is the observed limits for OSX system checker. | 25 // 24 is the observed limits for OSX system checker. |
| 26 const size_t kMaxSuggestLen = 24; | 26 const size_t kMaxSuggestLen = 24; |
| 27 | 27 |
| 28 static_assert(kMaxCheckedLen <= size_t(MAXWORDLEN), | 28 static_assert(kMaxCheckedLen <= size_t(MAXWORDLEN), |
| 29 "MaxCheckedLen too long"); | 29 "MaxCheckedLen too long"); |
| 30 static_assert(kMaxSuggestLen <= kMaxCheckedLen, | 30 static_assert(kMaxSuggestLen <= kMaxCheckedLen, |
| 31 "MaxSuggestLen too long"); | 31 "MaxSuggestLen too long"); |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 #if !defined(USE_PLATFORM_SPELLCHECKER) | 34 #if !defined(USE_BROWSER_SPELLCHECKER) |
| 35 SpellingEngine* CreateNativeSpellingEngine() { | 35 SpellingEngine* CreateNativeSpellingEngine() { |
| 36 return new HunspellEngine(); | 36 return new HunspellEngine(); |
| 37 } | 37 } |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 HunspellEngine::HunspellEngine() | 40 HunspellEngine::HunspellEngine() |
| 41 : hunspell_enabled_(false), | 41 : hunspell_enabled_(false), |
| 42 initialized_(false), | 42 initialized_(false), |
| 43 dictionary_requested_(false) { | 43 dictionary_requested_(false) { |
| 44 // Wait till we check the first word before doing any initializing. | 44 // Wait till we check the first word before doing any initializing. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Don't initialize if hunspell is disabled. | 129 // Don't initialize if hunspell is disabled. |
| 130 if (file_.IsValid()) | 130 if (file_.IsValid()) |
| 131 InitializeHunspell(); | 131 InitializeHunspell(); |
| 132 | 132 |
| 133 return !initialized_; | 133 return !initialized_; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool HunspellEngine::IsEnabled() { | 136 bool HunspellEngine::IsEnabled() { |
| 137 return hunspell_enabled_; | 137 return hunspell_enabled_; |
| 138 } | 138 } |
| OLD | NEW |