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

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

Issue 397014: Revert 31875 to see whether it fixes reliability bot. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/spellchecker/spellcheck.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ 5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_
6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ 6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "base/platform_file.h" 13 #include "base/file_descriptor_posix.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" 16 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h"
17 #include "unicode/uscript.h" 17 #include "unicode/uscript.h"
18 18
19 class Hunspell; 19 class Hunspell;
20 20
21 namespace base {
22 class FileDescriptor;
23 }
24
21 namespace file_util { 25 namespace file_util {
22 class MemoryMappedFile; 26 class MemoryMappedFile;
23 } 27 }
24 28
25 class SpellCheck { 29 class SpellCheck {
26 public: 30 public:
27 SpellCheck(); 31 SpellCheck();
28 32
29 ~SpellCheck(); 33 ~SpellCheck();
30 34
31 void Init(base::PlatformFile file, 35 void Init(const base::FileDescriptor& bdict_fd,
32 const std::vector<std::string>& custom_words, 36 const std::vector<std::string>& custom_words,
33 const std::string language); 37 const std::string language);
34 38
35 // SpellCheck a word. 39 // SpellCheck a word.
36 // Returns true if spelled correctly, false otherwise. 40 // Returns true if spelled correctly, false otherwise.
37 // If the spellchecker failed to initialize, always returns true. 41 // If the spellchecker failed to initialize, always returns true.
38 // The |tag| parameter should either be a unique identifier for the document 42 // The |tag| parameter should either be a unique identifier for the document
39 // that the word came from (if the current platform requires it), or 0. 43 // that the word came from (if the current platform requires it), or 0.
40 // In addition, finds the suggested words for a given word 44 // In addition, finds the suggested words for a given word
41 // and puts them into |*optional_suggestions|. 45 // and puts them into |*optional_suggestions|.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 94
91 // Add the given custom word to |hunspell_|. 95 // Add the given custom word to |hunspell_|.
92 void AddWordToHunspell(const std::string& word); 96 void AddWordToHunspell(const std::string& word);
93 97
94 // We memory-map the BDict file. 98 // We memory-map the BDict file.
95 scoped_ptr<file_util::MemoryMappedFile> bdict_file_; 99 scoped_ptr<file_util::MemoryMappedFile> bdict_file_;
96 100
97 // The hunspell dictionary in use. 101 // The hunspell dictionary in use.
98 scoped_ptr<Hunspell> hunspell_; 102 scoped_ptr<Hunspell> hunspell_;
99 103
100 base::PlatformFile file_; 104 base::FileDescriptor fd_;
101 std::vector<std::string> custom_words_; 105 std::vector<std::string> custom_words_;
102 106
103 // Represents character attributes used for filtering out characters which 107 // Represents character attributes used for filtering out characters which
104 // are not supported by this SpellCheck object. 108 // are not supported by this SpellCheck object.
105 SpellcheckCharAttribute character_attributes_; 109 SpellcheckCharAttribute character_attributes_;
106 110
107 // Remember state for auto spell correct. 111 // Remember state for auto spell correct.
108 bool auto_spell_correct_turned_on_; 112 bool auto_spell_correct_turned_on_;
109 113
110 // True if a platform-specific spellchecking engine is being used, 114 // True if a platform-specific spellchecking engine is being used,
111 // and False if hunspell is being used. 115 // and False if hunspell is being used.
112 bool is_using_platform_spelling_engine_; 116 bool is_using_platform_spelling_engine_;
113 117
114 // This flags whether we have ever been initialized, or have asked the browser 118 // This flags whether we have ever been initialized, or have asked the browser
115 // for a dictionary. The value indicates whether we should request a 119 // for a dictionary. The value indicates whether we should request a
116 // dictionary from the browser when the render view asks us to check the 120 // dictionary from the browser when the render view asks us to check the
117 // spelling of a word. 121 // spelling of a word.
118 bool initialized_; 122 bool initialized_;
119 123
120 DISALLOW_COPY_AND_ASSIGN(SpellCheck); 124 DISALLOW_COPY_AND_ASSIGN(SpellCheck);
121 }; 125 };
122 126
123 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ 127 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/spellchecker/spellcheck.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698