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