| 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 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class TextCheckerClient; | |
| 39 class WebViewImpl; | 38 class WebViewImpl; |
| 40 | 39 |
| 41 class SpellCheckerClientImpl final : public SpellCheckerClient { | 40 class SpellCheckerClientImpl final : public SpellCheckerClient { |
| 42 public: | 41 public: |
| 43 explicit SpellCheckerClientImpl(WebViewImpl*, TextCheckerClient*); | 42 explicit SpellCheckerClientImpl(WebViewImpl*); |
| 44 | 43 |
| 45 ~SpellCheckerClientImpl() override; | 44 ~SpellCheckerClientImpl() override; |
| 46 | 45 |
| 47 bool isSpellCheckingEnabled() override; | 46 bool isSpellCheckingEnabled() override; |
| 48 void toggleSpellCheckingEnabled() override; | 47 void toggleSpellCheckingEnabled() override; |
| 49 void updateSpellingUIWithMisspelledWord(const String&) override; | 48 void updateSpellingUIWithMisspelledWord(const String&) override; |
| 50 void showSpellingUI(bool show) override; | 49 void showSpellingUI(bool show) override; |
| 51 bool spellingUIIsShowing() override; | 50 bool spellingUIIsShowing() override; |
| 52 | 51 |
| 53 TextCheckerClient& textChecker() override { return *m_textCheckerClient; } | |
| 54 | |
| 55 private: | 52 private: |
| 56 // Returns whether or not the focused control needs spell-checking. | 53 // Returns whether or not the focused control needs spell-checking. |
| 57 // Currently, this function just retrieves the focused node and determines | 54 // Currently, this function just retrieves the focused node and determines |
| 58 // whether or not it is a <textarea> element or an element whose | 55 // whether or not it is a <textarea> element or an element whose |
| 59 // contenteditable attribute is true. | 56 // contenteditable attribute is true. |
| 60 // FIXME: Bug 740540: This code just implements the default behavior | 57 // FIXME: Bug 740540: This code just implements the default behavior |
| 61 // proposed in this issue. We should also retrieve "spellcheck" attributes | 58 // proposed in this issue. We should also retrieve "spellcheck" attributes |
| 62 // for text fields and create a flag to over-write the default behavior. | 59 // for text fields and create a flag to over-write the default behavior. |
| 63 bool shouldSpellcheckByDefault(); | 60 bool shouldSpellcheckByDefault(); |
| 64 | 61 |
| 65 WebViewImpl* m_webView; | 62 WebViewImpl* m_webView; |
| 66 TextCheckerClient* m_textCheckerClient; | |
| 67 | 63 |
| 68 // This flag is set to false if spell check for this editor is manually | 64 // This flag is set to false if spell check for this editor is manually |
| 69 // turned off. The default setting is SpellCheckAutomatic. | 65 // turned off. The default setting is SpellCheckAutomatic. |
| 70 enum { | 66 enum { |
| 71 SpellCheckAutomatic, | 67 SpellCheckAutomatic, |
| 72 SpellCheckForcedOn, | 68 SpellCheckForcedOn, |
| 73 SpellCheckForcedOff | 69 SpellCheckForcedOff |
| 74 } m_spellCheckThisFieldStatus; | 70 } m_spellCheckThisFieldStatus; |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 } // namespace blink | 73 } // namespace blink |
| 78 | 74 |
| 79 #endif | 75 #endif |
| OLD | NEW |