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 "core/dom/DocumentShutdownObserver.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include "public/platform/input_host.mojom-blink.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class Document; |
| 16 class LocalFrame; |
| 17 |
| 18 // This class handles functionality related to displaying a menu of text |
| 19 // suggestions (e.g. from spellcheck), and performing actions relating to those |
| 20 // suggestions. Android is currently the only platform that has such a menu. |
| 21 class CORE_EXPORT TextSuggestionController final |
| 22 : public GarbageCollectedFinalized<TextSuggestionController>, |
| 23 public DocumentShutdownObserver { |
| 24 USING_GARBAGE_COLLECTED_MIXIN(TextSuggestionController); |
| 25 |
| 26 public: |
| 27 explicit TextSuggestionController(LocalFrame&); |
| 28 |
| 29 void DocumentAttached(Document*); |
| 30 |
| 31 bool IsMenuOpen() const; |
| 32 |
| 33 void HandlePotentialMisspelledWordTap(); |
| 34 |
| 35 void ApplySpellCheckSuggestion(const WTF::String& suggestion); |
| 36 void DeleteActiveSuggestionRange(); |
| 37 void NewWordAddedToDictionary(const WTF::String& word); |
| 38 void SpellCheckMenuTimeoutCallback(); |
| 39 void SuggestionMenuClosed(); |
| 40 |
| 41 DECLARE_TRACE(); |
| 42 |
| 43 private: |
| 44 Document& GetDocument() const; |
| 45 bool IsAvailable() const; |
| 46 |
| 47 LocalFrame& GetFrame() const; |
| 48 |
| 49 void ReplaceActiveSuggestionRange(const String&); |
| 50 |
| 51 bool is_suggestion_menu_open_; |
| 52 const Member<LocalFrame> frame_; |
| 53 mojom::blink::TextSuggestionHostPtr text_suggestion_host_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(TextSuggestionController); |
| 56 }; |
| 57 |
| 58 } // namespace blink |
| 59 |
| 60 #endif // TextSuggestionController_h |
OLD | NEW |