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

Commit 057989ed authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

WebView: add an API method to control web contents debugging

This adds static (as this is for the whole process) method
for controlling the web debugging state.

Please note that the implementation only makes sense for
Chromium WebView, and it's a no-op in WebViewClassic.

BUG=8691809

Change-Id: I815b4d69ad9ee814ca4cec1da81490b63ba2da68
parent e91a3f52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30228,6 +30228,7 @@ package android.webkit {
    method public deprecated void setPictureListener(android.webkit.WebView.PictureListener);
    method public void setVerticalScrollbarOverlay(boolean);
    method public void setWebChromeClient(android.webkit.WebChromeClient);
    method public static void setWebContentsDebuggingEnabled(boolean);
    method public void setWebViewClient(android.webkit.WebViewClient);
    method public deprecated boolean showFindDialog(java.lang.String, boolean);
    method public void stopLoading();
+16 −0
Original line number Diff line number Diff line
@@ -1679,6 +1679,22 @@ public class WebView extends AbsoluteLayout
        return mProvider.getSettings();
    }

    /**
     * Enables debugging of web contents (HTML / CSS / JavaScript)
     * loaded into any WebViews of this application. This flag can be enabled
     * in order to facilitate debugging of web layouts and JavaScript
     * code running inside WebViews. Please refer to WebView documentation
     * for the debugging guide.
     *
     * The default is false.
     *
     * @param enabled whether to enable web contents debugging
     */
    public static void setWebContentsDebuggingEnabled(boolean enabled) {
        checkThread();
        getFactory().getStatics().setWebContentsDebuggingEnabled(enabled);
    }

    /**
     * Gets the list of currently loaded plugins.
     *
+5 −0
Original line number Diff line number Diff line
@@ -1361,6 +1361,11 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
            return WebSettingsClassic.getDefaultUserAgentForLocale(context,
                    Locale.getDefault());
        }

        @Override
        public void setWebContentsDebuggingEnabled(boolean enable) {
            // no-op for WebViewClassic.
        }
    }

    private void onHandleUiEvent(MotionEvent event, int eventType, int flags) {
+6 −0
Original line number Diff line number Diff line
@@ -48,6 +48,12 @@ public interface WebViewFactoryProvider {
         * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) }
         */
        String getDefaultUserAgent(Context context);

        /**
         * Implements the API method:
         * {@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) }
         */
        void setWebContentsDebuggingEnabled(boolean enable);
    }

    Statics getStatics();