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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_SPELLCHECKER_CUSTOM_DICTIONARY_ENGINE_H_
6 #define CHROME_RENDERER_SPELLCHECKER_CUSTOM_DICTIONARY_ENGINE_H_
12 #include "base/strings/string16.h"
14 // Custom spellcheck dictionary. Words in this dictionary are always correctly
15 // spelled. Words that are not in this dictionary may or may not be correctly
17 class CustomDictionaryEngine
{
19 CustomDictionaryEngine();
20 ~CustomDictionaryEngine();
22 // Initialize the custom dictionary engine.
23 void Init(const std::set
<std::string
>& words
);
25 // Spellcheck |text|. Assumes that another spelling engine has set
26 // |misspelling_start| and |misspelling_len| to indicate a misspelling.
27 // Returns true if there are no misspellings, otherwise returns false.
28 bool SpellCheckWord(const base::string16
& text
,
29 int misspelling_start
,
32 // Update custom dictionary words.
33 void OnCustomDictionaryChanged(
34 const std::vector
<std::string
>& words_added
,
35 const std::vector
<std::string
>& words_removed
);
38 // Correctly spelled words.
39 std::set
<base::string16
> dictionary_
;
41 DISALLOW_COPY_AND_ASSIGN(CustomDictionaryEngine
);
44 #endif // CHROME_RENDERER_SPELLCHECKER_CUSTOM_DICTIONARY_ENGINE_H_