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