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

COVERAGE SUMMARY FOR SOURCE FILE [AwAutofillManagerDelegate.java]

nameclass, %method, %block, %line, %
AwAutofillManagerDelegate.java50%  (1/2)33%  (4/12)23%  (23/100)35%  (9/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AwAutofillManagerDelegate$10%   (0/1)0%   (0/3)0%   (0/15)0%   (0/4)
AwAutofillManagerDelegate$1 (AwAutofillManagerDelegate): void 0%   (0/1)0%   (0/6)0%   (0/1)
requestHide (): void 0%   (0/1)0%   (0/1)0%   (0/1)
suggestionSelected (int): void 0%   (0/1)0%   (0/8)0%   (0/2)
     
class AwAutofillManagerDelegate100% (1/1)44%  (4/9)27%  (23/85)41%  (9/22)
access$000 (AwAutofillManagerDelegate): int 0%   (0/1)0%   (0/3)0%   (0/1)
access$100 (AwAutofillManagerDelegate, int, int): void 0%   (0/1)0%   (0/5)0%   (0/1)
addToAutofillSuggestionArray (AutofillSuggestion [], int, String, String, int... 0%   (0/1)0%   (0/10)0%   (0/2)
createAutofillSuggestionArray (int): AutofillSuggestion [] 0%   (0/1)0%   (0/3)0%   (0/1)
showAutofillPopup (float, float, float, float, AutofillSuggestion []): void 0%   (0/1)0%   (0/34)0%   (0/6)
hideAutofillPopup (): void 100% (1/1)36%  (4/11)40%  (2/5)
AwAutofillManagerDelegate (int): void 100% (1/1)100% (6/6)100% (3/3)
create (int): AwAutofillManagerDelegate 100% (1/1)100% (5/5)100% (1/1)
init (ContentViewCore): void 100% (1/1)100% (8/8)100% (3/3)

1// Copyright 2013 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.android_webview;
6 
7import android.content.Context;
8import android.view.View;
9import android.view.ViewGroup;
10 
11import org.chromium.base.CalledByNative;
12import org.chromium.base.JNINamespace;
13import org.chromium.content.browser.ContentViewCore;
14import org.chromium.ui.autofill.AutofillPopup;
15import org.chromium.ui.autofill.AutofillSuggestion;
16 
17// Java counterpart to the AwAutofillManagerDelegate. This class is owned by
18// AwContents and has a weak reference from native side.
19@JNINamespace("android_webview")
20public class AwAutofillManagerDelegate {
21 
22    private final int mNativeAwAutofillManagerDelegate;
23    private AutofillPopup mAutofillPopup;
24    private ViewGroup mContainerView;
25    private ContentViewCore mContentViewCore;
26 
27    @CalledByNative
28    public static AwAutofillManagerDelegate create(int nativeDelegate) {
29        return new AwAutofillManagerDelegate(nativeDelegate);
30    }
31 
32    private AwAutofillManagerDelegate(int nativeAwAutofillManagerDelegate) {
33        mNativeAwAutofillManagerDelegate = nativeAwAutofillManagerDelegate;
34    }
35 
36    public void init(ContentViewCore contentViewCore) {
37        mContentViewCore = contentViewCore;
38        mContainerView = contentViewCore.getContainerView();
39    }
40 
41    @CalledByNative
42    private void showAutofillPopup(float x, float y, float width, float height,
43            AutofillSuggestion[] suggestions) {
44 
45        if (mContentViewCore == null) return;
46 
47        if (mAutofillPopup == null) {
48            mAutofillPopup = new AutofillPopup(
49                mContentViewCore.getContext(),
50                mContentViewCore.getViewAndroidDelegate(),
51                new AutofillPopup.AutofillPopupDelegate() {
52                    public void requestHide() { }
53                    public void suggestionSelected(int listIndex) {
54                        nativeSuggestionSelected(mNativeAwAutofillManagerDelegate, listIndex);
55                    }
56                });
57        }
58        mAutofillPopup.setAnchorRect(x, y, width, height);
59        mAutofillPopup.show(suggestions);
60    }
61 
62    @CalledByNative
63    public void hideAutofillPopup() {
64        if (mAutofillPopup == null)
65            return;
66        mAutofillPopup.hide();
67        mAutofillPopup = null;
68    }
69 
70    @CalledByNative
71    private static AutofillSuggestion[] createAutofillSuggestionArray(int size) {
72        return new AutofillSuggestion[size];
73    }
74 
75    /**
76     * @param array AutofillSuggestion array that should get a new suggestion added.
77     * @param index Index in the array where to place a new suggestion.
78     * @param name Name of the suggestion.
79     * @param label Label of the suggestion.
80     * @param uniqueId Unique suggestion id.
81     */
82    @CalledByNative
83    private static void addToAutofillSuggestionArray(AutofillSuggestion[] array, int index,
84            String name, String label, int uniqueId) {
85        array[index] = new AutofillSuggestion(name, label, uniqueId);
86    }
87 
88    private native void nativeSuggestionSelected(int nativeAwAutofillManagerDelegate, int position);
89}

[all classes][org.chromium.android_webview]
EMMA 2.0.5312 (C) Vladimir Roubtsov