blob: a61b07b6f3384cc6e016c17832c3aca02f36a6b7 [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
19import android.content.Context;
20import java.util.ArrayList;
21import java.util.List;
22
23/**
24 * A simple list of initialized plugins. This list gets
25 * populated when the plugins are initialized (at
26 * browser startup, at the moment).
Andrei Popescu385df692009-08-13 11:59:57 +010027 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070028 * @deprecated This interface was intended to be used by Gears. Since Gears was
Andrei Popescu385df692009-08-13 11:59:57 +010029 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030 */
Andrei Popescu385df692009-08-13 11:59:57 +010031@Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032public class PluginList {
33 private ArrayList<Plugin> mPlugins;
34
35 /**
36 * Public constructor. Initializes the list of plugins.
Andrei Popescu385df692009-08-13 11:59:57 +010037 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070038 * @deprecated This interface was intended to be used by Gears. Since Gears was
39 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040 */
Andrei Popescu385df692009-08-13 11:59:57 +010041 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042 public PluginList() {
43 mPlugins = new ArrayList<Plugin>();
44 }
45
46 /**
47 * Returns the list of plugins as a java.util.List.
Andrei Popescu385df692009-08-13 11:59:57 +010048 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070049 * @deprecated This interface was intended to be used by Gears. Since Gears was
50 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 */
Andrei Popescu385df692009-08-13 11:59:57 +010052 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 public synchronized List getList() {
54 return mPlugins;
55 }
56
57 /**
58 * Adds a plugin to the list.
Andrei Popescu385df692009-08-13 11:59:57 +010059 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070060 * @deprecated This interface was intended to be used by Gears. Since Gears was
61 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 */
Andrei Popescu385df692009-08-13 11:59:57 +010063 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 public synchronized void addPlugin(Plugin plugin) {
65 if (!mPlugins.contains(plugin)) {
66 mPlugins.add(plugin);
67 }
68 }
69
70 /**
71 * Removes a plugin from the list.
Andrei Popescu385df692009-08-13 11:59:57 +010072 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070073 * @deprecated This interface was intended to be used by Gears. Since Gears was
74 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 */
Andrei Popescu385df692009-08-13 11:59:57 +010076 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 public synchronized void removePlugin(Plugin plugin) {
78 int location = mPlugins.indexOf(plugin);
79 if (location != -1) {
80 mPlugins.remove(location);
81 }
82 }
83
84 /**
85 * Clears the plugin list.
Andrei Popescu385df692009-08-13 11:59:57 +010086 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070087 * @deprecated This interface was intended to be used by Gears. Since Gears was
88 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 */
Andrei Popescu385df692009-08-13 11:59:57 +010090 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 public synchronized void clear() {
92 mPlugins.clear();
93 }
94
95 /**
96 * Dispatches the click event to the appropriate plugin.
Andrei Popescu385df692009-08-13 11:59:57 +010097 *
Dianne Hackborn4a51c202009-08-21 15:14:02 -070098 * @deprecated This interface was intended to be used by Gears. Since Gears was
99 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 */
Andrei Popescu385df692009-08-13 11:59:57 +0100101 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 public synchronized void pluginClicked(Context context, int position) {
103 try {
104 Plugin plugin = mPlugins.get(position);
105 plugin.dispatchClickEvent(context);
106 } catch (IndexOutOfBoundsException e) {
107 // This can happen if the list of plugins
108 // gets changed while the pref menu is up.
109 }
110 }
111}