Index: third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h |
diff --git a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7a901cf8782e0c9baf91e83e6c2113b6849286ce |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef TextSuggestionController_h |
+#define TextSuggestionController_h |
+ |
+#include "core/CoreExport.h" |
+#include "core/dom/DocumentShutdownObserver.h" |
+#include "core/editing/EphemeralRange.h" |
+#include "core/editing/VisiblePosition.h" |
+#include "core/editing/markers/DocumentMarker.h" |
+#include "platform/heap/Handle.h" |
+#include "public/platform/input_host.mojom-blink.h" |
+ |
+namespace blink { |
+ |
+class Document; |
+class LocalFrame; |
+ |
+// This class handles functionality related to displaying a menu of text |
+// suggestions (e.g. from spellcheck), and performing actions relating to those |
+// suggestions. Android is currently the only platform that has such a menu. |
+class CORE_EXPORT TextSuggestionController final |
+ : public GarbageCollectedFinalized<TextSuggestionController>, |
+ public DocumentShutdownObserver { |
+ USING_GARBAGE_COLLECTED_MIXIN(TextSuggestionController); |
+ |
+ public: |
+ explicit TextSuggestionController(LocalFrame&); |
+ |
+ void DocumentAttached(Document*); |
+ |
+ bool IsMenuOpen() const; |
+ |
+ void HandlePotentialMisspelledWordTap( |
+ const VisiblePositionInFlatTree& caret_visible_position); |
yosin_UTC9
2017/07/20 01:32:19
Please use PositionInFlatTree instead of VisiblePo
|
+ |
+ void ApplySpellCheckSuggestion(const WTF::String& suggestion); |
yosin_UTC9
2017/07/20 01:32:19
nit: s/WTF::String/String/
L59 uses |WTF::String|
|
+ void DeleteActiveSuggestionRange(); |
+ void NewWordAddedToDictionary(const WTF::String& word); |
+ void SpellCheckMenuTimeoutCallback(); |
+ void SuggestionMenuClosed(); |
+ |
+ DECLARE_TRACE(); |
+ |
+ private: |
+ Document& GetDocument() const; |
yosin_UTC9
2017/07/20 01:32:19
nit: s/WTF::String/String/
L59 uses |WTF::String|
|
+ bool IsAvailable() const; |
+ LocalFrame& GetFrame() const; |
+ |
+ Optional<std::pair<const Node*, const DocumentMarker*>> |
yosin_UTC9
2017/07/20 01:32:19
I think it is better to use |pair.first == nullptr
|
+ FirstMarkerIntersectingRange(const EphemeralRangeInFlatTree&, |
+ DocumentMarker::MarkerTypes) const; |
+ Optional<std::pair<const Node*, const DocumentMarker*>> |
+ FirstMarkerTouchingSelection(DocumentMarker::MarkerTypes) const; |
+ |
+ void AttemptToDeleteActiveSuggestionRange(); |
+ void ReplaceSpellingMarkerTouchingSelectionWithText(const String&); |
+ void ReplaceRangeWithText(const EphemeralRange&, const String& replacement); |
+ |
+ bool is_suggestion_menu_open_; |
+ const Member<LocalFrame> frame_; |
+ mojom::blink::TextSuggestionHostPtr text_suggestion_host_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TextSuggestionController); |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // TextSuggestionController_h |