Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/renderer/spellchecker/hunspell_engine.h

Issue 2159283003: [WIP][DO NOT LAND] Componentize spellcheck Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_
6 #define CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/strings/string16.h"
13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/spellcheck_common.h"
15 #include "chrome/renderer/spellchecker/spelling_engine.h"
16
17 class Hunspell;
18
19 namespace base {
20 class MemoryMappedFile;
21 }
22
23 class HunspellEngine : public SpellingEngine {
24 public:
25 HunspellEngine();
26 ~HunspellEngine() override;
27
28 void Init(base::File file) override;
29
30 bool InitializeIfNeeded() override;
31 bool IsEnabled() override;
32 bool CheckSpelling(const base::string16& word_to_check, int tag) override;
33 void FillSuggestionList(
34 const base::string16& wrong_word,
35 std::vector<base::string16>* optional_suggestions) override;
36
37 private:
38 // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is
39 // non-null. This blocks.
40 void InitializeHunspell();
41
42 // We memory-map the BDict file.
43 std::unique_ptr<base::MemoryMappedFile> bdict_file_;
44
45 // The hunspell dictionary in use.
46 std::unique_ptr<Hunspell> hunspell_;
47
48 base::File file_;
49
50 // This flag is true if hunspell is enabled.
51 bool hunspell_enabled_;
52
53 // This flag is true if we have been initialized.
54 // The value indicates whether we should request a
55 // dictionary from the browser when the render view asks us to check the
56 // spelling of a word.
57 bool initialized_;
58
59 // This flag is true if we have requested dictionary.
60 bool dictionary_requested_;
61 };
62
63 #endif // CHROME_RENDERER_SPELLCHECKER_HUNSPELL_ENGINE_H_
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc ('k') | chrome/renderer/spellchecker/hunspell_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698