| Index: ui/android/java/src/org/chromium/ui/base/CursorAnchorInfoBuilder.java
 | 
| diff --git a/ui/android/java/src/org/chromium/ui/base/CursorAnchorInfoBuilder.java b/ui/android/java/src/org/chromium/ui/base/CursorAnchorInfoBuilder.java
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..ffa89179b37bc01beef50a2c325779dc71653621
 | 
| --- /dev/null
 | 
| +++ b/ui/android/java/src/org/chromium/ui/base/CursorAnchorInfoBuilder.java
 | 
| @@ -0,0 +1,78 @@
 | 
| +// Copyright 2014 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.ui.base;
 | 
| +
 | 
| +import android.graphics.Matrix;
 | 
| +import android.os.Build;
 | 
| +import android.view.inputmethod.CursorAnchorInfo;
 | 
| +
 | 
| +import org.chromium.base.CalledByNative;
 | 
| +import org.chromium.base.JNINamespace;
 | 
| +
 | 
| +import java.lang.CharSequence;
 | 
| +
 | 
| +/**
 | 
| + * A simple class to allow native code to call instance methods of {@link CursorAnchorInfo.Builder}.
 | 
| + * This class itself is designed to be stateless. All the methods are thread-safe.
 | 
| + */
 | 
| +@JNINamespace("ui")
 | 
| +public final class CursorAnchorInfoBuilder {
 | 
| +
 | 
| +    private static final Matrix sMatrix = new Matrix();
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static CursorAnchorInfo.Builder create() {
 | 
| +        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
 | 
| +            return null;
 | 
| +        }
 | 
| +        return new CursorAnchorInfo.Builder();
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void reset(CursorAnchorInfo.Builder builder) {
 | 
| +        builder.reset();
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void setSelectionRange(CursorAnchorInfo.Builder builder, int newStart,
 | 
| +            int newEnd) {
 | 
| +        builder.setSelectionRange(newStart, newEnd);
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void setComposingText(CursorAnchorInfo.Builder builder, int composingTextStart,
 | 
| +            CharSequence composingText) {
 | 
| +        builder.setComposingText(composingTextStart, composingText);
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void setInsertionMarkerLocation(CursorAnchorInfo.Builder builder,
 | 
| +            float horizontalPosition, float lineTop, float lineBaseline, float lineBottom,
 | 
| +            int flags) {
 | 
| +        builder.setInsertionMarkerLocation(horizontalPosition, lineTop, lineBaseline, lineBottom,
 | 
| +                flags);
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void addCharacterBounds(CursorAnchorInfo.Builder builder, int index, float left,
 | 
| +            float top, float right, float bottom, int flags) {
 | 
| +        builder.addCharacterBounds(index, left, top, right, bottom, flags);
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static void setScaleAndTranslate(CursorAnchorInfo.Builder builder, float scale,
 | 
| +            float translateX, float translateY) {
 | 
| +        synchronized (sMatrix) {
 | 
| +            sMatrix.setScale(scale, scale);
 | 
| +            sMatrix.postTranslate(translateX, translateY);
 | 
| +            builder.setMatrix(sMatrix);
 | 
| +        }
 | 
| +    }
 | 
| +
 | 
| +    @CalledByNative
 | 
| +    public static CursorAnchorInfo build(CursorAnchorInfo.Builder builder) {
 | 
| +        return builder.build();
 | 
| +    }
 | 
| +}
 | 
| 
 |