EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.chrome.browser.autofill]

COVERAGE SUMMARY FOR SOURCE FILE [AutofillPopupGlue.java]

nameclass, %method, %block, %line, %
AutofillPopupGlue.java100% (1/1)89%  (8/9)92%  (59/64)89%  (16/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AutofillPopupGlue100% (1/1)89%  (8/9)92%  (59/64)89%  (16/18)
requestHide (): void 0%   (0/1)0%   (0/5)0%   (0/2)
AutofillPopupGlue (int, WindowAndroid, ViewAndroidDelegate): void 100% (1/1)100% (15/15)100% (4/4)
addToAutofillSuggestionArray (AutofillSuggestion [], int, String, String, int... 100% (1/1)100% (10/10)100% (2/2)
create (int, WindowAndroid, ViewAndroid): AutofillPopupGlue 100% (1/1)100% (8/8)100% (1/1)
createAutofillSuggestionArray (int): AutofillSuggestion [] 100% (1/1)100% (3/3)100% (1/1)
hide (): void 100% (1/1)100% (4/4)100% (2/2)
setAnchorRect (float, float, float, float): void 100% (1/1)100% (8/8)100% (2/2)
show (AutofillSuggestion []): void 100% (1/1)100% (5/5)100% (2/2)
suggestionSelected (int): void 100% (1/1)100% (6/6)100% (2/2)

1// Copyright (c) 2012 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 
5package org.chromium.chrome.browser.autofill;
6 
7import org.chromium.base.CalledByNative;
8import org.chromium.base.JNINamespace;
9import org.chromium.ui.ViewAndroid;
10import org.chromium.ui.ViewAndroidDelegate;
11import org.chromium.ui.WindowAndroid;
12import org.chromium.ui.autofill.AutofillPopup;
13import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate;
14import org.chromium.ui.autofill.AutofillSuggestion;
15 
16/**
17* JNI call glue for AutofillExternalDelagate C++ and Java objects.
18*/
19@JNINamespace("autofill")
20public class AutofillPopupGlue implements AutofillPopupDelegate{
21    private final int mNativeAutofillPopup;
22    private final AutofillPopup mAutofillPopup;
23 
24    public AutofillPopupGlue(int nativeAutofillPopupViewAndroid, WindowAndroid windowAndroid,
25            ViewAndroidDelegate containerViewDelegate) {
26        mNativeAutofillPopup = nativeAutofillPopupViewAndroid;
27        mAutofillPopup = new AutofillPopup(windowAndroid.getContext(), containerViewDelegate, this);
28    }
29 
30    @CalledByNative
31    private static AutofillPopupGlue create(int nativeAutofillPopupViewAndroid,
32            WindowAndroid windowAndroid, ViewAndroid viewAndroid) {
33        return new AutofillPopupGlue(nativeAutofillPopupViewAndroid, windowAndroid,
34                viewAndroid.getViewAndroidDelegate());
35    }
36 
37    @Override
38    public void requestHide() {
39        nativeRequestHide(mNativeAutofillPopup);
40    }
41 
42    @Override
43    public void suggestionSelected(int listIndex) {
44        nativeSuggestionSelected(mNativeAutofillPopup, listIndex);
45    }
46 
47    /**
48     * Hides the Autofill Popup and removes its anchor from the ContainerView.
49     */
50    @CalledByNative
51    private void hide() {
52        mAutofillPopup.hide();
53    }
54 
55    /**
56     * Shows an Autofill popup with specified suggestions.
57     * @param suggestions Autofill suggestions to be displayed.
58     */
59    @CalledByNative
60    private void show(AutofillSuggestion[] suggestions) {
61        mAutofillPopup.show(suggestions);
62    }
63 
64    /**
65     * Sets the location and size of the Autofill popup anchor (input field).
66     * @param x X coordinate.
67     * @param y Y coordinate.
68     * @param width The width of the anchor.
69     * @param height The height of the anchor.
70     */
71    @CalledByNative
72    private void setAnchorRect(float x, float y, float width, float height) {
73        mAutofillPopup.setAnchorRect(x, y, width, height);
74    }
75 
76    // Helper methods for AutofillSuggestion
77 
78    @CalledByNative
79    private static AutofillSuggestion[] createAutofillSuggestionArray(int size) {
80        return new AutofillSuggestion[size];
81    }
82 
83    /**
84     * @param array AutofillSuggestion array that should get a new suggestion added.
85     * @param index Index in the array where to place a new suggestion.
86     * @param label First line of the suggestion.
87     * @param sublabel Second line of the suggestion.
88     * @param uniqueId Unique suggestion id.
89     */
90    @CalledByNative
91    private static void addToAutofillSuggestionArray(AutofillSuggestion[] array, int index,
92            String label, String sublabel, int uniqueId) {
93        array[index] = new AutofillSuggestion(label, sublabel, uniqueId);
94    }
95 
96    private native void nativeRequestHide(int nativeAutofillPopupViewAndroid);
97    private native void nativeSuggestionSelected(int nativeAutofillPopupViewAndroid,
98            int listIndex);
99}

[all classes][org.chromium.chrome.browser.autofill]
EMMA 2.0.5312 (C) Vladimir Roubtsov