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

Commit 99c12e8d authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Create WebViewDatabaseClassic from WebViewDatabase.

WebViewDatabase has a getInstance() method, so similarly
to WebStorage, WebIconDatabase etc we refactor it into a
proxy class, and move the current implementation into
WebViewDatabaseClassic.

Also clean up some JavaDoc in touched files.

Bug: 6234236
Change-Id: I71cbd8f78e60f396e96e8546073ad634797cce15
parent fc8e5eaa
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class BrowserFrame extends Handler {
    private final CallbackProxy mCallbackProxy;
    private final WebSettingsClassic mSettings;
    private final Context mContext;
    private final WebViewDatabase mDatabase;
    private final WebViewDatabaseClassic mDatabase;
    private final WebViewCore mWebViewCore;
    /* package */ boolean mLoadInitFromJava;
    private int mLoadType;
@@ -241,7 +241,7 @@ class BrowserFrame extends Handler {
        mSettings = settings;
        mContext = context;
        mCallbackProxy = proxy;
        mDatabase = WebViewDatabase.getInstance(appContext);
        mDatabase = WebViewDatabaseClassic.getInstance(appContext);
        mWebViewCore = w;

        mSearchBox = new SearchBoxImpl(mWebViewCore, mCallbackProxy);
@@ -496,8 +496,8 @@ class BrowserFrame extends Handler {
                    if (item != null) {
                        WebAddress uri = new WebAddress(item.getUrl());
                        String schemePlusHost = uri.getScheme() + uri.getHost();
                        String[] up =
                                mDatabase.getUsernamePassword(schemePlusHost);
                        String[] up = mDatabase.getUsernamePassword(
                                schemePlusHost);
                        if (up != null && up[0] != null) {
                            setUsernamePassword(up[0], up[1]);
                        }
@@ -809,8 +809,7 @@ class BrowserFrame extends Handler {
                        // non-null username implies that user has
                        // chosen to save password, so update the
                        // recorded password
                        mDatabase.setUsernamePassword(
                                schemePlusHost, username, password);
                        mDatabase.setUsernamePassword(schemePlusHost, username, password);
                    }
                } else {
                    // CallbackProxy will handle creating the resume
+8 −4
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
    // A final CallbackProxy shared by WebViewCore and BrowserFrame.
    private CallbackProxy mCallbackProxy;

    private WebViewDatabase mDatabase;
    private WebViewDatabaseClassic mDatabase;

    // SSL certificate for the main top-level page (if secure)
    private SslCertificate mCertificate;
@@ -1230,7 +1230,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        mViewManager = new ViewManager(this);
        L10nUtils.setApplicationContext(context.getApplicationContext());
        mWebViewCore = new WebViewCore(context, this, mCallbackProxy, javaScriptInterfaces);
        mDatabase = WebViewDatabase.getInstance(context);
        mDatabase = WebViewDatabaseClassic.getInstance(context);
        mScroller = new OverScroller(context, null, 0, 0, false); //TODO Use OverScroller's flywheel
        mZoomManager = new ZoomManager(this, mCallbackProxy);

@@ -1294,6 +1294,11 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        public WebStorage getWebStorage() {
            return WebStorageClassic.getInstance();
        }

        @Override
        public WebViewDatabase getWebViewDatabase(Context context) {
            return WebViewDatabaseClassic.getInstance(context);
        }
    }

    private void onHandleUiEvent(MotionEvent event, int eventType, int flags) {
@@ -7191,8 +7196,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
                    break;
                }
                case NEVER_REMEMBER_PASSWORD: {
                    mDatabase.setUsernamePassword(
                            msg.getData().getString("host"), null, null);
                    mDatabase.setUsernamePassword(msg.getData().getString("host"), null, null);
                    ((Message) msg.obj).sendToTarget();
                    break;
                }
+32 −564

File changed.

Preview size limit exceeded, changes collapsed.

+624 −0

File added.

Preview size limit exceeded, changes collapsed.

+16 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.webkit;

import android.content.Context;

/**
 * This is the main entry-point into the WebView back end implementations, which the WebView
 * proxy class uses to instantiate all the other objects as needed. The backend must provide an
@@ -63,21 +65,32 @@ public interface WebViewFactoryProvider {
    /**
     * Gets the singleton CookieManager instance for this WebView implementation. The
     * implementation must return the same instance on subsequent calls.
     * @return the singleton CookieManager instance.
     *
     * @return the singleton CookieManager instance
     */
    CookieManager getCookieManager();

    /**
     * Gets the singleton WebIconDatabase instance for this WebView implementation. The
     * implementation must return the same instance on subsequent calls.
     * @return the singleton WebIconDatabase instance.
     *
     * @return the singleton WebIconDatabase instance
     */
    WebIconDatabase getWebIconDatabase();

    /**
     * Gets the singleton WebStorage instance for this WebView implementation. The
     * implementation must return the same instance on subsequent calls.
     * @return the singleton WebStorage instance.
     *
     * @return the singleton WebStorage instance
     */
    WebStorage getWebStorage();

    /**
     * Gets the singleton WebViewDatabase instance for this WebView implementation. The
     * implementation must return the same instance on subsequent calls.
     *
     * @return the singleton WebViewDatabase instance
     */
    WebViewDatabase getWebViewDatabase(Context context);
}