Chromium Code Reviews| 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..36b8480d7824ffb4ba797428adb3258ed5d1b4c5 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h |
| @@ -0,0 +1,63 @@ |
| +// 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 "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(); |
| + |
| + void ApplySpellCheckSuggestion(const WTF::String& suggestion); |
| + void DeleteActiveSuggestionRange(); |
| + void NewWordAddedToDictionary(const WTF::String& word); |
| + void SpellCheckMenuTimeoutCallback(); |
| + void SuggestionMenuClosed(); |
| + |
| + DECLARE_TRACE(); |
| + |
| + private: |
| + Document& GetDocument() const; |
| + bool IsAvailable() const; |
| + |
| + LocalFrame& GetFrame() const { |
|
yosin_UTC9
2017/06/20 01:46:37
Could you move this to .cpp file for ease of debug
|
| + DCHECK(frame_); |
| + return *frame_; |
| + } |
| + |
| + void ReplaceActiveSuggestionRange(const String&); |
| + |
| + bool suggestion_menu_is_open_; |
|
yosin_UTC9
2017/06/20 01:46:37
nit: s/suggetions_menu_is_open_/is_suggestions_men
|
| + Member<LocalFrame> frame_; |
|
yosin_UTC9
2017/06/20 01:46:37
nit: s/Member<LocalFrame>/const Member<LocalFrame>
|
| + mojom::blink::TextSuggestionHostPtr text_suggestion_host_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TextSuggestionController); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // TextSuggestionController_h |