blob: d07b8a0bf95c033a5a9c0270c9c140b32edf9179 [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 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000028 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070029 * @deprecated This interface was intended to be used by Gears. Since Gears was
Andrei Popescu385df692009-08-13 11:59:57 +010030 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031 */
Andrei Popescu385df692009-08-13 11:59:57 +010032@Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033public class PluginList {
34 private ArrayList<Plugin> mPlugins;
35
36 /**
37 * Public constructor. Initializes the list of plugins.
Andrei Popescu385df692009-08-13 11:59:57 +010038 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000039 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070040 * @deprecated This interface was intended to be used by Gears. Since Gears was
41 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042 */
Andrei Popescu385df692009-08-13 11:59:57 +010043 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 public PluginList() {
45 mPlugins = new ArrayList<Plugin>();
46 }
47
48 /**
49 * Returns the list of plugins as a java.util.List.
Andrei Popescu385df692009-08-13 11:59:57 +010050 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000051 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070052 * @deprecated This interface was intended to be used by Gears. Since Gears was
53 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 */
Andrei Popescu385df692009-08-13 11:59:57 +010055 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 public synchronized List getList() {
57 return mPlugins;
58 }
59
60 /**
61 * Adds a plugin to the list.
Andrei Popescu385df692009-08-13 11:59:57 +010062 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000063 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070064 * @deprecated This interface was intended to be used by Gears. Since Gears was
65 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 */
Andrei Popescu385df692009-08-13 11:59:57 +010067 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 public synchronized void addPlugin(Plugin plugin) {
69 if (!mPlugins.contains(plugin)) {
70 mPlugins.add(plugin);
71 }
72 }
73
74 /**
75 * Removes a plugin from the list.
Andrei Popescu385df692009-08-13 11:59:57 +010076 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000077 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070078 * @deprecated This interface was intended to be used by Gears. Since Gears was
79 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 */
Andrei Popescu385df692009-08-13 11:59:57 +010081 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 public synchronized void removePlugin(Plugin plugin) {
83 int location = mPlugins.indexOf(plugin);
84 if (location != -1) {
85 mPlugins.remove(location);
86 }
87 }
88
89 /**
90 * Clears the plugin list.
Andrei Popescu385df692009-08-13 11:59:57 +010091 *
Kristian Monsenf0d97312011-01-12 19:15:35 +000092 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -070093 * @deprecated This interface was intended to be used by Gears. Since Gears was
94 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 */
Andrei Popescu385df692009-08-13 11:59:57 +010096 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 public synchronized void clear() {
98 mPlugins.clear();
99 }
100
101 /**
102 * Dispatches the click event to the appropriate plugin.
Andrei Popescu385df692009-08-13 11:59:57 +0100103 *
Kristian Monsenf0d97312011-01-12 19:15:35 +0000104 * @hide
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700105 * @deprecated This interface was intended to be used by Gears. Since Gears was
106 * deprecated, so is this class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 */
Andrei Popescu385df692009-08-13 11:59:57 +0100108 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 public synchronized void pluginClicked(Context context, int position) {
110 try {
111 Plugin plugin = mPlugins.get(position);
112 plugin.dispatchClickEvent(context);
113 } catch (IndexOutOfBoundsException e) {
114 // This can happen if the list of plugins
115 // gets changed while the pref menu is up.
116 }
117 }
118}