PluginStub.java revision 2c3eb14d43edcecbd85072f7068126cffd7ca493
1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.webkit;
17
18import android.content.Context;
19import android.view.View;
20
21/**
22 * This abstract class is used to implement plugins in a WebView. A plugin
23 * package may extend this class and implement the abstract functions to create
24 * embedded or fullscreeen views displayed in a WebView. The PluginStub
25 * implementation will be provided the same NPP instance that is created
26 * through the native interface.
27 */
28public abstract class PluginStub {
29    /**
30     * Construct a new PluginStub implementation for the given NPP instance.
31     * @param npp The native NPP instance.
32     */
33    public PluginStub(int npp) { }
34
35    /**
36     * Return a custom embedded view to draw the plugin.
37     * @param context The current application's Context.
38     * @return A custom View that will be managed by WebView.
39     */
40    public abstract View getEmbeddedView(Context context);
41
42    /**
43     * Return a custom full-screen view to be displayed when the user requests
44     * a plugin display as full-screen. Note that the application may choose not
45     * to display this View as completely full-screen.
46     * @param context The current application's Context.
47     * @return A custom View that will be managed by the application.
48     */
49    public abstract View getFullScreenView(Context context);
50}
51