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 TEXT_SUGGESTION_HOST_ANDROID_H_ | |
aelias_OOO_until_Jul13
2017/06/20 02:55:03
nit: standard format for this encodes the full pat
| |
6 #define TEXT_SUGGESTION_HOST_ANDROID_H_ | |
7 | |
8 #include "content/browser/android/render_widget_host_connector.h" | |
9 #include "content/browser/renderer_host/input/timeout_monitor.h" | |
10 #include "third_party/WebKit/public/platform/input_host.mojom.h" | |
11 #include "third_party/WebKit/public/platform/input_messages.mojom.h" | |
12 | |
13 namespace content { | |
14 | |
15 class TextSuggestionHostAndroid : public RenderWidgetHostConnector { | |
16 public: | |
17 TextSuggestionHostAndroid(JNIEnv* env, | |
18 const base::android::JavaParamRef<jobject>& obj, | |
19 WebContents* web_contents); | |
20 ~TextSuggestionHostAndroid() override; | |
21 | |
22 // RenderWidgetHostConnector implementation. | |
23 void UpdateRenderProcessConnection( | |
24 RenderWidgetHostViewAndroid* old_rwhva, | |
25 RenderWidgetHostViewAndroid* new_rhwva) override; | |
26 | |
27 // Called from Java -> native | |
28 void ApplySpellCheckSuggestion( | |
29 JNIEnv*, | |
30 const base::android::JavaParamRef<jobject>&, | |
31 const base::android::JavaParamRef<jstring>& replacement); | |
32 void DeleteActiveSuggestionRange(JNIEnv*, | |
33 const base::android::JavaParamRef<jobject>&); | |
34 void NewWordAddedToDictionary( | |
35 JNIEnv*, | |
36 const base::android::JavaParamRef<jobject>&, | |
37 const base::android::JavaParamRef<jstring>& word); | |
38 void SuggestionMenuClosed(JNIEnv*, | |
39 const base::android::JavaParamRef<jobject>&); | |
40 | |
41 // Called from native -> Java | |
42 void ShowSpellCheckSuggestionMenu( | |
43 double caret_x, | |
44 double caret_y, | |
45 const std::string& marked_text, | |
46 const std::vector<blink::mojom::SpellCheckSuggestionPtr>& suggestions); | |
47 | |
48 // Other methods | |
49 void FocusedNodeChanged(); | |
50 | |
51 void StartSpellCheckMenuTimer(); | |
52 void StopSpellCheckMenuTimer(); | |
53 | |
54 private: | |
55 RenderFrameHost* GetFocusedFrame(); | |
56 const blink::mojom::TextSuggestionBackendPtr& GetTextSuggestionBackend(); | |
57 void OnSpellCheckMenuTimeout(); | |
58 | |
59 // Current RenderWidgetHostView connected to this instance. Can be null. | |
60 RenderWidgetHostViewAndroid* rwhva_; | |
61 JavaObjectWeakGlobalRef java_text_suggestion_host_; | |
62 blink::mojom::TextSuggestionBackendPtr text_suggestion_backend_; | |
63 TimeoutMonitor spellcheck_menu_timeout_; | |
64 }; | |
65 | |
66 bool RegisterTextSuggestionHost(JNIEnv* env); | |
67 | |
68 } // namespace content | |
69 | |
70 #endif // TEXT_SUGGESTION_HOST_ANDROID_H_ | |
OLD | NEW |