blob: 29a5edc3cd123c9638383ff5f9048ff1cab7223c [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 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 */
16
17package android.webkit;
18
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019import android.app.AlertDialog;
20import android.content.Context;
21import android.content.DialogInterface;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
Nate Fischer5cca7bd2017-09-26 18:51:49 -070023import com.android.internal.R;
24
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025/**
26 * Represents a plugin (Java equivalent of the PluginPackageAndroid
27 * C++ class in libs/WebKitLib/WebKit/WebCore/plugins/android/)
Andrei Popescu385df692009-08-13 11:59:57 +010028 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000029 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070030 * @deprecated This interface was intended to be used by Gears. Since Gears was
Andrei Popescu385df692009-08-13 11:59:57 +010031 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032 */
Andrei Popescu385df692009-08-13 11:59:57 +010033@Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034public class Plugin {
Nate Fischer5cca7bd2017-09-26 18:51:49 -070035 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000036 * @hide
37 * @deprecated This interface was intended to be used by Gears. Since Gears was
38 * deprecated, so is this class.
39 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040 public interface PreferencesClickHandler {
Nate Fischer5cca7bd2017-09-26 18:51:49 -070041 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000042 * @hide
43 * @deprecated This interface was intended to be used by Gears. Since Gears was
44 * deprecated, so is this class.
45 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046 public void handleClickEvent(Context context);
47 }
48
49 private String mName;
50 private String mPath;
51 private String mFileName;
52 private String mDescription;
53 private PreferencesClickHandler mHandler;
54
Andrei Popescu385df692009-08-13 11:59:57 +010055 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000056 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070057 * @deprecated This interface was intended to be used by Gears. Since Gears was
58 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +010059 */
60 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 public Plugin(String name,
62 String path,
63 String fileName,
64 String description) {
65 mName = name;
66 mPath = path;
67 mFileName = fileName;
68 mDescription = description;
69 mHandler = new DefaultClickHandler();
70 }
71
Andrei Popescu385df692009-08-13 11:59:57 +010072 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000073 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070074 * @deprecated This interface was intended to be used by Gears. Since Gears was
75 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +010076 */
77 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 public String toString() {
79 return mName;
80 }
81
Andrei Popescu385df692009-08-13 11:59:57 +010082 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000083 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070084 * @deprecated This interface was intended to be used by Gears. Since Gears was
85 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +010086 */
87 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 public String getName() {
89 return mName;
90 }
91
Andrei Popescu385df692009-08-13 11:59:57 +010092 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +000093 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070094 * @deprecated This interface was intended to be used by Gears. Since Gears was
95 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +010096 */
97 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 public String getPath() {
99 return mPath;
100 }
101
Andrei Popescu385df692009-08-13 11:59:57 +0100102 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000103 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700104 * @deprecated This interface was intended to be used by Gears. Since Gears was
105 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100106 */
107 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 public String getFileName() {
109 return mFileName;
110 }
111
Andrei Popescu385df692009-08-13 11:59:57 +0100112 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000113 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700114 * @deprecated This interface was intended to be used by Gears. Since Gears was
115 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100116 */
117 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public String getDescription() {
119 return mDescription;
120 }
121
Andrei Popescu385df692009-08-13 11:59:57 +0100122 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000123 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700124 * @deprecated This interface was intended to be used by Gears. Since Gears was
125 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100126 */
127 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 public void setName(String name) {
129 mName = name;
130 }
131
Andrei Popescu385df692009-08-13 11:59:57 +0100132 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000133 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700134 * @deprecated This interface was intended to be used by Gears. Since Gears was
135 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100136 */
137 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 public void setPath(String path) {
139 mPath = path;
140 }
141
Andrei Popescu385df692009-08-13 11:59:57 +0100142 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000143 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700144 * @deprecated This interface was intended to be used by Gears. Since Gears was
145 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100146 */
147 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 public void setFileName(String fileName) {
149 mFileName = fileName;
150 }
151
Andrei Popescu385df692009-08-13 11:59:57 +0100152 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000153 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700154 * @deprecated This interface was intended to be used by Gears. Since Gears was
155 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100156 */
157 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 public void setDescription(String description) {
159 mDescription = description;
160 }
161
Andrei Popescu385df692009-08-13 11:59:57 +0100162 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000163 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700164 * @deprecated This interface was intended to be used by Gears. Since Gears was
165 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100166 */
167 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 public void setClickHandler(PreferencesClickHandler handler) {
169 mHandler = handler;
170 }
171
172 /**
173 * Invokes the click handler for this plugin.
Andrei Popescu385df692009-08-13 11:59:57 +0100174 *
Kristian Monsenf0d97312011-01-12 19:15:35 +0000175 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700176 * @deprecated This interface was intended to be used by Gears. Since Gears was
177 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178 */
Andrei Popescu385df692009-08-13 11:59:57 +0100179 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 public void dispatchClickEvent(Context context) {
181 if (mHandler != null) {
182 mHandler.handleClickEvent(context);
183 }
184 }
185
186 /**
187 * Default click handler. The plugins should implement their own.
Andrei Popescu385df692009-08-13 11:59:57 +0100188 *
Kristian Monsenf0d97312011-01-12 19:15:35 +0000189 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700190 * @deprecated This interface was intended to be used by Gears. Since Gears was
191 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 */
Andrei Popescu385df692009-08-13 11:59:57 +0100193 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 private class DefaultClickHandler implements PreferencesClickHandler,
195 DialogInterface.OnClickListener {
196 private AlertDialog mDialog;
Andrei Popescu385df692009-08-13 11:59:57 +0100197 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800198 public void handleClickEvent(Context context) {
199 // Show a simple popup dialog containing the description
200 // string of the plugin.
201 if (mDialog == null) {
202 mDialog = new AlertDialog.Builder(context)
203 .setTitle(mName)
204 .setMessage(mDescription)
205 .setPositiveButton(R.string.ok, this)
206 .setCancelable(false)
207 .show();
208 }
209 }
Andrei Popescu385df692009-08-13 11:59:57 +0100210 /**
Kristian Monsenf0d97312011-01-12 19:15:35 +0000211 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700212 * @deprecated This interface was intended to be used by Gears. Since Gears was
213 * deprecated, so is this class.
Andrei Popescu385df692009-08-13 11:59:57 +0100214 */
215 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 public void onClick(DialogInterface dialog, int which) {
217 mDialog.dismiss();
218 mDialog = null;
219 }
220 }
221}