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/spellcheck_language.h" | 5 #include "chrome/renderer/spellchecker/spellcheck_language.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" | 8 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" |
9 #include "chrome/renderer/spellchecker/spelling_engine.h" | 9 #include "chrome/renderer/spellchecker/spelling_engine.h" |
10 | 10 |
11 | 11 |
12 SpellcheckLanguage::SpellcheckLanguage() | 12 SpellcheckLanguage::SpellcheckLanguage() |
13 : platform_spelling_engine_(CreateNativeSpellingEngine()) { | 13 : platform_spelling_engine_(CreateNativeSpellingEngine()) { |
14 } | 14 } |
15 | 15 |
16 SpellcheckLanguage::~SpellcheckLanguage() { | 16 SpellcheckLanguage::~SpellcheckLanguage() { |
17 } | 17 } |
18 | 18 |
19 void SpellcheckLanguage::Init( | 19 void SpellcheckLanguage::Init(base::File file, const std::string& language) { |
20 base::PlatformFile file, | |
21 const std::string& language) { | |
22 DCHECK(platform_spelling_engine_.get()); | 20 DCHECK(platform_spelling_engine_.get()); |
23 platform_spelling_engine_->Init(file); | 21 platform_spelling_engine_->Init(file.Pass()); |
24 | 22 |
25 character_attributes_.SetDefaultLanguage(language); | 23 character_attributes_.SetDefaultLanguage(language); |
26 text_iterator_.Reset(); | 24 text_iterator_.Reset(); |
27 contraction_iterator_.Reset(); | 25 contraction_iterator_.Reset(); |
28 } | 26 } |
29 | 27 |
30 bool SpellcheckLanguage::InitializeIfNeeded() { | 28 bool SpellcheckLanguage::InitializeIfNeeded() { |
31 DCHECK(platform_spelling_engine_.get()); | 29 DCHECK(platform_spelling_engine_.get()); |
32 return platform_spelling_engine_->InitializeIfNeeded(); | 30 return platform_spelling_engine_->InitializeIfNeeded(); |
33 } | 31 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (!platform_spelling_engine_->CheckSpelling(word, tag)) | 116 if (!platform_spelling_engine_->CheckSpelling(word, tag)) |
119 return false; | 117 return false; |
120 } | 118 } |
121 return true; | 119 return true; |
122 } | 120 } |
123 | 121 |
124 bool SpellcheckLanguage::IsEnabled() { | 122 bool SpellcheckLanguage::IsEnabled() { |
125 DCHECK(platform_spelling_engine_.get()); | 123 DCHECK(platform_spelling_engine_.get()); |
126 return platform_spelling_engine_->IsEnabled(); | 124 return platform_spelling_engine_->IsEnabled(); |
127 } | 125 } |
OLD | NEW |