| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 WebSpellCheckClient_h | 31 #ifndef WebSpellCheckClient_h |
| 32 #define WebSpellCheckClient_h | 32 #define WebSpellCheckClient_h |
| 33 | 33 |
| 34 #include "../platform/WebString.h" | 34 #include "public/platform/WebString.h" |
| 35 #include "../platform/WebVector.h" | |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 class WebString; | 38 // TODO(xiaochengh): Renaming WebSpellCheckClient to WebSpellingUIClient. |
| 40 class WebTextCheckingCompletion; | |
| 41 | |
| 42 class WebSpellCheckClient { | 39 class WebSpellCheckClient { |
| 43 public: | 40 public: |
| 44 // The client should perform spell-checking on the given text. If the | |
| 45 // text contains a misspelled word, then upon return misspelledOffset | |
| 46 // will point to the start of the misspelled word, and misspelledLength | |
| 47 // will indicates its length. Otherwise, if there was not a spelling | |
| 48 // error, then upon return misspelledLength is 0. If optional_suggestions | |
| 49 // is given, then it will be filled with suggested words (not a cheap step). | |
| 50 virtual void checkSpelling(const WebString& text, | |
| 51 int& misspelledOffset, | |
| 52 int& misspelledLength, | |
| 53 WebVector<WebString>* optionalSuggestions) {} | |
| 54 | |
| 55 // Requests asynchronous spelling and grammar checking, whose result should be | |
| 56 // returned by passed completion object. | |
| 57 virtual void requestCheckingOfText( | |
| 58 const WebString& textToCheck, | |
| 59 WebTextCheckingCompletion* completionCallback) {} | |
| 60 | |
| 61 // Clear all stored references to requests, so that it will not become a | |
| 62 // leak source. | |
| 63 virtual void cancelAllPendingRequests() {} | |
| 64 | |
| 65 // Show or hide the spelling UI. | 41 // Show or hide the spelling UI. |
| 66 virtual void showSpellingUI(bool show) {} | 42 virtual void showSpellingUI(bool show) {} |
| 67 | 43 |
| 68 // Returns true if the spelling UI is showing. | 44 // Returns true if the spelling UI is showing. |
| 69 virtual bool isShowingSpellingUI() { return false; } | 45 virtual bool isShowingSpellingUI() { return false; } |
| 70 | 46 |
| 71 // Update the spelling UI with the given word. | 47 // Update the spelling UI with the given word. |
| 72 virtual void updateSpellingUIWithMisspelledWord(const WebString& word) {} | 48 virtual void updateSpellingUIWithMisspelledWord(const WebString& word) {} |
| 73 | 49 |
| 74 protected: | 50 protected: |
| 75 ~WebSpellCheckClient() {} | 51 virtual ~WebSpellCheckClient() {} |
| 76 }; | 52 }; |
| 77 | 53 |
| 78 } // namespace blink | 54 } // namespace blink |
| 79 | 55 |
| 80 #endif | 56 #endif |
| OLD | NEW |