Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h

Issue 2931443003: Add support for Android spellcheck menu in Chrome/WebViews (Closed)
Patch Set: Respond to latest comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/EphemeralRange.h"
11 #include "core/editing/VisiblePosition.h"
12 #include "core/editing/markers/DocumentMarker.h"
13 #include "platform/heap/Handle.h"
14 #include "public/platform/input_host.mojom-blink.h"
15
16 namespace blink {
17
18 class Document;
19 class LocalFrame;
20
21 // This class handles functionality related to displaying a menu of text
22 // suggestions (e.g. from spellcheck), and performing actions relating to those
23 // suggestions. Android is currently the only platform that has such a menu.
24 class CORE_EXPORT TextSuggestionController final
25 : public GarbageCollectedFinalized<TextSuggestionController>,
26 public DocumentShutdownObserver {
27 USING_GARBAGE_COLLECTED_MIXIN(TextSuggestionController);
28
29 public:
30 explicit TextSuggestionController(LocalFrame&);
31
32 void DocumentAttached(Document*);
33
34 bool IsMenuOpen() const;
35
36 void HandlePotentialMisspelledWordTap(
37 const VisiblePositionInFlatTree& caret_visible_position);
yosin_UTC9 2017/07/20 01:32:19 Please use PositionInFlatTree instead of VisiblePo
38
39 void ApplySpellCheckSuggestion(const WTF::String& suggestion);
yosin_UTC9 2017/07/20 01:32:19 nit: s/WTF::String/String/ L59 uses |WTF::String|
40 void DeleteActiveSuggestionRange();
41 void NewWordAddedToDictionary(const WTF::String& word);
42 void SpellCheckMenuTimeoutCallback();
43 void SuggestionMenuClosed();
44
45 DECLARE_TRACE();
46
47 private:
48 Document& GetDocument() const;
yosin_UTC9 2017/07/20 01:32:19 nit: s/WTF::String/String/ L59 uses |WTF::String|
49 bool IsAvailable() const;
50 LocalFrame& GetFrame() const;
51
52 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
53 FirstMarkerIntersectingRange(const EphemeralRangeInFlatTree&,
54 DocumentMarker::MarkerTypes) const;
55 Optional<std::pair<const Node*, const DocumentMarker*>>
56 FirstMarkerTouchingSelection(DocumentMarker::MarkerTypes) const;
57
58 void AttemptToDeleteActiveSuggestionRange();
59 void ReplaceSpellingMarkerTouchingSelectionWithText(const String&);
60 void ReplaceRangeWithText(const EphemeralRange&, const String& replacement);
61
62 bool is_suggestion_menu_open_;
63 const Member<LocalFrame> frame_;
64 mojom::blink::TextSuggestionHostPtr text_suggestion_host_;
65
66 DISALLOW_COPY_AND_ASSIGN(TextSuggestionController);
67 };
68
69 } // namespace blink
70
71 #endif // TextSuggestionController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698