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/editing/TextSuggestionInfo.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include "public/platform/WebVector.h" |
| 12 #include "public/platform/input_host.mojom-blink.h" |
| 13 #include "public/web/WebTextSuggestionInfo.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class Document; |
| 18 class LocalFrame; |
| 19 |
| 20 class CORE_EXPORT TextSuggestionController final |
| 21 : public GarbageCollectedFinalized<TextSuggestionController> { |
| 22 WTF_MAKE_NONCOPYABLE(TextSuggestionController); |
| 23 |
| 24 public: |
| 25 static TextSuggestionController* create(LocalFrame&); |
| 26 DECLARE_TRACE(); |
| 27 |
| 28 bool suggestionMenuIsOpen() const; |
| 29 |
| 30 void applySuggestionReplacement(int documentMarkerID, int suggestionIndex); |
| 31 void deleteSuggestionHighlight(); |
| 32 void suggestionMenuClosed(); |
| 33 |
| 34 void handlePotentialTextSuggestionTap(); |
| 35 void prepareForTextSuggestionMenuToBeShown(); |
| 36 void removeSuggestionMarkersAffectedByEditing( |
| 37 bool doNotRemoveIfSelectionAtWordBoundary); |
| 38 |
| 39 private: |
| 40 Document& document() const; |
| 41 bool isAvailable() const; |
| 42 |
| 43 LocalFrame& frame() const { |
| 44 DCHECK(m_frame); |
| 45 return *m_frame; |
| 46 } |
| 47 |
| 48 explicit TextSuggestionController(LocalFrame& frame); |
| 49 |
| 50 Vector<blink::TextSuggestionInfo> |
| 51 getTextSuggestionInfosUnderCaretAndAddHighlight() const; |
| 52 |
| 53 bool m_suggestionMenuIsOpen; |
| 54 Member<LocalFrame> m_frame; |
| 55 mojom::blink::TextSuggestionHostPtr text_suggestion_host_; |
| 56 }; |
| 57 |
| 58 } // namespace blink |
| 59 |
| 60 #endif // TextSuggestionController_h |
OLD | NEW |