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 THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_SUGGESTION_TEXT_SUGGESTION_BACKEND_IMPL_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_SUGGESTION_TEXT_SUGGESTION_BACKEND_IMPL_H_
7 
8 #include "mojo/public/cpp/bindings/pending_receiver.h"
9 #include "third_party/blink/public/mojom/input/input_messages.mojom-blink.h"
10 #include "third_party/blink/renderer/core/core_export.h"
11 #include "third_party/blink/renderer/platform/heap/persistent.h"
12 
13 namespace blink {
14 
15 class LocalFrame;
16 
17 // Implementation of mojom::blink::TextSuggestionBackend
18 class CORE_EXPORT TextSuggestionBackendImpl final
19     : public mojom::blink::TextSuggestionBackend {
20  public:
21   static void Create(
22       LocalFrame*,
23       mojo::PendingReceiver<mojom::blink::TextSuggestionBackend>);
24 
25   void ApplySpellCheckSuggestion(const String& suggestion) final;
26   void ApplyTextSuggestion(int32_t marker_tag, int32_t suggestion_index) final;
27   void DeleteActiveSuggestionRange() final;
28   void OnNewWordAddedToDictionary(const String& word) final;
29   void OnSuggestionMenuClosed() final;
30   void SuggestionMenuTimeoutCallback(int32_t max_number_of_suggestions) final;
31 
32  private:
33   explicit TextSuggestionBackendImpl(LocalFrame&);
34 
35   WeakPersistent<LocalFrame> frame_;
36 
37   DISALLOW_COPY_AND_ASSIGN(TextSuggestionBackendImpl);
38 };
39 
40 }  // namespace blink
41 
42 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_SUGGESTION_TEXT_SUGGESTION_BACKEND_IMPL_H_
43