| 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 #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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" | 17 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" |
| 18 #include "content/public/renderer/render_process_observer.h" | 18 #include "content/public/renderer/render_process_observer.h" |
| 19 #include "ipc/ipc_platform_file.h" | 19 #include "ipc/ipc_platform_file.h" |
| 20 #include "unicode/uscript.h" | 20 #include "unicode/uscript.h" |
| 21 | 21 |
| 22 class Hunspell; | 22 class Hunspell; |
| 23 struct SpellCheckResult; |
| 23 | 24 |
| 24 namespace file_util { | 25 namespace file_util { |
| 25 class MemoryMappedFile; | 26 class MemoryMappedFile; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace WebKit { | |
| 29 struct WebTextCheckingResult; | |
| 30 } | |
| 31 | |
| 32 // TODO(morrita): Needs reorg with SpellCheckProvider. | 29 // TODO(morrita): Needs reorg with SpellCheckProvider. |
| 33 // See http://crbug.com/73699. | 30 // See http://crbug.com/73699. |
| 34 class SpellCheck : public content::RenderProcessObserver { | 31 class SpellCheck : public content::RenderProcessObserver { |
| 35 public: | 32 public: |
| 36 SpellCheck(); | 33 SpellCheck(); |
| 37 virtual ~SpellCheck(); | 34 virtual ~SpellCheck(); |
| 38 | 35 |
| 39 void Init(base::PlatformFile file, | 36 void Init(base::PlatformFile file, |
| 40 const std::vector<std::string>& custom_words, | 37 const std::vector<std::string>& custom_words, |
| 41 const std::string& language); | 38 const std::string& language); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 57 int* misspelling_len, | 54 int* misspelling_len, |
| 58 std::vector<string16>* optional_suggestions); | 55 std::vector<string16>* optional_suggestions); |
| 59 | 56 |
| 60 // SpellCheck a paragrpah. | 57 // SpellCheck a paragrpah. |
| 61 // Returns true if |text| is correctly spelled, false otherwise. | 58 // Returns true if |text| is correctly spelled, false otherwise. |
| 62 // If the spellchecker failed to initialize, always returns true. | 59 // If the spellchecker failed to initialize, always returns true. |
| 63 // The |tag| parameter should either be a unique identifier for the document, | 60 // The |tag| parameter should either be a unique identifier for the document, |
| 64 // or 0. | 61 // or 0. |
| 65 bool SpellCheckParagraph(const string16& text, | 62 bool SpellCheckParagraph(const string16& text, |
| 66 int tag, | 63 int tag, |
| 67 std::vector<WebKit::WebTextCheckingResult>* results); | 64 std::vector<SpellCheckResult>* results); |
| 68 | 65 |
| 69 // Find a possible correctly spelled word for a misspelled word. Computes an | 66 // Find a possible correctly spelled word for a misspelled word. Computes an |
| 70 // empty string if input misspelled word is too long, there is ambiguity, or | 67 // empty string if input misspelled word is too long, there is ambiguity, or |
| 71 // the correct spelling cannot be determined. | 68 // the correct spelling cannot be determined. |
| 72 // NOTE: If using the platform spellchecker, this will send a *lot* of sync | 69 // NOTE: If using the platform spellchecker, this will send a *lot* of sync |
| 73 // IPCs. We should probably refactor this if we ever plan to take it out from | 70 // IPCs. We should probably refactor this if we ever plan to take it out from |
| 74 // behind its command line flag. | 71 // behind its command line flag. |
| 75 string16 GetAutoCorrectionWord(const string16& word, int tag); | 72 string16 GetAutoCorrectionWord(const string16& word, int tag); |
| 76 | 73 |
| 77 // Returns true if the spellchecker delegate checking to a system-provided | 74 // Returns true if the spellchecker delegate checking to a system-provided |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // This flags whether we have ever been initialized, or have asked the browser | 150 // This flags whether we have ever been initialized, or have asked the browser |
| 154 // for a dictionary. The value indicates whether we should request a | 151 // for a dictionary. The value indicates whether we should request a |
| 155 // dictionary from the browser when the render view asks us to check the | 152 // dictionary from the browser when the render view asks us to check the |
| 156 // spelling of a word. | 153 // spelling of a word. |
| 157 bool initialized_; | 154 bool initialized_; |
| 158 | 155 |
| 159 DISALLOW_COPY_AND_ASSIGN(SpellCheck); | 156 DISALLOW_COPY_AND_ASSIGN(SpellCheck); |
| 160 }; | 157 }; |
| 161 | 158 |
| 162 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ | 159 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ |
| OLD | NEW |