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

Unified Diff: content/browser/android/ime_adapter_android.h

Issue 2931443003: Add support for Android spellcheck menu in Chrome/WebViews (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/android/ime_adapter_android.h
diff --git a/content/browser/android/ime_adapter_android.h b/content/browser/android/ime_adapter_android.h
index efe4fbb23c7bd09916bdb429754025e5ec779e8f..374398657ea5d49fcc50eaecc6cf41390263b06f 100644
--- a/content/browser/android/ime_adapter_android.h
+++ b/content/browser/android/ime_adapter_android.h
@@ -11,7 +11,10 @@
#include "base/android/jni_weak_ref.h"
#include "content/browser/android/render_widget_host_connector.h"
+#include "content/browser/renderer_host/input/timeout_monitor.h"
#include "content/common/content_export.h"
+#include "third_party/WebKit/public/platform/input_host.mojom.h"
+#include "third_party/WebKit/public/platform/input_messages.mojom.h"
#include "ui/gfx/geometry/rect_f.h"
namespace blink {
@@ -25,6 +28,7 @@ namespace content {
class RenderFrameHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewAndroid;
+class TimeoutMonitor;
struct TextInputState;
// This class is in charge of dispatching key events from the java side
@@ -84,6 +88,18 @@ class CONTENT_EXPORT ImeAdapterAndroid : public RenderWidgetHostConnector {
bool monitorRequest);
bool RequestTextInputStateUpdate(JNIEnv*,
const base::android::JavaParamRef<jobject>&);
+ void ApplySpellCheckSuggestion(
+ JNIEnv*,
+ const base::android::JavaParamRef<jobject>&,
+ const base::android::JavaParamRef<jstring>& replacement);
+ void DeleteActiveSuggestionRange(JNIEnv*,
+ const base::android::JavaParamRef<jobject>&);
+ void NewWordAddedToDictionary(
+ JNIEnv*,
+ const base::android::JavaParamRef<jobject>&,
+ const base::android::JavaParamRef<jstring>& word);
+ void SuggestionMenuClosed(JNIEnv*,
+ const base::android::JavaParamRef<jobject>&);
// RendetWidgetHostConnector implementation.
void UpdateRenderProcessConnection(
@@ -98,6 +114,13 @@ class CONTENT_EXPORT ImeAdapterAndroid : public RenderWidgetHostConnector {
void CancelComposition();
void FocusedNodeChanged(bool is_editable_node);
void SetCharacterBounds(const std::vector<gfx::RectF>& rects);
+ void StartSpellCheckMenuTimer();
+ void StopSpellCheckMenuTimer();
+ void ShowSpellCheckSuggestionMenu(
+ double caret_x,
+ double caret_y,
+ const std::string& marked_text,
+ const std::vector<blink::mojom::SpellCheckSuggestionPtr>& suggestions);
base::android::ScopedJavaLocalRef<jobject> java_ime_adapter_for_testing(
JNIEnv* env) {
@@ -109,15 +132,19 @@ class CONTENT_EXPORT ImeAdapterAndroid : public RenderWidgetHostConnector {
private:
RenderWidgetHostImpl* GetFocusedWidget();
RenderFrameHost* GetFocusedFrame();
+ const blink::mojom::TextSuggestionBackendPtr& GetTextSuggestionBackend();
std::vector<blink::WebCompositionUnderline> GetUnderlinesFromSpans(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& text,
const base::string16& text16);
+ void OnSpellCheckMenuTimeout();
// Current RenderWidgetHostView connected to this instance. Can be null.
RenderWidgetHostViewAndroid* rwhva_;
JavaObjectWeakGlobalRef java_ime_adapter_;
+ blink::mojom::TextSuggestionBackendPtr text_suggestion_backend_;
+ TimeoutMonitor spellcheck_menu_timeout_;
};
bool RegisterImeAdapter(JNIEnv* env);

Powered by Google App Engine
This is Rietveld 408576698