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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..ca41ca3849d8c88576baef8516b9ff8b82c9d9e2
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+package org.chromium.content.browser.input;
+
+import android.util.StringBuilderPrinter;
+import android.view.inputmethod.CorrectionInfo;
+import android.view.inputmethod.EditorInfo;
+
+import org.chromium.base.ThreadUtils;
+
+/**
+ * Utilities for IME-related classes.
+ */
+public class ImeUtils {
+ /**
+ * Dump the given {@EditorInfo} into class.
+ * @param editorInfo
+ * @return User-readable {@EditorInfo}.
+ */
+ static String dumpEditorInfo(EditorInfo editorInfo) {
+ StringBuilder builder = new StringBuilder();
+ StringBuilderPrinter printer = new StringBuilderPrinter(builder);
+ editorInfo.dump(printer, "");
+ return builder.toString();
+ }
+
+ /**
+ * Dump the given {@CorrectionInfo} into class.
+ * @param correctionInfo
+ * @return User-readable {@CorrectionInfo}.
+ */
+ static String dumpCorrectionInfo(CorrectionInfo correctionInfo) {
+ // TODO(changwan): implement it properly if needed.
+ return correctionInfo.toString();
+ }
+
+ // TODO(changwan): remove these once implementation becomes stable.
+ static void assertReally(boolean value) {
+ if (!value) {
+ throw new AssertionError();
+ }
+ }
+
+ static void assertReally(String msg, boolean value) {
+ if (!value) {
+ throw new AssertionError(msg);
+ }
+ }
+
+ static void assertNotOnUiThread() {
+ assertReally("Should not be on UI thread.", !ThreadUtils.runningOnUiThread());
+ }
+
+ static void assertOnUiThread() {
+ assertReally("Should be on UI thread.", ThreadUtils.runningOnUiThread());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698