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 <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" | 10 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" |
9 #include "chrome/renderer/spellchecker/spelling_engine.h" | 11 #include "chrome/renderer/spellchecker/spelling_engine.h" |
10 | 12 |
11 | 13 |
12 SpellcheckLanguage::SpellcheckLanguage() | 14 SpellcheckLanguage::SpellcheckLanguage() |
13 : platform_spelling_engine_(CreateNativeSpellingEngine()) { | 15 : platform_spelling_engine_(CreateNativeSpellingEngine()) { |
14 } | 16 } |
15 | 17 |
16 SpellcheckLanguage::~SpellcheckLanguage() { | 18 SpellcheckLanguage::~SpellcheckLanguage() { |
17 } | 19 } |
18 | 20 |
19 void SpellcheckLanguage::Init(base::File file, const std::string& language) { | 21 void SpellcheckLanguage::Init(base::File file, const std::string& language) { |
20 DCHECK(platform_spelling_engine_.get()); | 22 DCHECK(platform_spelling_engine_.get()); |
21 platform_spelling_engine_->Init(file.Pass()); | 23 platform_spelling_engine_->Init(std::move(file)); |
22 | 24 |
23 character_attributes_.SetDefaultLanguage(language); | 25 character_attributes_.SetDefaultLanguage(language); |
24 text_iterator_.Reset(); | 26 text_iterator_.Reset(); |
25 contraction_iterator_.Reset(); | 27 contraction_iterator_.Reset(); |
26 } | 28 } |
27 | 29 |
28 bool SpellcheckLanguage::InitializeIfNeeded() { | 30 bool SpellcheckLanguage::InitializeIfNeeded() { |
29 DCHECK(platform_spelling_engine_.get()); | 31 DCHECK(platform_spelling_engine_.get()); |
30 return platform_spelling_engine_->InitializeIfNeeded(); | 32 return platform_spelling_engine_->InitializeIfNeeded(); |
31 } | 33 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (!platform_spelling_engine_->CheckSpelling(word, tag)) | 142 if (!platform_spelling_engine_->CheckSpelling(word, tag)) |
141 return false; | 143 return false; |
142 } | 144 } |
143 return true; | 145 return true; |
144 } | 146 } |
145 | 147 |
146 bool SpellcheckLanguage::IsEnabled() { | 148 bool SpellcheckLanguage::IsEnabled() { |
147 DCHECK(platform_spelling_engine_.get()); | 149 DCHECK(platform_spelling_engine_.get()); |
148 return platform_spelling_engine_->IsEnabled(); | 150 return platform_spelling_engine_->IsEnabled(); |
149 } | 151 } |
OLD | NEW |