OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TextSuggestionController_h |
| 6 #define TextSuggestionController_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "public/platform/input_host.mojom-blink.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class Document; |
| 15 class LocalFrame; |
| 16 |
| 17 // This class handles functionality related to displaying a menu of text |
| 18 // suggestions (e.g. from spellcheck), and performing actions relating to those |
| 19 // suggestions. Android is currently the only platform that has such a menu. |
| 20 class CORE_EXPORT TextSuggestionController final |
| 21 : public GarbageCollectedFinalized<TextSuggestionController> { |
| 22 WTF_MAKE_NONCOPYABLE(TextSuggestionController); |
| 23 |
| 24 public: |
| 25 explicit TextSuggestionController(LocalFrame&); |
| 26 |
| 27 bool IsMenuOpen() const; |
| 28 |
| 29 void HandlePotentialMisspelledWordTap(); |
| 30 |
| 31 void ApplySpellCheckSuggestion(const WTF::String& suggestion); |
| 32 void DeleteActiveSuggestionRange(); |
| 33 void NewWordAddedToDictionary(const WTF::String& word); |
| 34 void SpellCheckMenuTimeoutCallback(); |
| 35 void SuggestionMenuClosed(); |
| 36 |
| 37 DECLARE_TRACE(); |
| 38 |
| 39 private: |
| 40 Document& GetDocument() const; |
| 41 bool IsAvailable() const; |
| 42 |
| 43 LocalFrame& GetFrame() const { |
| 44 DCHECK(frame_); |
| 45 return *frame_; |
| 46 } |
| 47 |
| 48 void ReplaceActiveSuggestionRange(const String&); |
| 49 |
| 50 bool suggestion_menu_is_open_; |
| 51 Member<LocalFrame> frame_; |
| 52 mojom::blink::TextSuggestionHostPtr text_suggestion_host_; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // TextSuggestionController_h |
OLD | NEW |