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 { | |
yosin_UTC9
2017/06/20 01:46:37
Could you move this to .cpp file for ease of debug
| |
48 DCHECK(frame_); | |
49 return *frame_; | |
50 } | |
51 | |
52 void ReplaceActiveSuggestionRange(const String&); | |
53 | |
54 bool suggestion_menu_is_open_; | |
yosin_UTC9
2017/06/20 01:46:37
nit: s/suggetions_menu_is_open_/is_suggestions_men
| |
55 Member<LocalFrame> frame_; | |
yosin_UTC9
2017/06/20 01:46:37
nit: s/Member<LocalFrame>/const Member<LocalFrame>
| |
56 mojom::blink::TextSuggestionHostPtr text_suggestion_host_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(TextSuggestionController); | |
59 }; | |
60 | |
61 } // namespace blink | |
62 | |
63 #endif // TextSuggestionController_h | |
OLD | NEW |