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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 package org.chromium.content.browser.input;
6
7 import android.util.StringBuilderPrinter;
8 import android.view.inputmethod.CorrectionInfo;
9 import android.view.inputmethod.EditorInfo;
10
11 import org.chromium.base.ThreadUtils;
12
13 /**
14 * Utilities for IME-related classes.
15 */
16 public class ImeUtils {
17 /**
18 * Dump the given {@EditorInfo} into class.
19 * @param editorInfo
20 * @return User-readable {@EditorInfo}.
21 */
22 static String dumpEditorInfo(EditorInfo editorInfo) {
23 StringBuilder builder = new StringBuilder();
24 StringBuilderPrinter printer = new StringBuilderPrinter(builder);
25 editorInfo.dump(printer, "");
26 return builder.toString();
27 }
28
29 /**
30 * Dump the given {@CorrectionInfo} into class.
31 * @param correctionInfo
32 * @return User-readable {@CorrectionInfo}.
33 */
34 static String dumpCorrectionInfo(CorrectionInfo correctionInfo) {
35 // TODO(changwan): implement it properly if needed.
36 return correctionInfo.toString();
37 }
38
39 // TODO(changwan): remove these once implementation becomes stable.
40 static void assertReally(boolean value) {
41 if (!value) {
42 throw new AssertionError();
43 }
44 }
45
46 static void assertReally(String msg, boolean value) {
47 if (!value) {
48 throw new AssertionError(msg);
49 }
50 }
51
52 static void assertNotOnUiThread() {
53 assertReally("Should not be on UI thread.", !ThreadUtils.runningOnUiThre ad());
54 }
55
56 static void assertOnUiThread() {
57 assertReally("Should be on UI thread.", ThreadUtils.runningOnUiThread()) ;
58 }
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698