Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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/heap/Handle.h" | |
| 36 #include "platform/text/TextCheckerClient.h" | |
| 37 | 35 |
| 38 namespace blink { | 36 namespace blink { |
| 39 | 37 |
| 38 class TextCheckerClient; | |
| 40 class WebViewImpl; | 39 class WebViewImpl; |
| 41 | 40 |
| 42 class SpellCheckerClientImpl final : public SpellCheckerClient, | 41 class SpellCheckerClientImpl final : public SpellCheckerClient { |
| 43 public TextCheckerClient { | |
| 44 public: | 42 public: |
| 45 explicit SpellCheckerClientImpl(WebViewImpl*); | 43 explicit SpellCheckerClientImpl(WebViewImpl*, TextCheckerClient*); |
|
dcheng
2017/04/02 05:28:25
Nit: remove explicit
Xiaocheng
2017/04/03 17:49:25
Done.
| |
| 46 | 44 |
| 47 ~SpellCheckerClientImpl() override; | 45 ~SpellCheckerClientImpl() override; |
| 48 | 46 |
| 49 bool isSpellCheckingEnabled() override; | 47 bool isSpellCheckingEnabled() override; |
| 50 void toggleSpellCheckingEnabled() override; | 48 void toggleSpellCheckingEnabled() override; |
| 51 void checkSpellingOfString(const String&, | |
| 52 int* misspellingLocation, | |
| 53 int* misspellingLength) override; | |
| 54 void updateSpellingUIWithMisspelledWord(const String&) override; | 49 void updateSpellingUIWithMisspelledWord(const String&) override; |
| 55 void showSpellingUI(bool show) override; | 50 void showSpellingUI(bool show) override; |
| 56 bool spellingUIIsShowing() override; | 51 bool spellingUIIsShowing() override; |
| 57 void requestCheckingOfString(TextCheckingRequest*) override; | |
| 58 void cancelAllPendingRequests() override; | |
| 59 | 52 |
| 60 TextCheckerClient& textChecker() override { return *this; } | 53 TextCheckerClient& textChecker() override { return *m_textCheckerClient; } |
| 61 | 54 |
| 62 private: | 55 private: |
| 63 // Returns whether or not the focused control needs spell-checking. | 56 // Returns whether or not the focused control needs spell-checking. |
| 64 // Currently, this function just retrieves the focused node and determines | 57 // Currently, this function just retrieves the focused node and determines |
| 65 // whether or not it is a <textarea> element or an element whose | 58 // whether or not it is a <textarea> element or an element whose |
| 66 // contenteditable attribute is true. | 59 // contenteditable attribute is true. |
| 67 // FIXME: Bug 740540: This code just implements the default behavior | 60 // FIXME: Bug 740540: This code just implements the default behavior |
| 68 // proposed in this issue. We should also retrieve "spellcheck" attributes | 61 // proposed in this issue. We should also retrieve "spellcheck" attributes |
| 69 // for text fields and create a flag to over-write the default behavior. | 62 // for text fields and create a flag to over-write the default behavior. |
| 70 bool shouldSpellcheckByDefault(); | 63 bool shouldSpellcheckByDefault(); |
| 71 | 64 |
| 72 WebViewImpl* m_webView; | 65 WebViewImpl* m_webView; |
| 66 TextCheckerClient* m_textCheckerClient; | |
| 73 | 67 |
| 74 // This flag is set to false if spell check for this editor is manually | 68 // This flag is set to false if spell check for this editor is manually |
| 75 // turned off. The default setting is SpellCheckAutomatic. | 69 // turned off. The default setting is SpellCheckAutomatic. |
| 76 enum { | 70 enum { |
| 77 SpellCheckAutomatic, | 71 SpellCheckAutomatic, |
| 78 SpellCheckForcedOn, | 72 SpellCheckForcedOn, |
| 79 SpellCheckForcedOff | 73 SpellCheckForcedOff |
| 80 } m_spellCheckThisFieldStatus; | 74 } m_spellCheckThisFieldStatus; |
| 81 }; | 75 }; |
| 82 | 76 |
| 83 } // namespace blink | 77 } // namespace blink |
| 84 | 78 |
| 85 #endif | 79 #endif |
| OLD | NEW |