Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddb79c9f authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 21090

* changes:
  remove Gears
parents 36427786 385df699
Loading
Loading
Loading
Loading
+35 −35
Original line number Diff line number Diff line
@@ -162798,14 +162798,14 @@
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<constructor name="Plugin"
 type="android.webkit.Plugin"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="name" type="java.lang.String">
@@ -162824,7 +162824,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
@@ -162837,7 +162837,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -162848,7 +162848,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -162859,7 +162859,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -162870,7 +162870,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -162881,7 +162881,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="handler" type="android.webkit.Plugin.PreferencesClickHandler">
@@ -162894,7 +162894,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="description" type="java.lang.String">
@@ -162907,7 +162907,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="fileName" type="java.lang.String">
@@ -162920,7 +162920,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="name" type="java.lang.String">
@@ -162933,7 +162933,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="path" type="java.lang.String">
@@ -162966,14 +162966,14 @@
 abstract="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<constructor name="PluginData"
 type="android.webkit.PluginData"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="stream" type="java.io.InputStream">
@@ -162992,7 +162992,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163003,7 +163003,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163014,7 +163014,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163025,7 +163025,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163035,14 +163035,14 @@
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<constructor name="PluginList"
 type="android.webkit.PluginList"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</constructor>
@@ -163053,7 +163053,7 @@
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="plugin" type="android.webkit.Plugin">
@@ -163066,7 +163066,7 @@
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163077,7 +163077,7 @@
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -163088,7 +163088,7 @@
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
@@ -163103,7 +163103,7 @@
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="plugin" type="android.webkit.Plugin">
@@ -163380,7 +163380,7 @@
 abstract="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<method name="getPluginData"
@@ -163390,7 +163390,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="url" type="java.lang.String">
@@ -163419,7 +163419,7 @@
 abstract="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<constructor name="UrlInterceptRegistry"
@@ -163437,7 +163437,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="url" type="java.lang.String">
@@ -163467,7 +163467,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="handler" type="android.webkit.UrlInterceptHandler">
@@ -163480,7 +163480,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="disabled" type="boolean">
@@ -163493,7 +163493,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="handler" type="android.webkit.UrlInterceptHandler">
@@ -163506,7 +163506,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -165500,7 +165500,7 @@
 synchronized="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -165793,7 +165793,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
<parameter name="reloadOpenPages" type="boolean">
+1 −28
Original line number Diff line number Diff line
@@ -160,9 +160,6 @@ class FrameLoader {
        populateStaticHeaders();
        populateHeaders();

        // response was handled by UrlIntercept, don't issue HTTP request
        if (handleUrlIntercept()) return true;

        // response was handled by Cache, don't issue HTTP request
        if (handleCache()) {
            // push the request data down to the LoadListener
@@ -200,7 +197,7 @@ class FrameLoader {
    }

    /*
     * This function is used by handleUrlInterecpt and handleCache to
     * This function is used by handleCache to
     * setup a load from the byte stream in a CacheResult.
     */
    private void startCacheLoad(CacheResult result) {
@@ -215,30 +212,6 @@ class FrameLoader {
        cacheLoader.load();
    }

    /*
     * This function is used by handleHTTPLoad to allow URL
     * interception. This can be used to provide alternative load
     * methods such as locally stored versions or for debugging.
     *
     * Returns true if the response was handled by UrlIntercept.
     */
    private boolean handleUrlIntercept() {
        // Check if the URL can be served from UrlIntercept. If
        // successful, return the data just like a cache hit.

        PluginData data = UrlInterceptRegistry.getPluginData(
                mListener.url(), mHeaders);

        if(data != null) {
            PluginContentLoader loader =
                    new PluginContentLoader(mListener, data);
            loader.load();
            return true;
        }
        // Not intercepted. Carry on as normal.
        return false;
    }

    /*
     * This function is used by the handleHTTPLoad to setup the cache headers
     * correctly.
+59 −2
Original line number Diff line number Diff line
@@ -26,7 +26,11 @@ import android.webkit.WebView;
/**
 * Represents a plugin (Java equivalent of the PluginPackageAndroid
 * C++ class in libs/WebKitLib/WebKit/WebCore/plugins/android/)
 *
 * @deprecated This interface was inteded to be used by Gears. Since Gears was
 * deprecated, so is this class.
 */
@Deprecated
public class Plugin {
    public interface PreferencesClickHandler {
        public void handleClickEvent(Context context);
@@ -38,6 +42,10 @@ public class Plugin {
    private String mDescription;
    private PreferencesClickHandler mHandler;

    /**
     * @deprecated
     */
    @Deprecated
    public Plugin(String name,
                  String path,
                  String fileName,
@@ -49,49 +57,92 @@ public class Plugin {
        mHandler = new DefaultClickHandler();
    }

    /**
     * @deprecated
     */
    @Deprecated
    public String toString() {
        return mName;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public String getName() {
        return mName;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public String getPath() {
        return mPath;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public String getFileName() {
        return mFileName;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public String getDescription() {
        return mDescription;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public void setName(String name) {
        mName = name;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public void setPath(String path) {
        mPath = path;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public void setFileName(String fileName) {
        mFileName = fileName;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public void setDescription(String description) {
        mDescription = description;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public void setClickHandler(PreferencesClickHandler handler) {
        mHandler = handler;
    }

   /**
    * Invokes the click handler for this plugin.
    *
    * @deprecated
    */
    @Deprecated
    public void dispatchClickEvent(Context context) {
        if (mHandler != null) {
            mHandler.handleClickEvent(context);
@@ -100,11 +151,14 @@ public class Plugin {

   /**
    * Default click handler. The plugins should implement their own.
    *
    * @deprecated
    */
    @Deprecated
    private class DefaultClickHandler implements PreferencesClickHandler,
                                                 DialogInterface.OnClickListener {
        private AlertDialog mDialog;

        @Deprecated
        public void handleClickEvent(Context context) {
            // Show a simple popup dialog containing the description
            // string of the plugin.
@@ -117,7 +171,10 @@ public class Plugin {
                        .show();
            }
        }

        /**
         * @deprecated
         */
        @Deprecated
        public void onClick(DialogInterface dialog, int which) {
            mDialog.dismiss();
            mDialog = null;
+0 −96
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.webkit;

import android.net.http.Headers;

import java.io.InputStream;
import java.util.*;

import org.apache.http.util.CharArrayBuffer;

/**
 * This class is a concrete implementation of StreamLoader that uses a
 * PluginData object as the source for the stream.
 */
class PluginContentLoader extends StreamLoader {

    private PluginData mData;  // Content source

    /**
     * Constructs a PluginDataLoader for use when loading content from
     * a plugin.
     *
     * @param loadListener LoadListener to pass the content to
     * @param data PluginData used as the source for the content.
     */
    PluginContentLoader(LoadListener loadListener, PluginData data) {
        super(loadListener);
        mData = data;
    }

    @Override
    protected boolean setupStreamAndSendStatus() {
        mDataStream = mData.getInputStream();
        mContentLength = mData.getContentLength();
        mHandler.status(1, 1, mData.getStatusCode(), "OK");
        return true;
    }

    @Override
    protected void buildHeaders(Headers headers) {
        // Crate a CharArrayBuffer with an arbitrary initial capacity.
        CharArrayBuffer buffer = new CharArrayBuffer(100);
        Iterator<Map.Entry<String, String[]>> responseHeadersIt =
                mData.getHeaders().entrySet().iterator();
        while (responseHeadersIt.hasNext()) {
            Map.Entry<String, String[]> entry = responseHeadersIt.next();
            // Headers.parseHeader() expects lowercase keys, so keys
            // such as "Accept-Ranges" will fail to parse.
            //
            // UrlInterceptHandler instances supply a mapping of
            // lowercase key to [ unmodified key, value ], so for
            // Headers.parseHeader() to succeed, we need to construct
            // a string using the key (i.e. entry.getKey()) and the
            // element denoting the header value in the
            // [ unmodified key, value ] pair (i.e. entry.getValue()[1).
            //
            // The reason why UrlInterceptHandler instances supply such a
            // mapping in the first place is historical. Early versions of
            // the Gears plugin used java.net.HttpURLConnection, which always
            // returned headers names as capitalized strings. When these were
            // fed back into webkit, they failed to parse.
            //
            // Mewanwhile, Gears was modified to use Apache HTTP library
            // instead, so this design is now obsolete. Changing it however,
            // would require changes to the Gears C++ codebase and QA-ing and
            // submitting a new binary to the Android tree. Given the
            // timelines for the next Android release, we will not do this
            // for now.
            //
            // TODO: fix C++ Gears to remove the need for this
            // design.
            String keyValue = entry.getKey() + ": " + entry.getValue()[1];
            buffer.ensureCapacity(keyValue.length());
            buffer.append(keyValue);
            // Parse it into the header container.
            headers.parseHeader(buffer);
            // Clear the buffer
            buffer.clear();
        }
    }
}
+18 −0
Original line number Diff line number Diff line
@@ -28,7 +28,10 @@ import java.util.Map;
 * status code. The PluginData class is the container for all these
 * parts.
 *
 * @deprecated This class was inteded to be used by Gears. Since Gears was
 * deprecated, so is this class.
 */
@Deprecated
public final class PluginData {
    /**
     * The content stream.
@@ -59,7 +62,10 @@ public final class PluginData {
     * @param headers The response headers. Map of
     * lowercase header name to [ unmodified header name, header value]
     * @param length The HTTP response status code.
     *
     * @deprecated
     */
    @Deprecated
    public PluginData(
            InputStream stream,
            long length,
@@ -75,7 +81,10 @@ public final class PluginData {
     * Returns the input stream that contains the plugin content.
     *
     * @return An InputStream instance with the plugin content.
     *
     * @deprecated
     */
    @Deprecated
    public InputStream getInputStream() {
        return mStream;
    }
@@ -84,7 +93,10 @@ public final class PluginData {
     * Returns the length of the plugin content.
     *
     * @return the length of the plugin content.
     *
     * @deprecated
     */
    @Deprecated
    public long getContentLength() {
        return mContentLength;
    }
@@ -96,7 +108,10 @@ public final class PluginData {
     * @return A Map<String, String[]> containing all headers. The
     * mapping is 'lowercase header name' to ['unmodified header
     * name', header value].
     *
     * @deprecated
     */
    @Deprecated
    public Map<String, String[]> getHeaders() {
        return mHeaders;
    }
@@ -105,7 +120,10 @@ public final class PluginData {
     * Returns the HTTP status code for the response.
     *
     * @return The HTTP statue code, e.g 200.
     *
     * @deprecated
     */
    @Deprecated
    public int getStatusCode() {
        return mStatusCode;
    }
Loading