Home | History | Annotate | Download | only in webkit
      1 /*
      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 
     17 package android.webkit;
     18 
     19 import android.content.Context;
     20 import java.util.ArrayList;
     21 import 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).
     27  *
     28  * @deprecated This interface was intended to be used by Gears. Since Gears was
     29  * deprecated, so is this class.
     30  */
     31 @Deprecated
     32 public class PluginList {
     33     private ArrayList<Plugin> mPlugins;
     34 
     35    /**
     36     * Public constructor. Initializes the list of plugins.
     37     *
     38     * @deprecated This interface was intended to be used by Gears. Since Gears was
     39     * deprecated, so is this class.
     40     */
     41     @Deprecated
     42     public PluginList() {
     43         mPlugins = new ArrayList<Plugin>();
     44     }
     45 
     46    /**
     47     * Returns the list of plugins as a java.util.List.
     48     *
     49     * @deprecated This interface was intended to be used by Gears. Since Gears was
     50     * deprecated, so is this class.
     51     */
     52     @Deprecated
     53     public synchronized List getList() {
     54         return mPlugins;
     55     }
     56 
     57    /**
     58     * Adds a plugin to the list.
     59     *
     60     * @deprecated This interface was intended to be used by Gears. Since Gears was
     61     * deprecated, so is this class.
     62     */
     63     @Deprecated
     64     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.
     72     *
     73     * @deprecated This interface was intended to be used by Gears. Since Gears was
     74     * deprecated, so is this class.
     75     */
     76     @Deprecated
     77     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.
     86     *
     87     * @deprecated This interface was intended to be used by Gears. Since Gears was
     88     * deprecated, so is this class.
     89     */
     90     @Deprecated
     91     public synchronized void clear() {
     92         mPlugins.clear();
     93     }
     94 
     95    /**
     96     * Dispatches the click event to the appropriate plugin.
     97     *
     98     * @deprecated This interface was intended to be used by Gears. Since Gears was
     99     * deprecated, so is this class.
    100     */
    101     @Deprecated
    102     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 }
    112