| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SpellCheckerClientImpl_h | 31 #ifndef SpellCheckerClientImpl_h |
| 32 #define SpellCheckerClientImpl_h | 32 #define SpellCheckerClientImpl_h |
| 33 | 33 |
| 34 #include "core/page/SpellCheckerClient.h" | 34 #include "core/page/SpellCheckerClient.h" |
| 35 #include "platform/text/TextCheckerClient.h" | 35 #include "platform/text/TextCheckerClient.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 |
| 38 class LocalFrame; | 39 class LocalFrame; |
| 39 class HTMLInputElement; | 40 class HTMLInputElement; |
| 40 } | |
| 41 | |
| 42 namespace blink { | |
| 43 class WebViewImpl; | 41 class WebViewImpl; |
| 44 | 42 |
| 45 class SpellCheckerClientImpl FINAL : public blink::SpellCheckerClient, public bl
ink::TextCheckerClient { | 43 class SpellCheckerClientImpl FINAL : public SpellCheckerClient, public TextCheck
erClient { |
| 46 public: | 44 public: |
| 47 explicit SpellCheckerClientImpl(WebViewImpl*); | 45 explicit SpellCheckerClientImpl(WebViewImpl*); |
| 48 | 46 |
| 49 virtual ~SpellCheckerClientImpl(); | 47 virtual ~SpellCheckerClientImpl(); |
| 50 | 48 |
| 51 virtual bool isContinuousSpellCheckingEnabled() OVERRIDE; | 49 virtual bool isContinuousSpellCheckingEnabled() OVERRIDE; |
| 52 virtual void toggleContinuousSpellChecking() OVERRIDE; | 50 virtual void toggleContinuousSpellChecking() OVERRIDE; |
| 53 virtual bool isGrammarCheckingEnabled() OVERRIDE; | 51 virtual bool isGrammarCheckingEnabled() OVERRIDE; |
| 54 virtual bool shouldEraseMarkersAfterChangeSelection(blink::TextCheckingType)
const OVERRIDE; | 52 virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const
OVERRIDE; |
| 55 virtual void checkSpellingOfString(const String&, int* misspellingLocation,
int* misspellingLength) OVERRIDE; | 53 virtual void checkSpellingOfString(const String&, int* misspellingLocation,
int* misspellingLength) OVERRIDE; |
| 56 virtual void checkGrammarOfString(const String&, WTF::Vector<blink::GrammarD
etail>&, | 54 virtual void checkGrammarOfString(const String&, WTF::Vector<GrammarDetail>&
, |
| 57 int* badGrammarLocation, int* badGrammarLength) OVERRIDE; | 55 int* badGrammarLocation, int* badGrammarLength) OVERRIDE; |
| 58 virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::Str
ing&) OVERRIDE; | 56 virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::Str
ing&) OVERRIDE; |
| 59 virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE
; | 57 virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE
; |
| 60 virtual void showSpellingUI(bool show) OVERRIDE; | 58 virtual void showSpellingUI(bool show) OVERRIDE; |
| 61 virtual bool spellingUIIsShowing() OVERRIDE; | 59 virtual bool spellingUIIsShowing() OVERRIDE; |
| 62 virtual void requestCheckingOfString(WTF::PassRefPtr<blink::TextCheckingRequ
est>) OVERRIDE; | 60 virtual void requestCheckingOfString(WTF::PassRefPtr<TextCheckingRequest>) O
VERRIDE; |
| 63 | 61 |
| 64 virtual blink::TextCheckerClient& textChecker() OVERRIDE { return *this; } | 62 virtual TextCheckerClient& textChecker() OVERRIDE { return *this; } |
| 65 | 63 |
| 66 private: | 64 private: |
| 67 // Returns whether or not the focused control needs spell-checking. | 65 // Returns whether or not the focused control needs spell-checking. |
| 68 // Currently, this function just retrieves the focused node and determines | 66 // Currently, this function just retrieves the focused node and determines |
| 69 // whether or not it is a <textarea> element or an element whose | 67 // whether or not it is a <textarea> element or an element whose |
| 70 // contenteditable attribute is true. | 68 // contenteditable attribute is true. |
| 71 // FIXME: Bug 740540: This code just implements the default behavior | 69 // FIXME: Bug 740540: This code just implements the default behavior |
| 72 // proposed in this issue. We should also retrieve "spellcheck" attributes | 70 // proposed in this issue. We should also retrieve "spellcheck" attributes |
| 73 // for text fields and create a flag to over-write the default behavior. | 71 // for text fields and create a flag to over-write the default behavior. |
| 74 bool shouldSpellcheckByDefault(); | 72 bool shouldSpellcheckByDefault(); |
| 75 | 73 |
| 76 WebViewImpl* m_webView; | 74 WebViewImpl* m_webView; |
| 77 | 75 |
| 78 // This flag is set to false if spell check for this editor is manually | 76 // This flag is set to false if spell check for this editor is manually |
| 79 // turned off. The default setting is SpellCheckAutomatic. | 77 // turned off. The default setting is SpellCheckAutomatic. |
| 80 enum { | 78 enum { |
| 81 SpellCheckAutomatic, | 79 SpellCheckAutomatic, |
| 82 SpellCheckForcedOn, | 80 SpellCheckForcedOn, |
| 83 SpellCheckForcedOff | 81 SpellCheckForcedOff |
| 84 } m_spellCheckThisFieldStatus; | 82 } m_spellCheckThisFieldStatus; |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 } // namespace blink | 85 } // namespace blink |
| 88 | 86 |
| 89 #endif | 87 #endif |
| OLD | NEW |