From 8818e82a062f2031cc7af7e4d491e942c38aa7e9 Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Thu, 28 May 2015 10:47:48 +0100 Subject: Remove no-longer-used webview glue sources. The WebView glue code no longer lives in Android, it's in the Chromium repository with the rest of the WebView implementation. Remove the unused sources, the unused build configuration, and also the obsolete scripts for running the downstream buildbot and merging Chromium changes into Android. Change-Id: If45550f5951bc7773c7ed011c05f845d1b65251b --- chromium/Android.mk | 7 +- chromium/AndroidManifest.xml | 30 - chromium/jar_package_whitelist.txt | 3 - .../webview/chromium/ContentSettingsAdapter.java | 618 ------ .../webview/chromium/CookieManagerAdapter.java | 160 -- .../android/webview/chromium/DrawGLFunctor.java | 124 -- .../webview/chromium/FileChooserParamsAdapter.java | 89 - .../chromium/GeolocationPermissionsAdapter.java | 62 - .../android/webview/chromium/GraphicsUtils.java | 31 - .../android/webview/chromium/ResourceRewriter.java | 40 - .../chromium/ResourcesContextWrapperFactory.java | 106 - .../webview/chromium/UnimplementedWebViewApi.java | 54 - .../chromium/WebBackForwardListChromium.java | 103 - .../webview/chromium/WebHistoryItemChromium.java | 98 - .../webview/chromium/WebIconDatabaseAdapter.java | 64 - .../webview/chromium/WebStorageAdapter.java | 80 - .../android/webview/chromium/WebViewChromium.java | 2248 -------------------- .../chromium/WebViewChromiumFactoryProvider.java | 481 ----- .../chromium/WebViewContentsClientAdapter.java | 1123 ---------- .../webview/chromium/WebViewDatabaseAdapter.java | 69 - .../webview/chromium/WebViewDelegateFactory.java | 345 --- chromium/package.mk | 100 - chromium/proguard.flags | 101 - .../res/drawable-hdpi/ic_media_video_poster.png | Bin 7060 -> 0 bytes chromium/res/drawable-hdpi/icon_webview.png | Bin 13975 -> 0 bytes .../res/drawable-ldpi/ic_media_video_poster.png | Bin 3523 -> 0 bytes .../res/drawable-mdpi/ic_media_video_poster.png | Bin 3499 -> 0 bytes chromium/res/drawable-mdpi/icon_webview.png | Bin 7151 -> 0 bytes .../res/drawable-xhdpi/ic_media_video_poster.png | Bin 9589 -> 0 bytes chromium/res/drawable-xhdpi/icon_webview.png | Bin 21981 -> 0 bytes chromium/res/drawable-xxhdpi/icon_webview.png | Bin 37607 -> 0 bytes chromium/res/values-af/strings.xml | 11 - chromium/res/values-am/strings.xml | 11 - chromium/res/values-ar/strings.xml | 11 - chromium/res/values-az-rAZ/strings.xml | 11 - chromium/res/values-az/strings.xml | 11 - chromium/res/values-bg/strings.xml | 11 - chromium/res/values-bn-rBD/strings.xml | 11 - chromium/res/values-ca/strings.xml | 11 - chromium/res/values-cs/strings.xml | 11 - chromium/res/values-da/strings.xml | 11 - chromium/res/values-de/strings.xml | 11 - chromium/res/values-el/strings.xml | 11 - chromium/res/values-en-rAU/strings.xml | 11 - chromium/res/values-en-rGB/strings.xml | 11 - chromium/res/values-en-rIN/strings.xml | 11 - chromium/res/values-es-rUS/strings.xml | 11 - chromium/res/values-es/strings.xml | 11 - chromium/res/values-et-rEE/strings.xml | 11 - chromium/res/values-eu-rES/strings.xml | 11 - chromium/res/values-fa/strings.xml | 11 - chromium/res/values-fi/strings.xml | 11 - chromium/res/values-fr-rCA/strings.xml | 11 - chromium/res/values-fr/strings.xml | 11 - chromium/res/values-gl-rES/strings.xml | 11 - chromium/res/values-gu-rIN/strings.xml | 11 - chromium/res/values-hi/strings.xml | 11 - chromium/res/values-hr/strings.xml | 11 - chromium/res/values-hu/strings.xml | 11 - chromium/res/values-hy-rAM/strings.xml | 11 - chromium/res/values-in/strings.xml | 11 - chromium/res/values-is-rIS/strings.xml | 11 - chromium/res/values-it/strings.xml | 11 - chromium/res/values-iw/strings.xml | 11 - chromium/res/values-ja/strings.xml | 11 - chromium/res/values-ka-rGE/strings.xml | 11 - chromium/res/values-kk-rKZ/strings.xml | 11 - chromium/res/values-km-rKH/strings.xml | 11 - chromium/res/values-kn-rIN/strings.xml | 11 - chromium/res/values-ko/strings.xml | 11 - chromium/res/values-ky-rKG/strings.xml | 11 - chromium/res/values-lo-rLA/strings.xml | 11 - chromium/res/values-lt/strings.xml | 11 - chromium/res/values-lv/strings.xml | 11 - chromium/res/values-mk-rMK/strings.xml | 11 - chromium/res/values-ml-rIN/strings.xml | 11 - chromium/res/values-mn-rMN/strings.xml | 11 - chromium/res/values-mr-rIN/strings.xml | 11 - chromium/res/values-ms-rMY/strings.xml | 11 - chromium/res/values-my-rMM/strings.xml | 11 - chromium/res/values-nb/strings.xml | 11 - chromium/res/values-ne-rNP/strings.xml | 11 - chromium/res/values-ne/strings.xml | 10 - chromium/res/values-nl/strings.xml | 11 - chromium/res/values-pa-rIN/strings.xml | 11 - chromium/res/values-pl/strings.xml | 11 - chromium/res/values-pt-rPT/strings.xml | 11 - chromium/res/values-pt/strings.xml | 11 - chromium/res/values-ro/strings.xml | 11 - chromium/res/values-ru/strings.xml | 11 - chromium/res/values-si-rLK/strings.xml | 11 - chromium/res/values-si/strings.xml | 10 - chromium/res/values-sk/strings.xml | 11 - chromium/res/values-sl/strings.xml | 11 - chromium/res/values-sq-rAL/strings.xml | 11 - chromium/res/values-sr/strings.xml | 11 - chromium/res/values-sv/strings.xml | 11 - chromium/res/values-sw/strings.xml | 11 - chromium/res/values-ta-rIN/strings.xml | 11 - chromium/res/values-te-rIN/strings.xml | 11 - chromium/res/values-th/strings.xml | 11 - chromium/res/values-tl/strings.xml | 11 - chromium/res/values-tr/strings.xml | 11 - chromium/res/values-uk/strings.xml | 11 - chromium/res/values-ur-rPK/strings.xml | 11 - chromium/res/values-uz-rUZ/strings.xml | 11 - chromium/res/values-vi/strings.xml | 11 - chromium/res/values-zh-rCN/strings.xml | 11 - chromium/res/values-zh-rHK/strings.xml | 11 - chromium/res/values-zh-rTW/strings.xml | 11 - chromium/res/values-zu/strings.xml | 11 - chromium/res/values/strings.xml | 12 - chromium/tools/buildbot/bb_webview_tot.sh | 35 - .../tools/buildbot/webview_buildbot_functions.sh | 165 -- chromium/tools/generate_local_manifest.py | 67 - chromium/tools/jar_check.py | 74 - chromium/tools/merge_common.py | 197 -- chromium/tools/merge_from_chromium.py | 581 ----- chromium/tools/merge_to_android.py | 394 ---- chromium/tools/run_webview_cts.py | 122 -- chromium/version.mk | 79 - 121 files changed, 2 insertions(+), 8738 deletions(-) delete mode 100644 chromium/AndroidManifest.xml delete mode 100644 chromium/jar_package_whitelist.txt delete mode 100644 chromium/java/com/android/webview/chromium/ContentSettingsAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/CookieManagerAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/DrawGLFunctor.java delete mode 100644 chromium/java/com/android/webview/chromium/FileChooserParamsAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/GeolocationPermissionsAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/GraphicsUtils.java delete mode 100644 chromium/java/com/android/webview/chromium/ResourceRewriter.java delete mode 100644 chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java delete mode 100644 chromium/java/com/android/webview/chromium/UnimplementedWebViewApi.java delete mode 100644 chromium/java/com/android/webview/chromium/WebBackForwardListChromium.java delete mode 100644 chromium/java/com/android/webview/chromium/WebHistoryItemChromium.java delete mode 100644 chromium/java/com/android/webview/chromium/WebIconDatabaseAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/WebStorageAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/WebViewChromium.java delete mode 100644 chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java delete mode 100644 chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/WebViewDatabaseAdapter.java delete mode 100644 chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java delete mode 100644 chromium/package.mk delete mode 100644 chromium/proguard.flags delete mode 100644 chromium/res/drawable-hdpi/ic_media_video_poster.png delete mode 100644 chromium/res/drawable-hdpi/icon_webview.png delete mode 100644 chromium/res/drawable-ldpi/ic_media_video_poster.png delete mode 100644 chromium/res/drawable-mdpi/ic_media_video_poster.png delete mode 100644 chromium/res/drawable-mdpi/icon_webview.png delete mode 100644 chromium/res/drawable-xhdpi/ic_media_video_poster.png delete mode 100644 chromium/res/drawable-xhdpi/icon_webview.png delete mode 100644 chromium/res/drawable-xxhdpi/icon_webview.png delete mode 100644 chromium/res/values-af/strings.xml delete mode 100644 chromium/res/values-am/strings.xml delete mode 100644 chromium/res/values-ar/strings.xml delete mode 100644 chromium/res/values-az-rAZ/strings.xml delete mode 100644 chromium/res/values-az/strings.xml delete mode 100644 chromium/res/values-bg/strings.xml delete mode 100644 chromium/res/values-bn-rBD/strings.xml delete mode 100644 chromium/res/values-ca/strings.xml delete mode 100644 chromium/res/values-cs/strings.xml delete mode 100644 chromium/res/values-da/strings.xml delete mode 100644 chromium/res/values-de/strings.xml delete mode 100644 chromium/res/values-el/strings.xml delete mode 100644 chromium/res/values-en-rAU/strings.xml delete mode 100644 chromium/res/values-en-rGB/strings.xml delete mode 100644 chromium/res/values-en-rIN/strings.xml delete mode 100644 chromium/res/values-es-rUS/strings.xml delete mode 100644 chromium/res/values-es/strings.xml delete mode 100644 chromium/res/values-et-rEE/strings.xml delete mode 100644 chromium/res/values-eu-rES/strings.xml delete mode 100644 chromium/res/values-fa/strings.xml delete mode 100644 chromium/res/values-fi/strings.xml delete mode 100644 chromium/res/values-fr-rCA/strings.xml delete mode 100644 chromium/res/values-fr/strings.xml delete mode 100644 chromium/res/values-gl-rES/strings.xml delete mode 100644 chromium/res/values-gu-rIN/strings.xml delete mode 100644 chromium/res/values-hi/strings.xml delete mode 100644 chromium/res/values-hr/strings.xml delete mode 100644 chromium/res/values-hu/strings.xml delete mode 100644 chromium/res/values-hy-rAM/strings.xml delete mode 100644 chromium/res/values-in/strings.xml delete mode 100644 chromium/res/values-is-rIS/strings.xml delete mode 100644 chromium/res/values-it/strings.xml delete mode 100644 chromium/res/values-iw/strings.xml delete mode 100644 chromium/res/values-ja/strings.xml delete mode 100644 chromium/res/values-ka-rGE/strings.xml delete mode 100644 chromium/res/values-kk-rKZ/strings.xml delete mode 100644 chromium/res/values-km-rKH/strings.xml delete mode 100644 chromium/res/values-kn-rIN/strings.xml delete mode 100644 chromium/res/values-ko/strings.xml delete mode 100644 chromium/res/values-ky-rKG/strings.xml delete mode 100644 chromium/res/values-lo-rLA/strings.xml delete mode 100644 chromium/res/values-lt/strings.xml delete mode 100644 chromium/res/values-lv/strings.xml delete mode 100644 chromium/res/values-mk-rMK/strings.xml delete mode 100644 chromium/res/values-ml-rIN/strings.xml delete mode 100644 chromium/res/values-mn-rMN/strings.xml delete mode 100644 chromium/res/values-mr-rIN/strings.xml delete mode 100644 chromium/res/values-ms-rMY/strings.xml delete mode 100644 chromium/res/values-my-rMM/strings.xml delete mode 100644 chromium/res/values-nb/strings.xml delete mode 100644 chromium/res/values-ne-rNP/strings.xml delete mode 100644 chromium/res/values-ne/strings.xml delete mode 100644 chromium/res/values-nl/strings.xml delete mode 100644 chromium/res/values-pa-rIN/strings.xml delete mode 100644 chromium/res/values-pl/strings.xml delete mode 100644 chromium/res/values-pt-rPT/strings.xml delete mode 100644 chromium/res/values-pt/strings.xml delete mode 100644 chromium/res/values-ro/strings.xml delete mode 100644 chromium/res/values-ru/strings.xml delete mode 100644 chromium/res/values-si-rLK/strings.xml delete mode 100644 chromium/res/values-si/strings.xml delete mode 100644 chromium/res/values-sk/strings.xml delete mode 100644 chromium/res/values-sl/strings.xml delete mode 100644 chromium/res/values-sq-rAL/strings.xml delete mode 100644 chromium/res/values-sr/strings.xml delete mode 100644 chromium/res/values-sv/strings.xml delete mode 100644 chromium/res/values-sw/strings.xml delete mode 100644 chromium/res/values-ta-rIN/strings.xml delete mode 100644 chromium/res/values-te-rIN/strings.xml delete mode 100644 chromium/res/values-th/strings.xml delete mode 100644 chromium/res/values-tl/strings.xml delete mode 100644 chromium/res/values-tr/strings.xml delete mode 100644 chromium/res/values-uk/strings.xml delete mode 100644 chromium/res/values-ur-rPK/strings.xml delete mode 100644 chromium/res/values-uz-rUZ/strings.xml delete mode 100644 chromium/res/values-vi/strings.xml delete mode 100644 chromium/res/values-zh-rCN/strings.xml delete mode 100644 chromium/res/values-zh-rHK/strings.xml delete mode 100644 chromium/res/values-zh-rTW/strings.xml delete mode 100644 chromium/res/values-zu/strings.xml delete mode 100644 chromium/res/values/strings.xml delete mode 100755 chromium/tools/buildbot/bb_webview_tot.sh delete mode 100755 chromium/tools/buildbot/webview_buildbot_functions.sh delete mode 100644 chromium/tools/generate_local_manifest.py delete mode 100755 chromium/tools/jar_check.py delete mode 100644 chromium/tools/merge_common.py delete mode 100755 chromium/tools/merge_from_chromium.py delete mode 100755 chromium/tools/merge_to_android.py delete mode 100755 chromium/tools/run_webview_cts.py delete mode 100644 chromium/version.mk (limited to 'chromium') diff --git a/chromium/Android.mk b/chromium/Android.mk index e015510..102afb1 100644 --- a/chromium/Android.mk +++ b/chromium/Android.mk @@ -14,10 +14,10 @@ # limitations under the License. # -# This package provides the 'glue' layer between Chromium and WebView. +# This package provides the system interfaces required to load WebView and allow +# it to render. LOCAL_PATH := $(call my-dir) -CHROMIUM_PATH := external/chromium_org # Native support library (libwebviewchromium_plat_support.so) - does NOT link # any native chromium code. @@ -73,6 +73,3 @@ LOCAL_SHARED_LIBRARIES += \ LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) - -# Build other stuff -include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/chromium/AndroidManifest.xml b/chromium/AndroidManifest.xml deleted file mode 100644 index 2d587d0..0000000 --- a/chromium/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/chromium/jar_package_whitelist.txt b/chromium/jar_package_whitelist.txt deleted file mode 100644 index cdd6f74..0000000 --- a/chromium/jar_package_whitelist.txt +++ /dev/null @@ -1,3 +0,0 @@ -com.android.webview -com.android.webview.chromium -com.android.org.chromium diff --git a/chromium/java/com/android/webview/chromium/ContentSettingsAdapter.java b/chromium/java/com/android/webview/chromium/ContentSettingsAdapter.java deleted file mode 100644 index 5f623e4..0000000 --- a/chromium/java/com/android/webview/chromium/ContentSettingsAdapter.java +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.util.Log; -import android.webkit.WebSettings.LayoutAlgorithm; -import android.webkit.WebSettings.PluginState; -import android.webkit.WebSettings.RenderPriority; -import android.webkit.WebSettings.TextSize; -import android.webkit.WebSettings.ZoomDensity; - -import org.chromium.android_webview.AwSettings; - -public class ContentSettingsAdapter extends android.webkit.WebSettings { - - private static final String LOGTAG = ContentSettingsAdapter.class.getSimpleName(); - private static final boolean TRACE = false; - - private AwSettings mAwSettings; - - public ContentSettingsAdapter(AwSettings awSettings) { - mAwSettings = awSettings; - } - - AwSettings getAwSettings() { - return mAwSettings; - } - - @Override - @Deprecated - public void setNavDump(boolean enabled) { - // Intentional no-op. - } - - @Override - @Deprecated - public boolean getNavDump() { - // Intentional no-op. - return false; - } - - @Override - public void setSupportZoom(boolean support) { - if (TRACE) Log.d(LOGTAG, "setSupportZoom=" + support); - mAwSettings.setSupportZoom(support); - } - - @Override - public boolean supportZoom() { - return mAwSettings.supportZoom(); - } - - @Override - public void setBuiltInZoomControls(boolean enabled) { - if (TRACE) Log.d(LOGTAG, "setBuiltInZoomControls=" + enabled); - mAwSettings.setBuiltInZoomControls(enabled); - } - - @Override - public boolean getBuiltInZoomControls() { - return mAwSettings.getBuiltInZoomControls(); - } - - @Override - public void setDisplayZoomControls(boolean enabled) { - if (TRACE) Log.d(LOGTAG, "setDisplayZoomControls=" + enabled); - mAwSettings.setDisplayZoomControls(enabled); - } - - @Override - public boolean getDisplayZoomControls() { - return mAwSettings.getDisplayZoomControls(); - } - - @Override - public void setAllowFileAccess(boolean allow) { - if (TRACE) Log.d(LOGTAG, "setAllowFileAccess=" + allow); - mAwSettings.setAllowFileAccess(allow); - } - - @Override - public boolean getAllowFileAccess() { - return mAwSettings.getAllowFileAccess(); - } - - @Override - public void setAllowContentAccess(boolean allow) { - if (TRACE) Log.d(LOGTAG, "setAllowContentAccess=" + allow); - mAwSettings.setAllowContentAccess(allow); - } - - @Override - public boolean getAllowContentAccess() { - return mAwSettings.getAllowContentAccess(); - } - - @Override - public void setLoadWithOverviewMode(boolean overview) { - if (TRACE) Log.d(LOGTAG, "setLoadWithOverviewMode=" + overview); - mAwSettings.setLoadWithOverviewMode(overview); - } - - @Override - public boolean getLoadWithOverviewMode() { - return mAwSettings.getLoadWithOverviewMode(); - } - - @Override - public void setAcceptThirdPartyCookies(boolean accept) { - if (TRACE) Log.d(LOGTAG, "setAcceptThirdPartyCookies=" + accept); - mAwSettings.setAcceptThirdPartyCookies(accept); - } - - @Override - public boolean getAcceptThirdPartyCookies() { - return mAwSettings.getAcceptThirdPartyCookies(); - } - - @Override - public void setEnableSmoothTransition(boolean enable) { - // Intentional no-op. - } - - @Override - public boolean enableSmoothTransition() { - // Intentional no-op. - return false; - } - - @Override - public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { - // Intentional no-op. - } - - @Override - public boolean getUseWebViewBackgroundForOverscrollBackground() { - // Intentional no-op. - return false; - } - - @Override - public void setSaveFormData(boolean save) { - if (TRACE) Log.d(LOGTAG, "setSaveFormData=" + save); - mAwSettings.setSaveFormData(save); - } - - @Override - public boolean getSaveFormData() { - return mAwSettings.getSaveFormData(); - } - - @Override - public void setSavePassword(boolean save) { - // Intentional no-op. - } - - @Override - public boolean getSavePassword() { - // Intentional no-op. - return false; - } - - @Override - public synchronized void setTextZoom(int textZoom) { - if (TRACE) Log.d(LOGTAG, "setTextZoom=" + textZoom); - mAwSettings.setTextZoom(textZoom); - } - - @Override - public synchronized int getTextZoom() { - return mAwSettings.getTextZoom(); - } - - @Override - public void setDefaultZoom(ZoomDensity zoom) { - if (zoom != ZoomDensity.MEDIUM) { - Log.w(LOGTAG, "setDefaultZoom not supported, zoom=" + zoom); - } - } - - @Override - public ZoomDensity getDefaultZoom() { - // Intentional no-op. - return ZoomDensity.MEDIUM; - } - - @Override - public void setLightTouchEnabled(boolean enabled) { - // Intentional no-op. - } - - @Override - public boolean getLightTouchEnabled() { - // Intentional no-op. - return false; - } - - @Override - public synchronized void setUserAgent(int ua) { - // Minimal implementation for backwards compatibility: just supports resetting to default. - if (ua == 0) { - setUserAgentString(null); - } else { - Log.w(LOGTAG, "setUserAgent not supported, ua=" + ua); - } - } - - @Override - public synchronized int getUserAgent() { - // Minimal implementation for backwards compatibility: just identifies default vs custom. - return AwSettings.getDefaultUserAgent().equals(getUserAgentString()) ? 0 : -1; - } - - @Override - public synchronized void setUseWideViewPort(boolean use) { - if (TRACE) Log.d(LOGTAG, "setUseWideViewPort=" + use); - mAwSettings.setUseWideViewPort(use); - } - - @Override - public synchronized boolean getUseWideViewPort() { - return mAwSettings.getUseWideViewPort(); - } - - @Override - public synchronized void setSupportMultipleWindows(boolean support) { - if (TRACE) Log.d(LOGTAG, "setSupportMultipleWindows=" + support); - mAwSettings.setSupportMultipleWindows(support); - } - - @Override - public synchronized boolean supportMultipleWindows() { - return mAwSettings.supportMultipleWindows(); - } - - @Override - public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { - // TODO: Remove the upstream enum and mapping once the new value is in the public API. - final AwSettings.LayoutAlgorithm[] chromiumValues = { - AwSettings.LayoutAlgorithm.NORMAL, - AwSettings.LayoutAlgorithm.SINGLE_COLUMN, - AwSettings.LayoutAlgorithm.NARROW_COLUMNS, - AwSettings.LayoutAlgorithm.TEXT_AUTOSIZING - }; - mAwSettings.setLayoutAlgorithm(chromiumValues[l.ordinal()]); - } - - @Override - public synchronized LayoutAlgorithm getLayoutAlgorithm() { - // TODO: Remove the upstream enum and mapping once the new value is in the public API. - final LayoutAlgorithm[] webViewValues = { - LayoutAlgorithm.NORMAL, - LayoutAlgorithm.SINGLE_COLUMN, - LayoutAlgorithm.NARROW_COLUMNS, - LayoutAlgorithm.TEXT_AUTOSIZING - }; - return webViewValues[mAwSettings.getLayoutAlgorithm().ordinal()]; - } - - @Override - public synchronized void setStandardFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setStandardFontFamily=" + font); - mAwSettings.setStandardFontFamily(font); - } - - @Override - public synchronized String getStandardFontFamily() { - return mAwSettings.getStandardFontFamily(); - } - - @Override - public synchronized void setFixedFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setFixedFontFamily=" + font); - mAwSettings.setFixedFontFamily(font); - } - - @Override - public synchronized String getFixedFontFamily() { - return mAwSettings.getFixedFontFamily(); - } - - @Override - public synchronized void setSansSerifFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setSansSerifFontFamily=" + font); - mAwSettings.setSansSerifFontFamily(font); - } - - @Override - public synchronized String getSansSerifFontFamily() { - return mAwSettings.getSansSerifFontFamily(); - } - - @Override - public synchronized void setSerifFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setSerifFontFamily=" + font); - mAwSettings.setSerifFontFamily(font); - } - - @Override - public synchronized String getSerifFontFamily() { - return mAwSettings.getSerifFontFamily(); - } - - @Override - public synchronized void setCursiveFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setCursiveFontFamily=" + font); - mAwSettings.setCursiveFontFamily(font); - } - - @Override - public synchronized String getCursiveFontFamily() { - return mAwSettings.getCursiveFontFamily(); - } - - @Override - public synchronized void setFantasyFontFamily(String font) { - if (TRACE) Log.d(LOGTAG, "setFantasyFontFamily=" + font); - mAwSettings.setFantasyFontFamily(font); - } - - @Override - public synchronized String getFantasyFontFamily() { - return mAwSettings.getFantasyFontFamily(); - } - - @Override - public synchronized void setMinimumFontSize(int size) { - if (TRACE) Log.d(LOGTAG, "setMinimumFontSize=" + size); - mAwSettings.setMinimumFontSize(size); - } - - @Override - public synchronized int getMinimumFontSize() { - return mAwSettings.getMinimumFontSize(); - } - - @Override - public synchronized void setMinimumLogicalFontSize(int size) { - if (TRACE) Log.d(LOGTAG, "setMinimumLogicalFontSize=" + size); - mAwSettings.setMinimumLogicalFontSize(size); - } - - @Override - public synchronized int getMinimumLogicalFontSize() { - return mAwSettings.getMinimumLogicalFontSize(); - } - - @Override - public synchronized void setDefaultFontSize(int size) { - if (TRACE) Log.d(LOGTAG, "setDefaultFontSize=" + size); - mAwSettings.setDefaultFontSize(size); - } - - @Override - public synchronized int getDefaultFontSize() { - return mAwSettings.getDefaultFontSize(); - } - - @Override - public synchronized void setDefaultFixedFontSize(int size) { - if (TRACE) Log.d(LOGTAG, "setDefaultFixedFontSize=" + size); - mAwSettings.setDefaultFixedFontSize(size); - } - - @Override - public synchronized int getDefaultFixedFontSize() { - return mAwSettings.getDefaultFixedFontSize(); - } - - @Override - public synchronized void setLoadsImagesAutomatically(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setLoadsImagesAutomatically=" + flag); - mAwSettings.setLoadsImagesAutomatically(flag); - } - - @Override - public synchronized boolean getLoadsImagesAutomatically() { - return mAwSettings.getLoadsImagesAutomatically(); - } - - @Override - public synchronized void setBlockNetworkImage(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setBlockNetworkImage=" + flag); - mAwSettings.setImagesEnabled(!flag); - } - - @Override - public synchronized boolean getBlockNetworkImage() { - return !mAwSettings.getImagesEnabled(); - } - - @Override - public synchronized void setBlockNetworkLoads(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setBlockNetworkLoads=" + flag); - mAwSettings.setBlockNetworkLoads(flag); - } - - @Override - public synchronized boolean getBlockNetworkLoads() { - return mAwSettings.getBlockNetworkLoads(); - } - - @Override - public synchronized void setJavaScriptEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setJavaScriptEnabled=" + flag); - mAwSettings.setJavaScriptEnabled(flag); - } - - @Override - public void setAllowUniversalAccessFromFileURLs(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setAllowUniversalAccessFromFileURLs=" + flag); - mAwSettings.setAllowUniversalAccessFromFileURLs(flag); - } - - @Override - public void setAllowFileAccessFromFileURLs(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setAllowFileAccessFromFileURLs=" + flag); - mAwSettings.setAllowFileAccessFromFileURLs(flag); - } - - @Override - public synchronized void setPluginsEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setPluginsEnabled=" + flag); - mAwSettings.setPluginsEnabled(flag); - } - - @Override - public synchronized void setPluginState(PluginState state) { - if (TRACE) Log.d(LOGTAG, "setPluginState=" + state); - mAwSettings.setPluginState(state); - } - - @Override - public synchronized void setDatabasePath(String databasePath) { - // Intentional no-op. - } - - @Override - public synchronized void setGeolocationDatabasePath(String databasePath) { - // Intentional no-op. - } - - @Override - public synchronized void setAppCacheEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setAppCacheEnabled=" + flag); - mAwSettings.setAppCacheEnabled(flag); - } - - @Override - public synchronized void setAppCachePath(String appCachePath) { - if (TRACE) Log.d(LOGTAG, "setAppCachePath=" + appCachePath); - mAwSettings.setAppCachePath(appCachePath); - } - - @Override - public synchronized void setAppCacheMaxSize(long appCacheMaxSize) { - // Intentional no-op. - } - - @Override - public synchronized void setDatabaseEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setDatabaseEnabled=" + flag); - mAwSettings.setDatabaseEnabled(flag); - } - - @Override - public synchronized void setDomStorageEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setDomStorageEnabled=" + flag); - mAwSettings.setDomStorageEnabled(flag); - } - - @Override - public synchronized boolean getDomStorageEnabled() { - return mAwSettings.getDomStorageEnabled(); - } - - @Override - public synchronized String getDatabasePath() { - // Intentional no-op. - return ""; - } - - @Override - public synchronized boolean getDatabaseEnabled() { - return mAwSettings.getDatabaseEnabled(); - } - - @Override - public synchronized void setGeolocationEnabled(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setGeolocationEnabled=" + flag); - mAwSettings.setGeolocationEnabled(flag); - } - - @Override - public synchronized boolean getJavaScriptEnabled() { - return mAwSettings.getJavaScriptEnabled(); - } - - @Override - public boolean getAllowUniversalAccessFromFileURLs() { - return mAwSettings.getAllowUniversalAccessFromFileURLs(); - } - - @Override - public boolean getAllowFileAccessFromFileURLs() { - return mAwSettings.getAllowFileAccessFromFileURLs(); - } - - @Override - public synchronized boolean getPluginsEnabled() { - return mAwSettings.getPluginsEnabled(); - } - - @Override - public synchronized PluginState getPluginState() { - return mAwSettings.getPluginState(); - } - - @Override - public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setJavaScriptCanOpenWindowsAutomatically=" + flag); - mAwSettings.setJavaScriptCanOpenWindowsAutomatically(flag); - } - - @Override - public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() { - return mAwSettings.getJavaScriptCanOpenWindowsAutomatically(); - } - - @Override - public synchronized void setDefaultTextEncodingName(String encoding) { - if (TRACE) Log.d(LOGTAG, "setDefaultTextEncodingName=" + encoding); - mAwSettings.setDefaultTextEncodingName(encoding); - } - - @Override - public synchronized String getDefaultTextEncodingName() { - return mAwSettings.getDefaultTextEncodingName(); - } - - @Override - public synchronized void setUserAgentString(String ua) { - if (TRACE) Log.d(LOGTAG, "setUserAgentString=" + ua); - mAwSettings.setUserAgentString(ua); - } - - @Override - public synchronized String getUserAgentString() { - return mAwSettings.getUserAgentString(); - } - - @Override - public void setNeedInitialFocus(boolean flag) { - if (TRACE) Log.d(LOGTAG, "setNeedInitialFocus=" + flag); - mAwSettings.setShouldFocusFirstNode(flag); - } - - @Override - public synchronized void setRenderPriority(RenderPriority priority) { - // Intentional no-op. - } - - @Override - public void setCacheMode(int mode) { - if (TRACE) Log.d(LOGTAG, "setCacheMode=" + mode); - mAwSettings.setCacheMode(mode); - } - - @Override - public int getCacheMode() { - return mAwSettings.getCacheMode(); - } - - @Override - public void setMediaPlaybackRequiresUserGesture(boolean require) { - if (TRACE) Log.d(LOGTAG, "setMediaPlaybackRequiresUserGesture=" + require); - mAwSettings.setMediaPlaybackRequiresUserGesture(require); - } - - @Override - public boolean getMediaPlaybackRequiresUserGesture() { - return mAwSettings.getMediaPlaybackRequiresUserGesture(); - } - -// @Override - public void setMixedContentMode(int mode) { - mAwSettings.setMixedContentMode(mode); - } - -// @Override - public int getMixedContentMode() { - return mAwSettings.getMixedContentMode(); - } - -// @Override - public void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean flag) { - mAwSettings.setVideoOverlayForEmbeddedVideoEnabled(flag); - } - -// @Override - public boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled() { - return mAwSettings.getVideoOverlayForEmbeddedVideoEnabled(); - } -} diff --git a/chromium/java/com/android/webview/chromium/CookieManagerAdapter.java b/chromium/java/com/android/webview/chromium/CookieManagerAdapter.java deleted file mode 100644 index 2dd34a3..0000000 --- a/chromium/java/com/android/webview/chromium/CookieManagerAdapter.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.net.ParseException; -import android.net.WebAddress; -import android.util.Log; -import android.webkit.CookieManager; -import android.webkit.ValueCallback; -import android.webkit.WebView; - -import org.chromium.android_webview.AwCookieManager; - -public class CookieManagerAdapter extends CookieManager { - - private static final String LOGTAG = "CookieManager"; - - AwCookieManager mChromeCookieManager; - - public CookieManagerAdapter(AwCookieManager chromeCookieManager) { - mChromeCookieManager = chromeCookieManager; - } - - @Override - public synchronized void setAcceptCookie(boolean accept) { - mChromeCookieManager.setAcceptCookie(accept); - } - - @Override - public synchronized boolean acceptCookie() { - return mChromeCookieManager.acceptCookie(); - } - - @Override - public synchronized void setAcceptThirdPartyCookies(WebView webView, boolean accept) { - webView.getSettings().setAcceptThirdPartyCookies(accept); - } - - @Override - public synchronized boolean acceptThirdPartyCookies(WebView webView) { - return webView.getSettings().getAcceptThirdPartyCookies(); - } - - @Override - public void setCookie(String url, String value) { - try { - mChromeCookieManager.setCookie(fixupUrl(url), value); - } catch (ParseException e) { - Log.e(LOGTAG, "Not setting cookie due to error parsing URL: " + url, e); - } - } - - @Override - public void setCookie(String url, String value, ValueCallback callback) { - try { - mChromeCookieManager.setCookie(fixupUrl(url), value, callback); - } catch (ParseException e) { - Log.e(LOGTAG, "Not setting cookie due to error parsing URL: " + url, e); - } - } - - @Override - public String getCookie(String url) { - try { - return mChromeCookieManager.getCookie(fixupUrl(url)); - } catch (ParseException e) { - Log.e(LOGTAG, "Unable to get cookies due to error parsing URL: " + url, e); - return null; - } - } - - @Override - public String getCookie(String url, boolean privateBrowsing) { - return getCookie(url); - } - - // TODO(igsolla): remove this override once the WebView apk does not longer need - // to be binary compatibility with the API 21 version of the framework - /** - * IMPORTANT: This override is required for compatibility with the API 21 version of - * {@link CookieManager}. - */ - @Override - public synchronized String getCookie(WebAddress uri) { - return mChromeCookieManager.getCookie(uri.toString()); - } - - @Override - public void removeSessionCookie() { - mChromeCookieManager.removeSessionCookies(); - } - - @Override - public void removeSessionCookies(ValueCallback callback) { - mChromeCookieManager.removeSessionCookies(callback); - } - - @Override - public void removeAllCookie() { - mChromeCookieManager.removeAllCookies(); - } - - @Override - public void removeAllCookies(ValueCallback callback) { - mChromeCookieManager.removeAllCookies(callback); - } - - @Override - public synchronized boolean hasCookies() { - return mChromeCookieManager.hasCookies(); - } - - @Override - public synchronized boolean hasCookies(boolean privateBrowsing) { - return mChromeCookieManager.hasCookies(); - } - - @Override - public void removeExpiredCookie() { - mChromeCookieManager.removeExpiredCookie(); - } - - @Override - public void flush() { - mChromeCookieManager.flushCookieStore(); - } - - @Override - protected boolean allowFileSchemeCookiesImpl() { - return mChromeCookieManager.allowFileSchemeCookies(); - } - - @Override - protected void setAcceptFileSchemeCookiesImpl(boolean accept) { - mChromeCookieManager.setAcceptFileSchemeCookies(accept); - } - - private static String fixupUrl(String url) throws ParseException { - // WebAddress is a private API in the android framework and a "quirk" - // of the Classic WebView implementation that allowed embedders to - // be relaxed about what URLs they passed into the CookieManager, so we - // do the same normalisation before entering the chromium stack. - return new WebAddress(url).toString(); - } - -} diff --git a/chromium/java/com/android/webview/chromium/DrawGLFunctor.java b/chromium/java/com/android/webview/chromium/DrawGLFunctor.java deleted file mode 100644 index 7805077..0000000 --- a/chromium/java/com/android/webview/chromium/DrawGLFunctor.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.view.View; -import android.graphics.Canvas; -import android.util.Log; - -import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; - -import org.chromium.content.common.CleanupReference; - -// Simple Java abstraction and wrapper for the native DrawGLFunctor flow. -// An instance of this class can be constructed, bound to a single view context (i.e. AwContennts) -// and then drawn and detached from the view tree any number of times (using requestDrawGL and -// detach respectively). Then when finished with, it can be explicitly released by calling -// destroy() or will clean itself up as required via finalizer / CleanupReference. -class DrawGLFunctor { - - private static final String TAG = DrawGLFunctor.class.getSimpleName(); - - // Pointer to native side instance - private CleanupReference mCleanupReference; - private DestroyRunnable mDestroyRunnable; - private WebViewDelegate mWebViewDelegate; - - public DrawGLFunctor(long viewContext, WebViewDelegate webViewDelegate) { - mDestroyRunnable = new DestroyRunnable(nativeCreateGLFunctor(viewContext), webViewDelegate); - mCleanupReference = new CleanupReference(this, mDestroyRunnable); - mWebViewDelegate = webViewDelegate; - } - - public void destroy() { - detach(); - if (mCleanupReference != null) { - mCleanupReference.cleanupNow(); - mCleanupReference = null; - mDestroyRunnable = null; - mWebViewDelegate = null; - } - } - - public void detach() { - mDestroyRunnable.detachNativeFunctor(); - } - - public boolean requestDrawGL(Canvas canvas, View containerView, - boolean waitForCompletion) { - if (mDestroyRunnable.mNativeDrawGLFunctor == 0) { - throw new RuntimeException("requested DrawGL on already destroyed DrawGLFunctor"); - } - - if (canvas != null && waitForCompletion) { - throw new IllegalArgumentException("requested a blocking DrawGL with a not null canvas."); - } - - if (!mWebViewDelegate.canInvokeDrawGlFunctor(containerView)) { - return false; - } - - mDestroyRunnable.mContainerView = containerView; - - if (canvas == null) { - mWebViewDelegate.invokeDrawGlFunctor(containerView, - mDestroyRunnable.mNativeDrawGLFunctor, waitForCompletion); - return true; - } - - mWebViewDelegate.callDrawGlFunction(canvas, mDestroyRunnable.mNativeDrawGLFunctor); - return true; - } - - public static void setChromiumAwDrawGLFunction(long functionPointer) { - nativeSetChromiumAwDrawGLFunction(functionPointer); - } - - // Holds the core resources of the class, everything required to correctly cleanup. - // IMPORTANT: this class must not hold any reference back to the outer DrawGLFunctor - // instance, as that will defeat GC of that object. - private static final class DestroyRunnable implements Runnable { - private WebViewDelegate mWebViewDelegate; - View mContainerView; - long mNativeDrawGLFunctor; - DestroyRunnable(long nativeDrawGLFunctor, WebViewDelegate webViewDelegate) { - mNativeDrawGLFunctor = nativeDrawGLFunctor; - mWebViewDelegate = webViewDelegate; - } - - // Called when the outer DrawGLFunctor instance has been GC'ed, i.e this is its finalizer. - @Override - public void run() { - detachNativeFunctor(); - nativeDestroyGLFunctor(mNativeDrawGLFunctor); - mNativeDrawGLFunctor = 0; - } - - void detachNativeFunctor() { - if (mNativeDrawGLFunctor != 0 && mContainerView != null - && mWebViewDelegate != null) { - mWebViewDelegate.detachDrawGlFunctor(mContainerView, mNativeDrawGLFunctor); - } - mContainerView = null; - mWebViewDelegate = null; - } - } - - private static native long nativeCreateGLFunctor(long viewContext); - private static native void nativeDestroyGLFunctor(long functor); - private static native void nativeSetChromiumAwDrawGLFunction(long functionPointer); -} diff --git a/chromium/java/com/android/webview/chromium/FileChooserParamsAdapter.java b/chromium/java/com/android/webview/chromium/FileChooserParamsAdapter.java deleted file mode 100644 index 07222f2..0000000 --- a/chromium/java/com/android/webview/chromium/FileChooserParamsAdapter.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2014 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 com.android.webview.chromium; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.webkit.WebChromeClient.FileChooserParams; - -import org.chromium.android_webview.AwContentsClient; - -public class FileChooserParamsAdapter extends FileChooserParams { - private AwContentsClient.FileChooserParams mParams; - - public static Uri[] parseFileChooserResult(int resultCode, Intent intent) { - if (resultCode == Activity.RESULT_CANCELED) { - return null; - } - Uri result = intent == null || resultCode != Activity.RESULT_OK ? null - : intent.getData(); - - Uri[] uris = null; - if (result != null) { - uris = new Uri[1]; - uris[0] = result; - } - return uris; - } - - FileChooserParamsAdapter(AwContentsClient.FileChooserParams params, Context context) { - mParams = params; - } - - @Override - public int getMode() { - return mParams.mode; - } - - @Override - public String[] getAcceptTypes() { - if (mParams.acceptTypes == null) - return new String[0]; - return mParams.acceptTypes.split(";"); - } - - @Override - public boolean isCaptureEnabled() { - return mParams.capture; - } - - @Override - public CharSequence getTitle() { - return mParams.title; - } - - @Override - public String getFilenameHint() { - return mParams.defaultFilename; - } - - @Override - public Intent createIntent() { - // TODO: Move this code to Aw. Once code is moved - // and merged to M37 get rid of this. - String mimeType = "*/*"; - if (mParams.acceptTypes != null && !mParams.acceptTypes.trim().isEmpty()) - mimeType = mParams.acceptTypes.split(";")[0]; - - Intent i = new Intent(Intent.ACTION_GET_CONTENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType(mimeType); - return i; - } -} diff --git a/chromium/java/com/android/webview/chromium/GeolocationPermissionsAdapter.java b/chromium/java/com/android/webview/chromium/GeolocationPermissionsAdapter.java deleted file mode 100644 index 7c0499b..0000000 --- a/chromium/java/com/android/webview/chromium/GeolocationPermissionsAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.webkit.GeolocationPermissions; -import android.webkit.ValueCallback; - -import org.chromium.android_webview.AwGeolocationPermissions; - -import java.util.Set; - -/** - * Chromium implementation of GeolocationPermissions -- forwards calls to the - * chromium internal implementation. - */ -final class GeolocationPermissionsAdapter extends GeolocationPermissions { - - private AwGeolocationPermissions mChromeGeolocationPermissions; - - public GeolocationPermissionsAdapter(AwGeolocationPermissions chromeGeolocationPermissions) { - mChromeGeolocationPermissions = chromeGeolocationPermissions; - } - - @Override - public void allow(String origin) { - mChromeGeolocationPermissions.allow(origin); - } - - @Override - public void clear(String origin) { - mChromeGeolocationPermissions.clear(origin); - } - - @Override - public void clearAll() { - mChromeGeolocationPermissions.clearAll(); - } - - @Override - public void getAllowed(String origin, ValueCallback callback) { - mChromeGeolocationPermissions.getAllowed(origin, callback); - } - - @Override - public void getOrigins(ValueCallback> callback) { - mChromeGeolocationPermissions.getOrigins(callback); - } -} diff --git a/chromium/java/com/android/webview/chromium/GraphicsUtils.java b/chromium/java/com/android/webview/chromium/GraphicsUtils.java deleted file mode 100644 index 66c3f75..0000000 --- a/chromium/java/com/android/webview/chromium/GraphicsUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -abstract class GraphicsUtils { - public static long getDrawSWFunctionTable() { - return nativeGetDrawSWFunctionTable(); - } - - public static long getDrawGLFunctionTable() { - return nativeGetDrawGLFunctionTable(); - } - - private static native long nativeGetDrawSWFunctionTable(); - private static native long nativeGetDrawGLFunctionTable(); - -} diff --git a/chromium/java/com/android/webview/chromium/ResourceRewriter.java b/chromium/java/com/android/webview/chromium/ResourceRewriter.java deleted file mode 100644 index 7d035b7..0000000 --- a/chromium/java/com/android/webview/chromium/ResourceRewriter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2014 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 com.android.webview.chromium; - -import android.content.Context; - -/** - * Helper class used to fix up resource ids. - * This is mostly a copy of the code in frameworks/base/core/java/android/app/LoadedApk.java. - * TODO: Remove if a cleaner mechanism is provided (either public API or AAPT is changed to generate - * this code). - */ -class ResourceRewriter { - - /** - * Rewrite the R 'constants' for the WebView library apk. - */ - public static void rewriteRValues(final int packageId) { - // TODO: We should use jarjar to remove the redundant R classes here, but due - // to a bug in jarjar it's not possible to rename classes with '$' in their name. - // See b/15684775. - com.android.webview.chromium.R.onResourcesLoaded(packageId); - org.chromium.ui.R.onResourcesLoaded(packageId); - org.chromium.content.R.onResourcesLoaded(packageId); - } -} diff --git a/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java b/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java deleted file mode 100644 index da4174f..0000000 --- a/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2014 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 com.android.webview.chromium; - -import android.content.ComponentCallbacks; -import android.content.Context; -import android.content.ContextWrapper; -import android.content.res.AssetManager; -import android.content.res.Resources; -import android.view.LayoutInflater; - -import java.util.WeakHashMap; - -/** - * This class allows us to wrap the application context so that the WebView implementation can - * correctly reference both org.chromium.* and application classes which is necessary to properly - * inflate UI. We keep a weak map from contexts to wrapped contexts to avoid constantly re-wrapping - * or doubly wrapping contexts. - */ -public class ResourcesContextWrapperFactory { - private static WeakHashMap sCtxToWrapper - = new WeakHashMap(); - private static final Object sLock = new Object(); - - private ResourcesContextWrapperFactory() { - } - - public static Context get(Context ctx) { - ContextWrapper wrappedCtx; - synchronized (sLock) { - wrappedCtx = sCtxToWrapper.get(ctx); - if (wrappedCtx == null) { - wrappedCtx = createWrapper(ctx); - sCtxToWrapper.put(ctx, wrappedCtx); - } - } - return wrappedCtx; - } - - private static ContextWrapper createWrapper(final Context ctx) { - return new ContextWrapper(ctx) { - private Context applicationContext; - - @Override - public ClassLoader getClassLoader() { - final ClassLoader appCl = getBaseContext().getClassLoader(); - final ClassLoader webViewCl = this.getClass().getClassLoader(); - return new ClassLoader() { - @Override - protected Class findClass(String name) throws ClassNotFoundException { - // First look in the WebViewProvider class loader. - try { - return webViewCl.loadClass(name); - } catch (ClassNotFoundException e) { - // Look in the app class loader; allowing it to throw ClassNotFoundException. - return appCl.loadClass(name); - } - } - }; - } - - @Override - public Object getSystemService(String name) { - if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) { - LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name); - return i.cloneInContext(this); - } else { - return getBaseContext().getSystemService(name); - } - } - - @Override - public Context getApplicationContext() { - if (applicationContext == null) - applicationContext = get(ctx.getApplicationContext()); - return applicationContext; - } - - @Override - public void registerComponentCallbacks(ComponentCallbacks callback) { - // We have to override registerComponentCallbacks and unregisterComponentCallbacks - // since they call getApplicationContext().[un]registerComponentCallbacks() - // which causes us to go into a loop. - ctx.registerComponentCallbacks(callback); - } - - @Override - public void unregisterComponentCallbacks(ComponentCallbacks callback) { - ctx.unregisterComponentCallbacks(callback); - } - }; - } -} diff --git a/chromium/java/com/android/webview/chromium/UnimplementedWebViewApi.java b/chromium/java/com/android/webview/chromium/UnimplementedWebViewApi.java deleted file mode 100644 index e3ad83c..0000000 --- a/chromium/java/com/android/webview/chromium/UnimplementedWebViewApi.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.util.Log; - -// TODO: remove this when all WebView APIs have been implemented. -public class UnimplementedWebViewApi { - private static String TAG = "UnimplementedWebViewApi"; - - private static class UnimplementedWebViewApiException extends UnsupportedOperationException { - public UnimplementedWebViewApiException() { - super(); - } - } - - private static boolean THROW = false; - // By default we keep the traces down to one frame to reduce noise, but for debugging it might - // be useful to set this to true. - private static boolean FULL_TRACE = false; - - public static void invoke() throws UnimplementedWebViewApiException { - if (THROW) { - throw new UnimplementedWebViewApiException(); - } else { - if (FULL_TRACE) { - Log.w(TAG, "Unimplemented WebView method called in: " + - Log.getStackTraceString(new Throwable())); - } else { - StackTraceElement[] trace = new Throwable().getStackTrace(); - // The stack trace [0] index is this method (invoke()). - StackTraceElement unimplementedMethod = trace[1]; - StackTraceElement caller = trace[2]; - Log.w(TAG, "Unimplemented WebView method " + unimplementedMethod.getMethodName() + - " called from: " + caller.toString()); - } - } - } - -} diff --git a/chromium/java/com/android/webview/chromium/WebBackForwardListChromium.java b/chromium/java/com/android/webview/chromium/WebBackForwardListChromium.java deleted file mode 100644 index b584ee9..0000000 --- a/chromium/java/com/android/webview/chromium/WebBackForwardListChromium.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import org.chromium.content_public.browser.NavigationHistory; - -import android.webkit.WebBackForwardList; -import android.webkit.WebHistoryItem; - -import java.util.ArrayList; -import java.util.List; - -/** - * WebView Chromium implementation of WebBackForwardList. Simple immutable - * wrapper around NavigationHistory. - */ -public class WebBackForwardListChromium extends WebBackForwardList { - private final List mHistroryItemList; - private final int mCurrentIndex; - - /* package */ WebBackForwardListChromium(NavigationHistory nav_history) { - mCurrentIndex = nav_history.getCurrentEntryIndex(); - mHistroryItemList = new ArrayList(nav_history.getEntryCount()); - for (int i = 0; i < nav_history.getEntryCount(); ++i) { - mHistroryItemList.add( - new WebHistoryItemChromium(nav_history.getEntryAtIndex(i))); - } - } - - /** - * See {@link android.webkit.WebBackForwardList#getCurrentItem}. - */ - @Override - public synchronized WebHistoryItem getCurrentItem() { - if (getSize() == 0) { - return null; - } else { - return getItemAtIndex(getCurrentIndex()); - } - } - - /** - * See {@link android.webkit.WebBackForwardList#getCurrentIndex}. - */ - @Override - public synchronized int getCurrentIndex() { - return mCurrentIndex; - } - - /** - * See {@link android.webkit.WebBackForwardList#getItemAtIndex}. - */ - @Override - public synchronized WebHistoryItem getItemAtIndex(int index) { - if (index < 0 || index >= getSize()) { - return null; - } else { - return mHistroryItemList.get(index); - } - } - - /** - * See {@link android.webkit.WebBackForwardList#getSize}. - */ - @Override - public synchronized int getSize() { - return mHistroryItemList.size(); - } - - // Clone constructor. - private WebBackForwardListChromium(List list, - int currentIndex) { - mHistroryItemList = list; - mCurrentIndex = currentIndex; - } - - /** - * See {@link android.webkit.WebBackForwardList#clone}. - */ - @Override - protected synchronized WebBackForwardListChromium clone() { - List list = - new ArrayList(getSize()); - for (int i = 0; i < getSize(); ++i) { - list.add(mHistroryItemList.get(i).clone()); - } - return new WebBackForwardListChromium(list, mCurrentIndex); - } -} diff --git a/chromium/java/com/android/webview/chromium/WebHistoryItemChromium.java b/chromium/java/com/android/webview/chromium/WebHistoryItemChromium.java deleted file mode 100644 index e36384b..0000000 --- a/chromium/java/com/android/webview/chromium/WebHistoryItemChromium.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import org.chromium.content_public.browser.NavigationEntry; - -import android.graphics.Bitmap; -import android.webkit.WebHistoryItem; - -/** - * WebView Chromium implementation of WebHistoryItem. Simple immutable wrapper - * around NavigationEntry - */ -public class WebHistoryItemChromium extends WebHistoryItem { - private final String mUrl; - private final String mOriginalUrl; - private final String mTitle; - private final Bitmap mFavicon; - - /* package */ WebHistoryItemChromium(NavigationEntry entry) { - mUrl = entry.getUrl(); - mOriginalUrl = entry.getOriginalUrl(); - mTitle = entry.getTitle(); - mFavicon = entry.getFavicon(); - } - - /** - * See {@link android.webkit.WebHistoryItem#getId}. - */ - @Override - public int getId() { - // This method is deprecated in superclass. Returning constant -1 now. - return -1; - } - - /** - * See {@link android.webkit.WebHistoryItem#getUrl}. - */ - @Override - public String getUrl() { - return mUrl; - } - - /** - * See {@link android.webkit.WebHistoryItem#getOriginalUrl}. - */ - @Override - public String getOriginalUrl() { - return mOriginalUrl; - } - - /** - * See {@link android.webkit.WebHistoryItem#getTitle}. - */ - @Override - public String getTitle() { - return mTitle; - } - - /** - * See {@link android.webkit.WebHistoryItem#getFavicon}. - */ - @Override - public Bitmap getFavicon() { - return mFavicon; - } - - // Clone constructor. - private WebHistoryItemChromium( - String url, String originalUrl, String title, Bitmap favicon) { - mUrl = url; - mOriginalUrl = originalUrl; - mTitle = title; - mFavicon = favicon; - } - - /** - * See {@link android.webkit.WebHistoryItem#clone}. - */ - @Override - public synchronized WebHistoryItemChromium clone() { - return new WebHistoryItemChromium(mUrl, mOriginalUrl, mTitle, mFavicon); - } -} diff --git a/chromium/java/com/android/webview/chromium/WebIconDatabaseAdapter.java b/chromium/java/com/android/webview/chromium/WebIconDatabaseAdapter.java deleted file mode 100644 index c8af220..0000000 --- a/chromium/java/com/android/webview/chromium/WebIconDatabaseAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.content.ContentResolver; -import android.webkit.WebIconDatabase; -import android.webkit.WebIconDatabase.IconListener; - -import org.chromium.android_webview.AwContents; - -/** - * Chromium implementation of WebIconDatabase -- big old no-op (base class is deprecated). - */ -final class WebIconDatabaseAdapter extends WebIconDatabase { - @Override - public void open(String path) { - AwContents.setShouldDownloadFavicons(); - } - - @Override - public void close() { - // Intentional no-op. - } - - @Override - public void removeAllIcons() { - // Intentional no-op: we have no database so nothing to remove. - } - - @Override - public void requestIconForPageUrl(String url, IconListener listener) { - // Intentional no-op. - } - - @Override - public void bulkRequestIconForPageUrl(ContentResolver cr, String where, - IconListener listener) { - // Intentional no-op: hidden in base class. - } - - @Override - public void retainIconForPageUrl(String url) { - // Intentional no-op. - } - - @Override - public void releaseIconForPageUrl(String url) { - // Intentional no-op. - } -} diff --git a/chromium/java/com/android/webview/chromium/WebStorageAdapter.java b/chromium/java/com/android/webview/chromium/WebStorageAdapter.java deleted file mode 100644 index 13b34dd..0000000 --- a/chromium/java/com/android/webview/chromium/WebStorageAdapter.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.webkit.ValueCallback; -import android.webkit.WebStorage; - -import java.util.HashMap; -import java.util.Map; - -import org.chromium.android_webview.AwQuotaManagerBridge; - -/** - * Chromium implementation of WebStorage -- forwards calls to the - * chromium internal implementation. - */ -final class WebStorageAdapter extends WebStorage { - private final AwQuotaManagerBridge mQuotaManagerBridge; - WebStorageAdapter(AwQuotaManagerBridge quotaManagerBridge) { - mQuotaManagerBridge = quotaManagerBridge; - } - - @Override - public void getOrigins(final ValueCallback callback) { - mQuotaManagerBridge.getOrigins(new ValueCallback() { - @Override - public void onReceiveValue(AwQuotaManagerBridge.Origins origins) { - Map originsMap = new HashMap(); - for (int i = 0; i < origins.mOrigins.length; ++i) { - Origin origin = new Origin(origins.mOrigins[i], origins.mQuotas[i], - origins.mUsages[i]) { - // Intentionally empty to work around cross-package protected visibility - // of Origin constructor. - }; - originsMap.put(origins.mOrigins[i], origin); - } - callback.onReceiveValue(originsMap); - } - }); - } - - @Override - public void getUsageForOrigin(String origin, ValueCallback callback) { - mQuotaManagerBridge.getUsageForOrigin(origin, callback); - } - - @Override - public void getQuotaForOrigin(String origin, ValueCallback callback) { - mQuotaManagerBridge.getQuotaForOrigin(origin, callback); - } - - @Override - public void setQuotaForOrigin(String origin, long quota) { - // Intentional no-op for deprecated method. - } - - @Override - public void deleteOrigin(String origin) { - mQuotaManagerBridge.deleteOrigin(origin); - } - - @Override - public void deleteAllData() { - mQuotaManagerBridge.deleteAllData(); - } -} diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java deleted file mode 100644 index ca82bb7..0000000 --- a/chromium/java/com/android/webview/chromium/WebViewChromium.java +++ /dev/null @@ -1,2248 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.content.Context; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Picture; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.net.http.SslCertificate; -import android.os.Build; -import android.os.Bundle; -import android.os.Looper; -import android.os.Handler; -import android.os.Message; -import android.print.PrintDocumentAdapter; -import android.text.TextUtils; -import android.util.Base64; -import android.util.Log; -import android.view.KeyEvent; -import android.view.MotionEvent; -import android.view.View; -import android.view.View.MeasureSpec; -import android.view.ViewGroup; -import android.view.accessibility.AccessibilityEvent; -import android.view.accessibility.AccessibilityNodeInfo; -import android.view.accessibility.AccessibilityNodeProvider; -import android.view.inputmethod.EditorInfo; -import android.view.inputmethod.InputConnection; -import android.webkit.DownloadListener; -import android.webkit.FindActionModeCallback; -import android.webkit.JavascriptInterface; -import android.webkit.ValueCallback; -import android.webkit.WebBackForwardList; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.webkit.WebViewFactory; -import android.webkit.WebViewProvider; -import android.webkit.WebChromeClient.CustomViewCallback; -import android.widget.TextView; - -import org.chromium.android_webview.AwBrowserContext; -import org.chromium.android_webview.AwContents; -import org.chromium.android_webview.AwContentsStatics; -import org.chromium.android_webview.AwLayoutSizer; -import org.chromium.android_webview.AwSettings; -import org.chromium.android_webview.AwPrintDocumentAdapter; -import org.chromium.base.ThreadUtils; -import org.chromium.content.browser.SmartClipProvider; -import org.chromium.content_public.browser.LoadUrlParams; -import org.chromium.net.NetworkChangeNotifier; - -import java.io.BufferedWriter; -import java.io.File; -import java.lang.annotation.Annotation; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; -import java.util.HashMap; -import java.util.Map; -import java.util.Queue; - -/** - * This class is the delegate to which WebViewProxy forwards all API calls. - * - * Most of the actual functionality is implemented by AwContents (or ContentViewCore within - * it). This class also contains WebView-specific APIs that require the creation of other - * adapters (otherwise org.chromium.content would depend on the webview.chromium package) - * and a small set of no-op deprecated APIs. - */ -class WebViewChromium implements WebViewProvider, - WebViewProvider.ScrollDelegate, WebViewProvider.ViewDelegate, SmartClipProvider { - - private class WebViewChromiumRunQueue { - public WebViewChromiumRunQueue() { - mQueue = new ConcurrentLinkedQueue(); - } - - public void addTask(Runnable task) { - mQueue.add(task); - if (mFactory.hasStarted()) { - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - drainQueue(); - } - }); - } - } - - public void drainQueue() { - if (mQueue == null || mQueue.isEmpty()) { - return; - } - - Runnable task = mQueue.poll(); - while(task != null) { - task.run(); - task = mQueue.poll(); - } - } - - private Queue mQueue; - } - - private WebViewChromiumRunQueue mRunQueue; - - private static final String TAG = WebViewChromium.class.getSimpleName(); - - // The WebView that this WebViewChromium is the provider for. - WebView mWebView; - // Lets us access protected View-derived methods on the WebView instance we're backing. - WebView.PrivateAccess mWebViewPrivate; - // The client adapter class. - private WebViewContentsClientAdapter mContentsClientAdapter; - // The wrapped Context. - private Context mContext; - - // Variables for functionality provided by this adapter --------------------------------------- - private ContentSettingsAdapter mWebSettings; - // The WebView wrapper for ContentViewCore and required browser compontents. - private AwContents mAwContents; - // Non-null if this webview is using the GL accelerated draw path. - private DrawGLFunctor mGLfunctor; - - private final WebView.HitTestResult mHitTestResult; - - private final int mAppTargetSdkVersion; - - private WebViewChromiumFactoryProvider mFactory; - - private static boolean sRecordWholeDocumentEnabledByApi = false; - static void enableSlowWholeDocumentDraw() { - sRecordWholeDocumentEnabledByApi = true; - } - - // This does not touch any global / non-threadsafe state, but note that - // init is ofter called right after and is NOT threadsafe. - public WebViewChromium(WebViewChromiumFactoryProvider factory, WebView webView, - WebView.PrivateAccess webViewPrivate) { - mWebView = webView; - mWebViewPrivate = webViewPrivate; - mHitTestResult = new WebView.HitTestResult(); - mContext = ResourcesContextWrapperFactory.get(mWebView.getContext()); - mAppTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; - mFactory = factory; - mRunQueue = new WebViewChromiumRunQueue(); - factory.getWebViewDelegate().addWebViewAssetPath(mWebView.getContext()); - } - - static void completeWindowCreation(WebView parent, WebView child) { - AwContents parentContents = ((WebViewChromium) parent.getWebViewProvider()).mAwContents; - AwContents childContents = - child == null ? null : ((WebViewChromium) child.getWebViewProvider()).mAwContents; - parentContents.supplyContentsForPopup(childContents); - } - - private T runBlockingFuture(FutureTask task) { - if (!mFactory.hasStarted()) throw new RuntimeException("Must be started before we block!"); - if (ThreadUtils.runningOnUiThread()) { - throw new IllegalStateException("This method should only be called off the UI thread"); - } - mRunQueue.addTask(task); - try { - return task.get(4, TimeUnit.SECONDS); - } catch (java.util.concurrent.TimeoutException e) { - throw new RuntimeException("Probable deadlock detected due to WebView API being called " - + "on incorrect thread while the UI thread is blocked.", e); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - // We have a 4 second timeout to try to detect deadlocks to detect and aid in debuggin - // deadlocks. - // Do not call this method while on the UI thread! - private void runVoidTaskOnUiThreadBlocking(Runnable r) { - FutureTask task = new FutureTask(r, null); - runBlockingFuture(task); - } - - private T runOnUiThreadBlocking(Callable c) { - return runBlockingFuture(new FutureTask(c)); - } - - // WebViewProvider methods -------------------------------------------------------------------- - - @Override - // BUG=6790250 |javaScriptInterfaces| was only ever used by the obsolete DumpRenderTree - // so is ignored. TODO: remove it from WebViewProvider. - public void init(final Map javaScriptInterfaces, - final boolean privateBrowsing) { - if (privateBrowsing) { - mFactory.startYourEngines(true); - final String msg = "Private browsing is not supported in WebView."; - if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { - throw new IllegalArgumentException(msg); - } else { - Log.w(TAG, msg); - TextView warningLabel = new TextView(mContext); - warningLabel.setText(mContext.getString( - R.string.webviewchromium_private_browsing_warning)); - mWebView.addView(warningLabel); - } - } - - // We will defer real initialization until we know which thread to do it on, unless: - // - we are on the main thread already (common case), - // - the app is targeting >= JB MR2, in which case checkThread enforces that all usage - // comes from a single thread. (Note in JB MR2 this exception was in WebView.java). - if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - mFactory.startYourEngines(false); - checkThread(); - } else if (!mFactory.hasStarted()) { - if (Looper.myLooper() == Looper.getMainLooper()) { - mFactory.startYourEngines(true); - } - } - - final boolean isAccessFromFileURLsGrantedByDefault = - mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN; - final boolean areLegacyQuirksEnabled = - mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT; - - mContentsClientAdapter = new WebViewContentsClientAdapter( - mWebView, mContext, mFactory.getWebViewDelegate()); - mWebSettings = new ContentSettingsAdapter(new AwSettings( - mContext, isAccessFromFileURLsGrantedByDefault, - areLegacyQuirksEnabled)); - - if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { - // Prior to Lollipop we always allowed third party cookies and mixed content. - mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - mWebSettings.setAcceptThirdPartyCookies(true); - mWebSettings.getAwSettings().setZeroLayoutHeightDisablesViewportQuirk(true); - } - - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - initForReal(); - if (privateBrowsing) { - // Intentionally irreversibly disable the webview instance, so that private - // user data cannot leak through misuse of a non-privateBrowing WebView - // instance. Can't just null out mAwContents as we never null-check it - // before use. - destroy(); - } - } - }); - } - - private void initForReal() { - mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, mContext, - new InternalAccessAdapter(), new WebViewNativeGLDelegate(), - mContentsClientAdapter, mWebSettings.getAwSettings()); - - if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { - // On KK and above, favicons are automatically downloaded as the method - // old apps use to enable that behavior is deprecated. - AwContents.setShouldDownloadFavicons(); - } - - AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi || - mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP); - - if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { - // Prior to Lollipop, JavaScript objects injected via addJavascriptInterface - // were not inspectable. - mAwContents.disableJavascriptInterfacesInspection(); - } - - // TODO: This assumes AwContents ignores second Paint param. - mAwContents.setLayerType(mWebView.getLayerType(), null); - } - - void startYourEngine() { - mRunQueue.drainQueue(); - } - - private RuntimeException createThreadException() { - return new IllegalStateException( - "Calling View methods on another thread than the UI thread."); - } - - private boolean checkNeedsPost() { - boolean needsPost = !mFactory.hasStarted() || !ThreadUtils.runningOnUiThread(); - if (!needsPost && mAwContents == null) { - throw new IllegalStateException( - "AwContents must be created if we are not posting!"); - } - return needsPost; - } - - // Intentionally not static, as no need to check thread on static methods - private void checkThread() { - if (!ThreadUtils.runningOnUiThread()) { - final RuntimeException threadViolation = createThreadException(); - ThreadUtils.postOnUiThread(new Runnable() { - @Override - public void run() { - throw threadViolation; - } - }); - throw createThreadException(); - } - } - - @Override - public void setHorizontalScrollbarOverlay(final boolean overlay) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setHorizontalScrollbarOverlay(overlay); - } - }); - return; - } - mAwContents.setHorizontalScrollbarOverlay(overlay); - } - - @Override - public void setVerticalScrollbarOverlay(final boolean overlay) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setVerticalScrollbarOverlay(overlay); - } - }); - return; - } - mAwContents.setVerticalScrollbarOverlay(overlay); - } - - @Override - public boolean overlayHorizontalScrollbar() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return overlayHorizontalScrollbar(); - } - }); - return ret; - } - return mAwContents.overlayHorizontalScrollbar(); - } - - @Override - public boolean overlayVerticalScrollbar() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return overlayVerticalScrollbar(); - } - }); - return ret; - } - return mAwContents.overlayVerticalScrollbar(); - } - - @Override - public int getVisibleTitleHeight() { - // This is deprecated in WebView and should always return 0. - return 0; - } - - @Override - public SslCertificate getCertificate() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - SslCertificate ret = runOnUiThreadBlocking(new Callable() { - @Override - public SslCertificate call() { - return getCertificate(); - } - }); - return ret; - } - return mAwContents.getCertificate(); - } - - @Override - public void setCertificate(SslCertificate certificate) { - // intentional no-op - } - - @Override - public void savePassword(String host, String username, String password) { - // This is a deprecated API: intentional no-op. - } - - @Override - public void setHttpAuthUsernamePassword(final String host, final String realm, - final String username, final String password) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setHttpAuthUsernamePassword(host, realm, username, password); - } - }); - return; - } - mAwContents.setHttpAuthUsernamePassword(host, realm, username, password); - } - - @Override - public String[] getHttpAuthUsernamePassword(final String host, final String realm) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - String[] ret = runOnUiThreadBlocking(new Callable() { - @Override - public String[] call() { - return getHttpAuthUsernamePassword(host, realm); - } - }); - return ret; - } - return mAwContents.getHttpAuthUsernamePassword(host, realm); - } - - @Override - public void destroy() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - destroy(); - } - }); - return; - } - - mAwContents.destroy(); - if (mGLfunctor != null) { - mGLfunctor.destroy(); - mGLfunctor = null; - } - } - - @Override - public void setNetworkAvailable(final boolean networkUp) { - // Note that this purely toggles the JS navigator.online property. - // It does not in affect chromium or network stack state in any way. - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setNetworkAvailable(networkUp); - } - }); - return; - } - mAwContents.setNetworkAvailable(networkUp); - } - - @Override - public WebBackForwardList saveState(final Bundle outState) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - WebBackForwardList ret = runOnUiThreadBlocking(new Callable() { - @Override - public WebBackForwardList call() { - return saveState(outState); - } - }); - return ret; - } - if (outState == null) return null; - if (!mAwContents.saveState(outState)) return null; - return copyBackForwardList(); - } - - @Override - public boolean savePicture(Bundle b, File dest) { - // Intentional no-op: hidden method on WebView. - return false; - } - - @Override - public boolean restorePicture(Bundle b, File src) { - // Intentional no-op: hidden method on WebView. - return false; - } - - @Override - public WebBackForwardList restoreState(final Bundle inState) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - WebBackForwardList ret = runOnUiThreadBlocking(new Callable() { - @Override - public WebBackForwardList call() { - return restoreState(inState); - } - }); - return ret; - } - if (inState == null) return null; - if (!mAwContents.restoreState(inState)) return null; - return copyBackForwardList(); - } - - @Override - public void loadUrl(final String url, Map additionalHttpHeaders) { - // TODO: We may actually want to do some sanity checks here (like filter about://chrome). - - // For backwards compatibility, apps targeting less than K will have JS URLs evaluated - // directly and any result of the evaluation will not replace the current page content. - // Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will - // have the result of that URL replace the content of the current page. - final String JAVASCRIPT_SCHEME = "javascript:"; - if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT && - url != null && url.startsWith(JAVASCRIPT_SCHEME)) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - mAwContents.evaluateJavaScriptEvenIfNotYetNavigated( - url.substring(JAVASCRIPT_SCHEME.length())); - } - }); - } else { - mAwContents.evaluateJavaScriptEvenIfNotYetNavigated( - url.substring(JAVASCRIPT_SCHEME.length())); - } - return; - } - - LoadUrlParams params = new LoadUrlParams(url); - if (additionalHttpHeaders != null) params.setExtraHeaders(additionalHttpHeaders); - loadUrlOnUiThread(params); - } - - @Override - public void loadUrl(String url) { - // Early out to match old WebView implementation - if (url == null) { - return; - } - loadUrl(url, null); - } - - @Override - public void postUrl(String url, byte[] postData) { - LoadUrlParams params = LoadUrlParams.createLoadHttpPostParams(url, postData); - Map headers = new HashMap(); - headers.put("Content-Type", "application/x-www-form-urlencoded"); - params.setExtraHeaders(headers); - loadUrlOnUiThread(params); - } - - private static String fixupMimeType(String mimeType) { - return TextUtils.isEmpty(mimeType) ? "text/html" : mimeType; - } - - private static String fixupData(String data) { - return TextUtils.isEmpty(data) ? "" : data; - } - - private static String fixupBase(String url) { - return TextUtils.isEmpty(url) ? "about:blank" : url; - } - - private static String fixupHistory(String url) { - return TextUtils.isEmpty(url) ? "about:blank" : url; - } - - private static boolean isBase64Encoded(String encoding) { - return "base64".equals(encoding); - } - - @Override - public void loadData(String data, String mimeType, String encoding) { - loadUrlOnUiThread(LoadUrlParams.createLoadDataParams( - fixupData(data), fixupMimeType(mimeType), isBase64Encoded(encoding))); - } - - @Override - public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, - String historyUrl) { - data = fixupData(data); - mimeType = fixupMimeType(mimeType); - LoadUrlParams loadUrlParams; - baseUrl = fixupBase(baseUrl); - historyUrl = fixupHistory(historyUrl); - - if (baseUrl.startsWith("data:")) { - // For backwards compatibility with WebViewClassic, we use the value of |encoding| - // as the charset, as long as it's not "base64". - boolean isBase64 = isBase64Encoded(encoding); - loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl( - data, mimeType, isBase64, baseUrl, historyUrl, isBase64 ? null : encoding); - } else { - // When loading data with a non-data: base URL, the classic WebView would effectively - // "dump" that string of data into the WebView without going through regular URL - // loading steps such as decoding URL-encoded entities. We achieve this same behavior by - // base64 encoding the data that is passed here and then loading that as a data: URL. - try { - loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl( - Base64.encodeToString(data.getBytes("utf-8"), Base64.DEFAULT), mimeType, - true, baseUrl, historyUrl, "utf-8"); - } catch (java.io.UnsupportedEncodingException e) { - Log.wtf(TAG, "Unable to load data string " + data, e); - return; - } - } - loadUrlOnUiThread(loadUrlParams); - } - - private void loadUrlOnUiThread(final LoadUrlParams loadUrlParams) { - // This is the last point that we can delay starting the Chromium backend up - // and if the app has not caused us to bind the Chromium UI thread to a background thread - // we now bind Chromium's notion of the UI thread to the app main thread. - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - // Disallowed in WebView API for apps targetting a new SDK - assert mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR2; - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - mAwContents.loadUrl(loadUrlParams); - } - }); - return; - } - mAwContents.loadUrl(loadUrlParams); - } - - public void evaluateJavaScript(String script, ValueCallback resultCallback) { - checkThread(); - mAwContents.evaluateJavaScript(script, resultCallback); - } - - @Override - public void saveWebArchive(String filename) { - saveWebArchive(filename, false, null); - } - - @Override - public void saveWebArchive(final String basename, final boolean autoname, - final ValueCallback callback) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - saveWebArchive(basename, autoname, callback); - } - }); - return; - } - mAwContents.saveWebArchive(basename, autoname, callback); - } - - @Override - public void stopLoading() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - stopLoading(); - } - }); - return; - } - - mAwContents.stopLoading(); - } - - @Override - public void reload() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - reload(); - } - }); - return; - } - mAwContents.reload(); - } - - @Override - public boolean canGoBack() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return canGoBack(); - } - }); - return ret; - } - return mAwContents.canGoBack(); - } - - @Override - public void goBack() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - goBack(); - } - }); - return; - } - mAwContents.goBack(); - } - - @Override - public boolean canGoForward() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return canGoForward(); - } - }); - return ret; - } - return mAwContents.canGoForward(); - } - - @Override - public void goForward() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - goForward(); - } - }); - return; - } - mAwContents.goForward(); - } - - @Override - public boolean canGoBackOrForward(final int steps) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return canGoBackOrForward(steps); - } - }); - return ret; - } - return mAwContents.canGoBackOrForward(steps); - } - - @Override - public void goBackOrForward(final int steps) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - goBackOrForward(steps); - } - }); - return; - } - mAwContents.goBackOrForward(steps); - } - - @Override - public boolean isPrivateBrowsingEnabled() { - // Not supported in this WebView implementation. - return false; - } - - @Override - public boolean pageUp(final boolean top) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return pageUp(top); - } - }); - return ret; - } - return mAwContents.pageUp(top); - } - - @Override - public boolean pageDown(final boolean bottom) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return pageDown(bottom); - } - }); - return ret; - } - return mAwContents.pageDown(bottom); - } - - @Override - public void clearView() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearView(); - } - }); - return; - } - mAwContents.clearView(); - } - - @Override - public Picture capturePicture() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Picture ret = runOnUiThreadBlocking(new Callable() { - @Override - public Picture call() { - return capturePicture(); - } - }); - return ret; - } - return mAwContents.capturePicture(); - } - - @Override - public float getScale() { - // No checkThread() as it is mostly thread safe (workaround for b/10652991). - mFactory.startYourEngines(true); - return mAwContents.getScale(); - } - - @Override - public void setInitialScale(final int scaleInPercent) { - // No checkThread() as it is thread safe - mWebSettings.getAwSettings().setInitialPageScale(scaleInPercent); - } - - @Override - public void invokeZoomPicker() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - invokeZoomPicker(); - } - }); - return; - } - mAwContents.invokeZoomPicker(); - } - - @Override - public WebView.HitTestResult getHitTestResult() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - WebView.HitTestResult ret = runOnUiThreadBlocking( - new Callable() { - @Override - public WebView.HitTestResult call() { - return getHitTestResult(); - } - }); - return ret; - } - AwContents.HitTestData data = mAwContents.getLastHitTestResult(); - mHitTestResult.setType(data.hitTestResultType); - mHitTestResult.setExtra(data.hitTestResultExtraData); - return mHitTestResult; - } - - @Override - public void requestFocusNodeHref(final Message hrefMsg) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - requestFocusNodeHref(hrefMsg); - } - }); - return; - } - mAwContents.requestFocusNodeHref(hrefMsg); - } - - @Override - public void requestImageRef(final Message msg) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - requestImageRef(msg); - } - }); - return; - } - mAwContents.requestImageRef(msg); - } - - @Override - public String getUrl() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - String ret = runOnUiThreadBlocking(new Callable() { - @Override - public String call() { - return getUrl(); - } - }); - return ret; - } - String url = mAwContents.getUrl(); - if (url == null || url.trim().isEmpty()) return null; - return url; - } - - @Override - public String getOriginalUrl() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - String ret = runOnUiThreadBlocking(new Callable() { - @Override - public String call() { - return getOriginalUrl(); - } - }); - return ret; - } - String url = mAwContents.getOriginalUrl(); - if (url == null || url.trim().isEmpty()) return null; - return url; - } - - @Override - public String getTitle() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - String ret = runOnUiThreadBlocking(new Callable() { - @Override - public String call() { - return getTitle(); - } - }); - return ret; - } - return mAwContents.getTitle(); - } - - @Override - public Bitmap getFavicon() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Bitmap ret = runOnUiThreadBlocking(new Callable() { - @Override - public Bitmap call() { - return getFavicon(); - } - }); - return ret; - } - return mAwContents.getFavicon(); - } - - @Override - public String getTouchIconUrl() { - // Intentional no-op: hidden method on WebView. - return null; - } - - @Override - public int getProgress() { - if (mAwContents == null) return 100; - // No checkThread() because the value is cached java side (workaround for b/10533304). - return mAwContents.getMostRecentProgress(); - } - - @Override - public int getContentHeight() { - if (mAwContents == null) return 0; - // No checkThread() as it is mostly thread safe (workaround for b/10594869). - return mAwContents.getContentHeightCss(); - } - - @Override - public int getContentWidth() { - if (mAwContents == null) return 0; - // No checkThread() as it is mostly thread safe (workaround for b/10594869). - return mAwContents.getContentWidthCss(); - } - - @Override - public void pauseTimers() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - pauseTimers(); - } - }); - return; - } - mAwContents.pauseTimers(); - } - - @Override - public void resumeTimers() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - resumeTimers(); - } - }); - return; - } - mAwContents.resumeTimers(); - } - - @Override - public void onPause() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onPause(); - } - }); - return; - } - mAwContents.onPause(); - } - - @Override - public void onResume() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onResume(); - } - }); - return; - } - mAwContents.onResume(); - } - - @Override - public boolean isPaused() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - Boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return isPaused(); - } - }); - return ret; - } - return mAwContents.isPaused(); - } - - @Override - public void freeMemory() { - // Intentional no-op. Memory is managed automatically by Chromium. - } - - @Override - public void clearCache(final boolean includeDiskFiles) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearCache(includeDiskFiles); - } - }); - return; - } - mAwContents.clearCache(includeDiskFiles); - } - - /** - * This is a poorly named method, but we keep it for historical reasons. - */ - @Override - public void clearFormData() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearFormData(); - } - }); - return; - } - mAwContents.hideAutofillPopup(); - } - - @Override - public void clearHistory() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearHistory(); - } - }); - return; - } - mAwContents.clearHistory(); - } - - @Override - public void clearSslPreferences() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearSslPreferences(); - } - }); - return; - } - mAwContents.clearSslPreferences(); - } - - @Override - public WebBackForwardList copyBackForwardList() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - WebBackForwardList ret = runOnUiThreadBlocking(new Callable() { - @Override - public WebBackForwardList call() { - return copyBackForwardList(); - } - }); - return ret; - } - return new WebBackForwardListChromium( - mAwContents.getNavigationHistory()); - } - - @Override - public void setFindListener(WebView.FindListener listener) { - mContentsClientAdapter.setFindListener(listener); - } - - @Override - public void findNext(final boolean forwards) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - findNext(forwards); - } - }); - return; - } - mAwContents.findNext(forwards); - } - - @Override - public int findAll(final String searchString) { - findAllAsync(searchString); - return 0; - } - - @Override - public void findAllAsync(final String searchString) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - findAllAsync(searchString); - } - }); - return; - } - mAwContents.findAllAsync(searchString); - } - - @Override - public boolean showFindDialog(final String text, final boolean showIme) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - return false; - } - if (mWebView.getParent() == null) { - return false; - } - - FindActionModeCallback findAction = new FindActionModeCallback(mContext); - if (findAction == null) { - return false; - } - - mWebView.startActionMode(findAction); - findAction.setWebView(mWebView); - if (showIme) { - findAction.showSoftInput(); - } - - if (text != null) { - findAction.setText(text); - findAction.findAll(); - } - - return true; - } - - @Override - public void notifyFindDialogDismissed() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - notifyFindDialogDismissed(); - } - }); - return; - } - clearMatches(); - } - - @Override - public void clearMatches() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - clearMatches(); - } - }); - return; - } - mAwContents.clearMatches(); - } - - @Override - public void documentHasImages(final Message response) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - documentHasImages(response); - } - }); - return; - } - mAwContents.documentHasImages(response); - } - - @Override - public void setWebViewClient(WebViewClient client) { - mContentsClientAdapter.setWebViewClient(client); - } - - @Override - public void setDownloadListener(DownloadListener listener) { - mContentsClientAdapter.setDownloadListener(listener); - } - - @Override - public void setWebChromeClient(WebChromeClient client) { - mWebSettings.getAwSettings().setFullscreenSupported(doesSupportFullscreen(client)); - mContentsClientAdapter.setWebChromeClient(client); - } - - /** - * Returns true if the supplied {@link WebChromeClient} supports fullscreen. - * - *

For fullscreen support, implementations of {@link WebChromeClient#onShowCustomView} - * and {@link WebChromeClient#onHideCustomView()} are required. - */ - private boolean doesSupportFullscreen(WebChromeClient client) { - if (client == null) { - return false; - } - Class clientClass = client.getClass(); - boolean foundShowMethod = false; - boolean foundHideMethod = false; - while (clientClass != WebChromeClient.class && (!foundShowMethod || !foundHideMethod)) { - if (!foundShowMethod) { - try { - clientClass.getDeclaredMethod("onShowCustomView", View.class, - CustomViewCallback.class); - foundShowMethod = true; - } catch (NoSuchMethodException e) { } - } - - if (!foundHideMethod) { - try { - clientClass.getDeclaredMethod("onHideCustomView"); - foundHideMethod = true; - } catch (NoSuchMethodException e) { } - } - clientClass = clientClass.getSuperclass(); - } - return foundShowMethod && foundHideMethod; - } - - @Override - public void setPictureListener(final WebView.PictureListener listener) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setPictureListener(listener); - } - }); - return; - } - mContentsClientAdapter.setPictureListener(listener); - mAwContents.enableOnNewPicture(listener != null, - mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2); - } - - @Override - public void addJavascriptInterface(final Object obj, final String interfaceName) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - addJavascriptInterface(obj, interfaceName); - } - }); - return; - } - Class requiredAnnotation = null; - if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - requiredAnnotation = JavascriptInterface.class; - } - mAwContents.addPossiblyUnsafeJavascriptInterface(obj, interfaceName, requiredAnnotation); - } - - @Override - public void removeJavascriptInterface(final String interfaceName) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - removeJavascriptInterface(interfaceName); - } - }); - return; - } - mAwContents.removeJavascriptInterface(interfaceName); - } - - @Override - public WebSettings getSettings() { - return mWebSettings; - } - - @Override - public void setMapTrackballToArrowKeys(boolean setMap) { - // This is a deprecated API: intentional no-op. - } - - @Override - public void flingScroll(final int vx, final int vy) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - flingScroll(vx, vy); - } - }); - return; - } - mAwContents.flingScroll(vx, vy); - } - - @Override - public View getZoomControls() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - return null; - } - - // This was deprecated in 2009 and hidden in JB MR1, so just provide the minimum needed - // to stop very out-dated applications from crashing. - Log.w(TAG, "WebView doesn't support getZoomControls"); - return mAwContents.getSettings().supportZoom() ? new View(mContext) : null; - } - - @Override - public boolean canZoomIn() { - if (checkNeedsPost()) { - return false; - } - return mAwContents.canZoomIn(); - } - - @Override - public boolean canZoomOut() { - if (checkNeedsPost()) { - return false; - } - return mAwContents.canZoomOut(); - } - - @Override - public boolean zoomIn() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return zoomIn(); - } - }); - return ret; - } - return mAwContents.zoomIn(); - } - - @Override - public boolean zoomOut() { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return zoomOut(); - } - }); - return ret; - } - return mAwContents.zoomOut(); - } - - @Override - public boolean zoomBy(float factor) { - mFactory.startYourEngines(true); - // This is an L API and therefore we can enforce stricter threading constraints. - checkThread(); - return mAwContents.zoomBy(factor); - } - - @Override - public void dumpViewHierarchyWithProperties(BufferedWriter out, int level) { - // Intentional no-op - } - - @Override - public View findHierarchyView(String className, int hashCode) { - // Intentional no-op - return null; - } - - // WebViewProvider glue methods --------------------------------------------------------------- - - @Override - // This needs to be kept thread safe! - public WebViewProvider.ViewDelegate getViewDelegate() { - return this; - } - - @Override - // This needs to be kept thread safe! - public WebViewProvider.ScrollDelegate getScrollDelegate() { - return this; - } - - - // WebViewProvider.ViewDelegate implementation ------------------------------------------------ - - // TODO: remove from WebViewProvider and use default implementation from - // ViewGroup. - // @Override - public boolean shouldDelayChildPressedState() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return shouldDelayChildPressedState(); - } - }); - return ret; - } - return true; - } - -// @Override - public AccessibilityNodeProvider getAccessibilityNodeProvider() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - AccessibilityNodeProvider ret = runOnUiThreadBlocking( - new Callable() { - @Override - public AccessibilityNodeProvider call() { - return getAccessibilityNodeProvider(); - } - }); - return ret; - } - return mAwContents.getAccessibilityNodeProvider(); - } - - @Override - public void onInitializeAccessibilityNodeInfo(final AccessibilityNodeInfo info) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - runVoidTaskOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - onInitializeAccessibilityNodeInfo(info); - } - }); - return; - } - mAwContents.onInitializeAccessibilityNodeInfo(info); - } - - @Override - public void onInitializeAccessibilityEvent(final AccessibilityEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - runVoidTaskOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - onInitializeAccessibilityEvent(event); - } - }); - return; - } - mAwContents.onInitializeAccessibilityEvent(event); - } - - @Override - public boolean performAccessibilityAction(final int action, final Bundle arguments) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return performAccessibilityAction(action, arguments); - } - }); - return ret; - } - if (mAwContents.supportsAccessibilityAction(action)) { - return mAwContents.performAccessibilityAction(action, arguments); - } - return mWebViewPrivate.super_performAccessibilityAction(action, arguments); - } - - @Override - public void setOverScrollMode(final int mode) { - // This gets called from the android.view.View c'tor that WebView inherits from. This - // causes the method to be called when mAwContents == null. - // It's safe to ignore these calls however since AwContents will read the current value of - // this setting when it's created. - if (mAwContents == null) return; - - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setOverScrollMode(mode); - } - }); - return; - } - mAwContents.setOverScrollMode(mode); - } - - @Override - public void setScrollBarStyle(final int style) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - setScrollBarStyle(style); - } - }); - return; - } - mAwContents.setScrollBarStyle(style); - } - - @Override - public void onDrawVerticalScrollBar(final Canvas canvas, final Drawable scrollBar, final int l, - final int t, final int r, final int b) { - // WebViewClassic was overriding this method to handle rubberband over-scroll. Since - // WebViewChromium doesn't support that the vanilla implementation of this method can be - // used. - mWebViewPrivate.super_onDrawVerticalScrollBar(canvas, scrollBar, l, t, r, b); - } - - @Override - public void onOverScrolled(final int scrollX, final int scrollY, final boolean clampedX, - final boolean clampedY) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onOverScrolled(scrollX, scrollY, clampedX, clampedY); - } - }); - return; - } - mAwContents.onContainerViewOverScrolled(scrollX, scrollY, clampedX, clampedY); - } - - @Override - public void onWindowVisibilityChanged(final int visibility) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onWindowVisibilityChanged(visibility); - } - }); - return; - } - mAwContents.onWindowVisibilityChanged(visibility); - } - - @Override - public void onDraw(final Canvas canvas) { - mFactory.startYourEngines(true); - if (checkNeedsPost()) { - runVoidTaskOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - onDraw(canvas); - } - }); - return; - } - mAwContents.onDraw(canvas); - } - - @Override - public void setLayoutParams(final ViewGroup.LayoutParams layoutParams) { - // This API is our strongest signal from the View system that this - // WebView is going to be bound to a View hierarchy and so at this - // point we must bind Chromium's UI thread to the current thread. - mFactory.startYourEngines(false); - checkThread(); - mWebViewPrivate.super_setLayoutParams(layoutParams); - } - - @Override - public boolean performLongClick() { - // Return false unless the WebView is attached to a View with a parent - return mWebView.getParent() != null ? mWebViewPrivate.super_performLongClick() : false; - } - - @Override - public void onConfigurationChanged(final Configuration newConfig) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onConfigurationChanged(newConfig); - } - }); - return; - } - mAwContents.onConfigurationChanged(newConfig); - } - - @Override - public InputConnection onCreateInputConnection(final EditorInfo outAttrs) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - return null; - } - return mAwContents.onCreateInputConnection(outAttrs); - } - - @Override - public boolean onKeyMultiple(final int keyCode, final int repeatCount, final KeyEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onKeyMultiple(keyCode, repeatCount, event); - } - }); - return ret; - } - UnimplementedWebViewApi.invoke(); - return false; - } - - @Override - public boolean onKeyDown(final int keyCode, final KeyEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onKeyDown(keyCode, event); - } - }); - return ret; - } - UnimplementedWebViewApi.invoke(); - return false; - } - - @Override - public boolean onKeyUp(final int keyCode, final KeyEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onKeyUp(keyCode, event); - } - }); - return ret; - } - return mAwContents.onKeyUp(keyCode, event); - } - - @Override - public void onAttachedToWindow() { - // This API is our strongest signal from the View system that this - // WebView is going to be bound to a View hierarchy and so at this - // point we must bind Chromium's UI thread to the current thread. - mFactory.startYourEngines(false); - checkThread(); - mAwContents.onAttachedToWindow(); - } - - @Override - public void onDetachedFromWindow() { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onDetachedFromWindow(); - } - }); - return; - } - - mAwContents.onDetachedFromWindow(); - } - - @Override - public void onVisibilityChanged(final View changedView, final int visibility) { - // The AwContents will find out the container view visibility before the first draw so we - // can safely ignore onVisibilityChanged callbacks that happen before init(). - if (mAwContents == null) return; - - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onVisibilityChanged(changedView, visibility); - } - }); - return; - } - mAwContents.onVisibilityChanged(changedView, visibility); - } - - @Override - public void onWindowFocusChanged(final boolean hasWindowFocus) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onWindowFocusChanged(hasWindowFocus); - } - }); - return; - } - mAwContents.onWindowFocusChanged(hasWindowFocus); - } - - @Override - public void onFocusChanged(final boolean focused, final int direction, - final Rect previouslyFocusedRect) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onFocusChanged(focused, direction, previouslyFocusedRect); - } - }); - return; - } - mAwContents.onFocusChanged(focused, direction, previouslyFocusedRect); - } - - @Override - public boolean setFrame(final int left, final int top, final int right, final int bottom) { - return mWebViewPrivate.super_setFrame(left, top, right, bottom); - } - - @Override - public void onSizeChanged(final int w, final int h, final int ow, final int oh) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onSizeChanged(w, h, ow, oh); - } - }); - return; - } - mAwContents.onSizeChanged(w, h, ow, oh); - } - - @Override - public void onScrollChanged(final int l, final int t, final int oldl, final int oldt) { - if (checkNeedsPost()) { - mRunQueue.addTask(new Runnable() { - @Override - public void run() { - onScrollChanged(l, t, oldl, oldt); - } - }); - return; - } - mAwContents.onContainerViewScrollChanged(l, t, oldl, oldt); - } - - @Override - public boolean dispatchKeyEvent(final KeyEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return dispatchKeyEvent(event); - } - }); - return ret; - } - return mAwContents.dispatchKeyEvent(event); - } - - @Override - public boolean onTouchEvent(final MotionEvent ev) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onTouchEvent(ev); - } - }); - return ret; - } - return mAwContents.onTouchEvent(ev); - } - - @Override - public boolean onHoverEvent(final MotionEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onHoverEvent(event); - } - }); - return ret; - } - return mAwContents.onHoverEvent(event); - } - - @Override - public boolean onGenericMotionEvent(final MotionEvent event) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return onGenericMotionEvent(event); - } - }); - return ret; - } - return mAwContents.onGenericMotionEvent(event); - } - - @Override - public boolean onTrackballEvent(MotionEvent ev) { - // Trackball event not handled, which eventually gets converted to DPAD keyevents - return false; - } - - @Override - public boolean requestFocus(final int direction, final Rect previouslyFocusedRect) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return requestFocus(direction, previouslyFocusedRect); - } - }); - return ret; - } - mAwContents.requestFocus(); - return mWebViewPrivate.super_requestFocus(direction, previouslyFocusedRect); - } - - @Override - public void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - runVoidTaskOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - onMeasure(widthMeasureSpec, heightMeasureSpec); - } - }); - return; - } - mAwContents.onMeasure(widthMeasureSpec, heightMeasureSpec); - } - - @Override - public boolean requestChildRectangleOnScreen(final View child, final Rect rect, - final boolean immediate) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - boolean ret = runOnUiThreadBlocking(new Callable() { - @Override - public Boolean call() { - return requestChildRectangleOnScreen(child, rect, immediate); - } - }); - return ret; - } - return mAwContents.requestChildRectangleOnScreen(child, rect, immediate); - } - - @Override - public void setBackgroundColor(final int color) { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - ThreadUtils.postOnUiThread(new Runnable() { - @Override - public void run() { - setBackgroundColor(color); - } - }); - return; - } - mAwContents.setBackgroundColor(color); - } - - @Override - public void setLayerType(final int layerType, final Paint paint) { - // This can be called from WebView constructor in which case mAwContents - // is still null. We set the layer type in initForReal in that case. - if (mAwContents == null) return; - if (checkNeedsPost()) { - ThreadUtils.postOnUiThread(new Runnable() { - @Override - public void run() { - setLayerType(layerType, paint); - } - }); - return; - } - mAwContents.setLayerType(layerType, paint); - } - - // Remove from superclass - public void preDispatchDraw(Canvas canvas) { - // TODO(leandrogracia): remove this method from WebViewProvider if we think - // we won't need it again. - } - - public void onStartTemporaryDetach() { - mAwContents.onStartTemporaryDetach(); - } - - public void onFinishTemporaryDetach() { - mAwContents.onFinishTemporaryDetach(); - } - - // WebViewProvider.ScrollDelegate implementation ---------------------------------------------- - - @Override - public int computeHorizontalScrollRange() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - int ret = runOnUiThreadBlocking(new Callable() { - @Override - public Integer call() { - return computeHorizontalScrollRange(); - } - }); - return ret; - } - return mAwContents.computeHorizontalScrollRange(); - } - - @Override - public int computeHorizontalScrollOffset() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - int ret = runOnUiThreadBlocking(new Callable() { - @Override - public Integer call() { - return computeHorizontalScrollOffset(); - } - }); - return ret; - } - return mAwContents.computeHorizontalScrollOffset(); - } - - @Override - public int computeVerticalScrollRange() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - int ret = runOnUiThreadBlocking(new Callable() { - @Override - public Integer call() { - return computeVerticalScrollRange(); - } - }); - return ret; - } - return mAwContents.computeVerticalScrollRange(); - } - - @Override - public int computeVerticalScrollOffset() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - int ret = runOnUiThreadBlocking(new Callable() { - @Override - public Integer call() { - return computeVerticalScrollOffset(); - } - }); - return ret; - } - return mAwContents.computeVerticalScrollOffset(); - } - - @Override - public int computeVerticalScrollExtent() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - int ret = runOnUiThreadBlocking(new Callable() { - @Override - public Integer call() { - return computeVerticalScrollExtent(); - } - }); - return ret; - } - return mAwContents.computeVerticalScrollExtent(); - } - - @Override - public void computeScroll() { - mFactory.startYourEngines(false); - if (checkNeedsPost()) { - runVoidTaskOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - computeScroll(); - } - }); - return; - } - mAwContents.computeScroll(); - } - - // TODO(sgurun) this is only to have master-gpl compiling. - public PrintDocumentAdapter createPrintDocumentAdapter() { - return createPrintDocumentAdapter("default"); - } - - //@Override TODO(sgurun) commenting this out to have master-gpl compiling. - public PrintDocumentAdapter createPrintDocumentAdapter(String documentName) { - checkThread(); - return new AwPrintDocumentAdapter(mAwContents.getPdfExporter(), documentName); - } - - // AwContents.NativeGLDelegate implementation -------------------------------------- - private class WebViewNativeGLDelegate implements AwContents.NativeGLDelegate { - @Override - public boolean requestDrawGL(Canvas canvas, boolean waitForCompletion, - View containerView) { - if (mGLfunctor == null) { - mGLfunctor = new DrawGLFunctor(mAwContents.getAwDrawGLViewContext(), - mFactory.getWebViewDelegate()); - } - return mGLfunctor.requestDrawGL(canvas, containerView, waitForCompletion); - } - - @Override - public void detachGLFunctor() { - if (mGLfunctor != null) { - mGLfunctor.detach(); - } - } - } - - // AwContents.InternalAccessDelegate implementation -------------------------------------- - private class InternalAccessAdapter implements AwContents.InternalAccessDelegate { - @Override - public boolean drawChild(Canvas arg0, View arg1, long arg2) { - UnimplementedWebViewApi.invoke(); - return false; - } - - @Override - public boolean super_onKeyUp(int arg0, KeyEvent arg1) { - // Intentional no-op - return false; - } - - @Override - public boolean super_dispatchKeyEventPreIme(KeyEvent arg0) { - UnimplementedWebViewApi.invoke(); - return false; - } - - @Override - public boolean super_dispatchKeyEvent(KeyEvent event) { - return mWebViewPrivate.super_dispatchKeyEvent(event); - } - - @Override - public boolean super_onGenericMotionEvent(MotionEvent arg0) { - return mWebViewPrivate.super_onGenericMotionEvent(arg0); - } - - @Override - public void super_onConfigurationChanged(Configuration arg0) { - // Intentional no-op - } - - @Override - public int super_getScrollBarStyle() { - return mWebViewPrivate.super_getScrollBarStyle(); - } - - @Override - public boolean awakenScrollBars() { - mWebViewPrivate.awakenScrollBars(0); - // TODO: modify the WebView.PrivateAccess to provide a return value. - return true; - } - - @Override - public boolean super_awakenScrollBars(int arg0, boolean arg1) { - // TODO: need method on WebView.PrivateAccess? - UnimplementedWebViewApi.invoke(); - return false; - } - - @Override - public void onScrollChanged(int l, int t, int oldl, int oldt) { - // Intentional no-op. - // Chromium calls this directly to trigger accessibility events. That isn't needed - // for WebView since super_scrollTo invokes onScrollChanged for us. - } - - @Override - public void overScrollBy(int deltaX, int deltaY, - int scrollX, int scrollY, - int scrollRangeX, int scrollRangeY, - int maxOverScrollX, int maxOverScrollY, - boolean isTouchEvent) { - mWebViewPrivate.overScrollBy(deltaX, deltaY, scrollX, scrollY, - scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - } - - @Override - public void super_scrollTo(int scrollX, int scrollY) { - mWebViewPrivate.super_scrollTo(scrollX, scrollY); - } - - @Override - public void setMeasuredDimension(int measuredWidth, int measuredHeight) { - mWebViewPrivate.setMeasuredDimension(measuredWidth, measuredHeight); - } - - // @Override - public boolean super_onHoverEvent(MotionEvent event) { - return mWebViewPrivate.super_onHoverEvent(event); - } - } - - // Implements SmartClipProvider - @Override - public void extractSmartClipData(int x, int y, int width, int height) { - checkThread(); - mAwContents.extractSmartClipData(x, y, width, height); - } - - // Implements SmartClipProvider - @Override - public void setSmartClipResultHandler(final Handler resultHandler) { - checkThread(); - mAwContents.setSmartClipResultHandler(resultHandler); - } - -} diff --git a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java deleted file mode 100644 index 5111105..0000000 --- a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.res.Resources; -import android.app.ActivityManager; -import android.content.ComponentCallbacks2; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.net.Uri; -import android.os.Build; -import android.os.Looper; -import android.os.StrictMode; -import android.util.Log; -import android.webkit.CookieManager; -import android.webkit.GeolocationPermissions; -import android.webkit.WebIconDatabase; -import android.webkit.WebStorage; -import android.webkit.WebView; -import android.webkit.WebViewDatabase; -import android.webkit.WebViewFactory; -import android.webkit.WebViewFactoryProvider; -import android.webkit.WebViewProvider; - -import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; - -import org.chromium.android_webview.AwBrowserContext; -import org.chromium.android_webview.AwBrowserProcess; -import org.chromium.android_webview.AwContents; -import org.chromium.android_webview.AwContentsStatics; -import org.chromium.android_webview.AwCookieManager; -import org.chromium.android_webview.AwDevToolsServer; -import org.chromium.android_webview.AwFormDatabase; -import org.chromium.android_webview.AwGeolocationPermissions; -import org.chromium.android_webview.AwQuotaManagerBridge; -import org.chromium.android_webview.AwResource; -import org.chromium.android_webview.AwSettings; -import org.chromium.base.CommandLine; -import org.chromium.base.MemoryPressureListener; -import org.chromium.base.PathService; -import org.chromium.base.PathUtils; -import org.chromium.base.ResourceExtractor; -import org.chromium.base.ThreadUtils; -import org.chromium.base.TraceEvent; -import org.chromium.base.library_loader.LibraryLoader; -import org.chromium.base.library_loader.ProcessInitException; -import org.chromium.content.app.ContentMain; -import org.chromium.content.browser.ContentViewStatics; - -import java.io.File; -import java.lang.ref.WeakReference; -import java.util.ArrayList; - -public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { - - private static final String TAG = "WebViewChromiumFactoryProvider"; - - private static final String CHROMIUM_PREFS_NAME = "WebViewChromiumPrefs"; - private static final String VERSION_CODE_PREF = "lastVersionCodeUsed"; - private static final String COMMAND_LINE_FILE = "/data/local/tmp/webview-command-line"; - - // Guards accees to the other members, and is notifyAll() signalled on the UI thread - // when the chromium process has been started. - private final Object mLock = new Object(); - - // Initialization guarded by mLock. - private AwBrowserContext mBrowserContext; - private Statics mStaticMethods; - private GeolocationPermissionsAdapter mGeolocationPermissions; - private CookieManagerAdapter mCookieManager; - private WebIconDatabaseAdapter mWebIconDatabase; - private WebStorageAdapter mWebStorage; - private WebViewDatabaseAdapter mWebViewDatabase; - private AwDevToolsServer mDevToolsServer; - - private ArrayList> mWebViewsToStart = - new ArrayList>(); - - // Read/write protected by mLock. - private boolean mStarted; - - private SharedPreferences mWebViewPrefs; - private WebViewDelegate mWebViewDelegate; - - /** - * Constructor called by the API 21 version of {@link WebViewFactory} and earlier. - */ - public WebViewChromiumFactoryProvider() { - initialize(WebViewDelegateFactory.createApi21CompatibilityDelegate()); - } - - /** - * Constructor called by the API 22 version of {@link WebViewFactory} and later. - */ - public WebViewChromiumFactoryProvider(android.webkit.WebViewDelegate delegate) { - initialize(WebViewDelegateFactory.createProxyDelegate(delegate)); - } - - private void initialize(WebViewDelegate webViewDelegate) { - mWebViewDelegate = webViewDelegate; - if (isBuildDebuggable()) { - // Suppress the StrictMode violation as this codepath is only hit on debugglable builds. - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); - CommandLine.initFromFile(COMMAND_LINE_FILE); - StrictMode.setThreadPolicy(oldPolicy); - } else { - CommandLine.init(null); - } - - CommandLine cl = CommandLine.getInstance(); - // TODO: currently in a relase build the DCHECKs only log. We either need to insall - // a report handler with SetLogReportHandler to make them assert, or else compile - // them out of the build altogether (b/8284203). Either way, so long they're - // compiled in, we may as unconditionally enable them here. - cl.appendSwitch("enable-dcheck"); - - ThreadUtils.setWillOverrideUiThread(); - // Load chromium library. - AwBrowserProcess.loadLibrary(); - - final PackageInfo packageInfo = WebViewFactory.getLoadedPackageInfo(); - - // Register the handler that will append the WebView version to logcat in case of a crash. - AwContentsStatics.registerCrashHandler( - "Version " + packageInfo.versionName + " (code " + packageInfo.versionCode + ")"); - - // Load glue-layer support library. - System.loadLibrary("webviewchromium_plat_support"); - - // Use shared preference to check for package downgrade. - mWebViewPrefs = mWebViewDelegate.getApplication().getSharedPreferences( - CHROMIUM_PREFS_NAME, Context.MODE_PRIVATE); - int lastVersion = mWebViewPrefs.getInt(VERSION_CODE_PREF, 0); - int currentVersion = packageInfo.versionCode; - if (lastVersion > currentVersion) { - // The WebView package has been downgraded since we last ran in this application. - // Delete the WebView data directory's contents. - String dataDir = PathUtils.getDataDirectory(mWebViewDelegate.getApplication()); - Log.i(TAG, "WebView package downgraded from " + lastVersion + " to " + currentVersion + - "; deleting contents of " + dataDir); - deleteContents(new File(dataDir)); - } - if (lastVersion != currentVersion) { - mWebViewPrefs.edit().putInt(VERSION_CODE_PREF, currentVersion).apply(); - } - // Now safe to use WebView data directory. - } - - private static boolean isBuildDebuggable() { - return !Build.TYPE.equals("user"); - } - - private static void deleteContents(File dir) { - File[] files = dir.listFiles(); - if (files != null) { - for (File file : files) { - if (file.isDirectory()) { - deleteContents(file); - } - if (!file.delete()) { - Log.w(TAG, "Failed to delete " + file); - } - } - } - } - - private void initPlatSupportLibrary() { - DrawGLFunctor.setChromiumAwDrawGLFunction(AwContents.getAwDrawGLFunction()); - AwContents.setAwDrawSWFunctionTable(GraphicsUtils.getDrawSWFunctionTable()); - AwContents.setAwDrawGLFunctionTable(GraphicsUtils.getDrawGLFunctionTable()); - } - - private void ensureChromiumStartedLocked(boolean onMainThread) { - assert Thread.holdsLock(mLock); - - if (mStarted) { // Early-out for the common case. - return; - } - - Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper(); - Log.v(TAG, "Binding Chromium to " + - (Looper.getMainLooper().equals(looper) ? "main":"background") + - " looper " + looper); - ThreadUtils.setUiThread(looper); - - if (ThreadUtils.runningOnUiThread()) { - startChromiumLocked(); - return; - } - - // We must post to the UI thread to cover the case that the user has invoked Chromium - // startup by using the (thread-safe) CookieManager rather than creating a WebView. - ThreadUtils.postOnUiThread(new Runnable() { - @Override - public void run() { - synchronized (mLock) { - startChromiumLocked(); - } - } - }); - while (!mStarted) { - try { - // Important: wait() releases |mLock| the UI thread can take it :-) - mLock.wait(); - } catch (InterruptedException e) { - // Keep trying... eventually the UI thread will process the task we sent it. - } - } - } - - private void startChromiumLocked() { - assert Thread.holdsLock(mLock) && ThreadUtils.runningOnUiThread(); - - // The post-condition of this method is everything is ready, so notify now to cover all - // return paths. (Other threads will not wake-up until we release |mLock|, whatever). - mLock.notifyAll(); - - if (mStarted) { - return; - } - - // We don't need to extract any paks because for WebView, they are - // in the system image. - ResourceExtractor.setMandatoryPaksToExtract(""); - - try { - LibraryLoader.ensureInitialized(); - } catch(ProcessInitException e) { - throw new RuntimeException("Error initializing WebView library", e); - } - - PathService.override(PathService.DIR_MODULE, "/system/lib/"); - // TODO: DIR_RESOURCE_PAKS_ANDROID needs to live somewhere sensible, - // inlined here for simplicity setting up the HTMLViewer demo. Unfortunately - // it can't go into base.PathService, as the native constant it refers to - // lives in the ui/ layer. See ui/base/ui_base_paths.h - final int DIR_RESOURCE_PAKS_ANDROID = 3003; - PathService.override(DIR_RESOURCE_PAKS_ANDROID, - "/system/framework/webview/paks"); - - // Make sure that ResourceProvider is initialized before starting the browser process. - Context context = getWrappedCurrentApplicationContext(); - setUpResources(context); - initPlatSupportLibrary(); - AwBrowserProcess.start(context); - - if (isBuildDebuggable()) { - setWebContentsDebuggingEnabled(true); - } - - TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); - mWebViewDelegate.setOnTraceEnabledChangeListener( - new WebViewDelegate.OnTraceEnabledChangeListener() { - @Override - public void onTraceEnabledChange(boolean enabled) { - TraceEvent.setATraceEnabled(enabled); - } - }); - mStarted = true; - - for (WeakReference wvc : mWebViewsToStart) { - WebViewChromium w = wvc.get(); - if (w != null) { - w.startYourEngine(); - } - } - mWebViewsToStart.clear(); - mWebViewsToStart = null; - } - - boolean hasStarted() { - return mStarted; - } - - void startYourEngines(boolean onMainThread) { - synchronized (mLock) { - ensureChromiumStartedLocked(onMainThread); - - } - } - - private Context getWrappedCurrentApplicationContext() { - return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplication()); - } - - AwBrowserContext getBrowserContext() { - synchronized (mLock) { - return getBrowserContextLocked(); - } - } - - private AwBrowserContext getBrowserContextLocked() { - assert Thread.holdsLock(mLock); - assert mStarted; - if (mBrowserContext == null) { - mBrowserContext = new AwBrowserContext(mWebViewPrefs); - } - return mBrowserContext; - } - - private void setWebContentsDebuggingEnabled(boolean enable) { - if (Looper.myLooper() != ThreadUtils.getUiThreadLooper()) { - throw new RuntimeException( - "Toggling of Web Contents Debugging must be done on the UI thread"); - } - if (mDevToolsServer == null) { - if (!enable) return; - mDevToolsServer = new AwDevToolsServer(); - } - mDevToolsServer.setRemoteDebuggingEnabled(enable); - } - - private void setUpResources(Context context) { - // The resources are always called com.android.webview even if the manifest has had the - // package renamed. - ResourceRewriter.rewriteRValues( - mWebViewDelegate.getPackageId(context.getResources(), "com.android.webview")); - - AwResource.setResources(context.getResources()); - AwResource.setErrorPageResources(android.R.raw.loaderror, - android.R.raw.nodomain); - AwResource.setConfigKeySystemUuidMapping( - android.R.array.config_keySystemUuidMapping); - } - - @Override - public Statics getStatics() { - synchronized (mLock) { - if (mStaticMethods == null) { - // TODO: Optimization potential: most these methods only need the native library - // loaded and initialized, not the entire browser process started. - // See also http://b/7009882 - ensureChromiumStartedLocked(true); - mStaticMethods = new WebViewFactoryProvider.Statics() { - @Override - public String findAddress(String addr) { - return ContentViewStatics.findAddress(addr); - } - - @Override - public String getDefaultUserAgent(Context context) { - return AwSettings.getDefaultUserAgent(); - } - - @Override - public void setWebContentsDebuggingEnabled(boolean enable) { - // Web Contents debugging is always enabled on debug builds. - if (!isBuildDebuggable()) { - WebViewChromiumFactoryProvider.this. - setWebContentsDebuggingEnabled(enable); - } - } - - // TODO enable after L release to AOSP - //@Override - public void clearClientCertPreferences(Runnable onCleared) { - AwContentsStatics.clearClientCertPreferences(onCleared); - } - - @Override - public void freeMemoryForTests() { - if (ActivityManager.isRunningInTestHarness()) { - MemoryPressureListener.maybeNotifyMemoryPresure( - ComponentCallbacks2.TRIM_MEMORY_COMPLETE); - } - } - - // TODO: Add @Override. - public void enableSlowWholeDocumentDraw() { - WebViewChromium.enableSlowWholeDocumentDraw(); - } - - @Override - public Uri[] parseFileChooserResult(int resultCode, Intent intent) { - return FileChooserParamsAdapter.parseFileChooserResult(resultCode, intent); - } - }; - } - } - return mStaticMethods; - } - - @Override - public WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess) { - WebViewChromium wvc = new WebViewChromium(this, webView, privateAccess); - - synchronized (mLock) { - if (mWebViewsToStart != null) { - mWebViewsToStart.add(new WeakReference(wvc)); - } - } - - return wvc; - } - - @Override - public GeolocationPermissions getGeolocationPermissions() { - synchronized (mLock) { - if (mGeolocationPermissions == null) { - ensureChromiumStartedLocked(true); - mGeolocationPermissions = new GeolocationPermissionsAdapter( - getBrowserContextLocked().getGeolocationPermissions()); - } - } - return mGeolocationPermissions; - } - - @Override - public CookieManager getCookieManager() { - synchronized (mLock) { - if (mCookieManager == null) { - if (!mStarted) { - // We can use CookieManager without starting Chromium; the native code - // will bring up just the parts it needs to make this work on a temporary - // basis until Chromium is started for real. The temporary cookie manager - // needs the application context to have been set. - ContentMain.initApplicationContext(getWrappedCurrentApplicationContext()); - } - mCookieManager = new CookieManagerAdapter(new AwCookieManager()); - } - } - return mCookieManager; - } - - @Override - public WebIconDatabase getWebIconDatabase() { - synchronized (mLock) { - if (mWebIconDatabase == null) { - ensureChromiumStartedLocked(true); - mWebIconDatabase = new WebIconDatabaseAdapter(); - } - } - return mWebIconDatabase; - } - - @Override - public WebStorage getWebStorage() { - synchronized (mLock) { - if (mWebStorage == null) { - ensureChromiumStartedLocked(true); - mWebStorage = new WebStorageAdapter(AwQuotaManagerBridge.getInstance()); - } - } - return mWebStorage; - } - - @Override - public WebViewDatabase getWebViewDatabase(Context context) { - synchronized (mLock) { - if (mWebViewDatabase == null) { - ensureChromiumStartedLocked(true); - AwBrowserContext browserContext = getBrowserContextLocked(); - mWebViewDatabase = new WebViewDatabaseAdapter( - browserContext.getFormDatabase(), - browserContext.getHttpAuthDatabase(context)); - } - } - return mWebViewDatabase; - } - - WebViewDelegate getWebViewDelegate() { - return mWebViewDelegate; - } -} diff --git a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java deleted file mode 100644 index a08c457..0000000 --- a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Picture; -import android.net.http.SslError; -import android.net.Uri; -import android.os.Build; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.provider.Browser; -import android.util.Log; -import android.view.KeyEvent; -import android.view.View; -import android.webkit.ClientCertRequest; -import android.webkit.ConsoleMessage; -import android.webkit.DownloadListener; -import android.webkit.GeolocationPermissions; -import android.webkit.JsDialogHelper; -import android.webkit.JsPromptResult; -import android.webkit.JsResult; -import android.webkit.PermissionRequest; -import android.webkit.SslErrorHandler; -import android.webkit.ValueCallback; -import android.webkit.WebChromeClient; -import android.webkit.WebChromeClient.CustomViewCallback; -import android.webkit.WebResourceResponse; -import android.webkit.WebResourceRequest; -import android.webkit.WebView; -import android.webkit.WebViewClient; - -import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; - -import org.chromium.android_webview.AwContentsClient; -import org.chromium.android_webview.AwContentsClientBridge; -import org.chromium.android_webview.AwHttpAuthHandler; -import org.chromium.android_webview.AwWebResourceResponse; -import org.chromium.android_webview.JsPromptResultReceiver; -import org.chromium.android_webview.JsResultReceiver; -import org.chromium.android_webview.permission.AwPermissionRequest; -import org.chromium.base.ThreadUtils; -import org.chromium.base.TraceEvent; -import org.chromium.content.browser.ContentView; -import org.chromium.content.browser.ContentViewClient; - -import java.lang.ref.WeakReference; -import java.net.URISyntaxException; -import java.security.Principal; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * An adapter class that forwards the callbacks from {@link ContentViewClient} - * to the appropriate {@link WebViewClient} or {@link WebChromeClient}. - * - * An instance of this class is associated with one {@link WebViewChromium} - * instance. A WebViewChromium is a WebView implementation provider (that is - * android.webkit.WebView delegates all functionality to it) and has exactly - * one corresponding {@link ContentView} instance. - * - * A {@link ContentViewClient} may be shared between multiple {@link ContentView}s, - * and hence multiple WebViews. Many WebViewClient methods pass the source - * WebView as an argument. This means that we either need to pass the - * corresponding ContentView to the corresponding ContentViewClient methods, - * or use an instance of ContentViewClientAdapter per WebViewChromium, to - * allow the source WebView to be injected by ContentViewClientAdapter. We - * choose the latter, because it makes for a cleaner design. - */ -public class WebViewContentsClientAdapter extends AwContentsClient { - // TAG is chosen for consistency with classic webview tracing. - private static final String TAG = "WebViewCallback"; - // Enables API callback tracing - private static final boolean TRACE = false; - // The WebView instance that this adapter is serving. - private final WebView mWebView; - // The Context to use. This is different from mWebView.getContext(), which should not be used. - private final Context mContext; - // The WebViewClient instance that was passed to WebView.setWebViewClient(). - private WebViewClient mWebViewClient; - // The WebChromeClient instance that was passed to WebView.setContentViewClient(). - private WebChromeClient mWebChromeClient; - // The listener receiving find-in-page API results. - private WebView.FindListener mFindListener; - // The listener receiving notifications of screen updates. - private WebView.PictureListener mPictureListener; - - private WebViewDelegate mWebViewDelegate; - - private DownloadListener mDownloadListener; - - private Handler mUiThreadHandler; - - private static final int NEW_WEBVIEW_CREATED = 100; - - private WeakHashMap> - mOngoingPermissionRequests; - /** - * Adapter constructor. - * - * @param webView the {@link WebView} instance that this adapter is serving. - */ - WebViewContentsClientAdapter(WebView webView, Context context, - WebViewDelegate webViewDelegate) { - if (webView == null || webViewDelegate == null) { - throw new IllegalArgumentException("webView or delegate can't be null."); - } - - if (context == null) { - throw new IllegalArgumentException("context can't be null."); - } - - mContext = context; - mWebView = webView; - mWebViewDelegate = webViewDelegate; - setWebViewClient(null); - - mUiThreadHandler = new Handler() { - - @Override - public void handleMessage(Message msg) { - switch(msg.what) { - case NEW_WEBVIEW_CREATED: - WebView.WebViewTransport t = (WebView.WebViewTransport) msg.obj; - WebView newWebView = t.getWebView(); - if (newWebView == mWebView) { - throw new IllegalArgumentException( - "Parent WebView cannot host it's own popup window. Please " + - "use WebSettings.setSupportMultipleWindows(false)"); - } - - if (newWebView != null && newWebView.copyBackForwardList().getSize() != 0) { - throw new IllegalArgumentException( - "New WebView for popup window must not have been previously " + - "navigated."); - } - - WebViewChromium.completeWindowCreation(mWebView, newWebView); - break; - default: - throw new IllegalStateException(); - } - } - }; - - } - - // WebViewClassic is coded in such a way that even if a null WebViewClient is set, - // certain actions take place. - // We choose to replicate this behavior by using a NullWebViewClient implementation (also known - // as the Null Object pattern) rather than duplicating the WebViewClassic approach in - // ContentView. - static class NullWebViewClient extends WebViewClient { - @Override - public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) { - // TODO: Investigate more and add a test case. - // This is reflecting Clank's behavior. - int keyCode = event.getKeyCode(); - return !ContentViewClient.shouldPropagateKey(keyCode); - } - - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - Intent intent; - // Perform generic parsing of the URI to turn it into an Intent. - try { - intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); - } catch (URISyntaxException ex) { - Log.w(TAG, "Bad URI " + url + ": " + ex.getMessage()); - return false; - } - // Sanitize the Intent, ensuring web pages can not bypass browser - // security (only access to BROWSABLE activities). - intent.addCategory(Intent.CATEGORY_BROWSABLE); - intent.setComponent(null); - Intent selector = intent.getSelector(); - if (selector != null) { - selector.addCategory(Intent.CATEGORY_BROWSABLE); - selector.setComponent(null); - } - // Pass the package name as application ID so that the intent from the - // same application can be opened in the same tab. - intent.putExtra(Browser.EXTRA_APPLICATION_ID, - view.getContext().getPackageName()); - try { - view.getContext().startActivity(intent); - } catch (ActivityNotFoundException ex) { - Log.w(TAG, "No application can handle " + url); - return false; - } - return true; - } - } - - void setWebViewClient(WebViewClient client) { - if (client != null) { - mWebViewClient = client; - } else { - mWebViewClient = new NullWebViewClient(); - } - } - - void setWebChromeClient(WebChromeClient client) { - mWebChromeClient = client; - } - - void setDownloadListener(DownloadListener listener) { - mDownloadListener = listener; - } - - void setFindListener(WebView.FindListener listener) { - mFindListener = listener; - } - - void setPictureListener(WebView.PictureListener listener) { - mPictureListener = listener; - } - - //-------------------------------------------------------------------------------------------- - // Adapter for all the methods. - //-------------------------------------------------------------------------------------------- - - /** - * @see AwContentsClient#getVisitedHistory - */ - @Override - public void getVisitedHistory(ValueCallback callback) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "getVisitedHistory"); - mWebChromeClient.getVisitedHistory(callback); - } - TraceEvent.end(); - } - - /** - * @see AwContentsClient#doUpdateVisiteHistory(String, boolean) - */ - @Override - public void doUpdateVisitedHistory(String url, boolean isReload) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "doUpdateVisitedHistory=" + url + " reload=" + isReload); - mWebViewClient.doUpdateVisitedHistory(mWebView, url, isReload); - TraceEvent.end(); - } - - /** - * @see AwContentsClient#onProgressChanged(int) - */ - @Override - public void onProgressChanged(int progress) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onProgressChanged=" + progress); - mWebChromeClient.onProgressChanged(mWebView, progress); - } - TraceEvent.end(); - } - - private static class WebResourceRequestImpl implements WebResourceRequest { - private final ShouldInterceptRequestParams mParams; - - public WebResourceRequestImpl(ShouldInterceptRequestParams params) { - mParams = params; - } - - @Override - public Uri getUrl() { - return Uri.parse(mParams.url); - } - - @Override - public boolean isForMainFrame() { - return mParams.isMainFrame; - } - - @Override - public boolean hasGesture() { - return mParams.hasUserGesture; - } - - @Override - public String getMethod() { - return mParams.method; - } - - @Override - public Map getRequestHeaders() { - return mParams.requestHeaders; - } - } - - /** - * @see AwContentsClient#shouldInterceptRequest(java.lang.String) - */ - @Override - public AwWebResourceResponse shouldInterceptRequest(ShouldInterceptRequestParams params) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "shouldInterceptRequest=" + params.url); - WebResourceResponse response = mWebViewClient.shouldInterceptRequest(mWebView, - new WebResourceRequestImpl(params)); - TraceEvent.end(); - if (response == null) return null; - - // AwWebResourceResponse should support null headers. b/16332774. - Map responseHeaders = response.getResponseHeaders(); - if (responseHeaders == null) - responseHeaders = new HashMap(); - - return new AwWebResourceResponse( - response.getMimeType(), - response.getEncoding(), - response.getData(), - response.getStatusCode(), - response.getReasonPhrase(), - responseHeaders); - } - - /** - * @see AwContentsClient#shouldOverrideUrlLoading(java.lang.String) - */ - @Override - public boolean shouldOverrideUrlLoading(String url) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "shouldOverrideUrlLoading=" + url); - boolean result = mWebViewClient.shouldOverrideUrlLoading(mWebView, url); - TraceEvent.end(); - return result; - } - - /** - * @see AwContentsClient#onUnhandledKeyEvent(android.view.KeyEvent) - */ - @Override - public void onUnhandledKeyEvent(KeyEvent event) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onUnhandledKeyEvent"); - mWebViewClient.onUnhandledKeyEvent(mWebView, event); - TraceEvent.end(); - } - - /** - * @see AwContentsClient#onConsoleMessage(android.webkit.ConsoleMessage) - */ - @Override - public boolean onConsoleMessage(ConsoleMessage consoleMessage) { - TraceEvent.begin(); - boolean result; - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onConsoleMessage: " + consoleMessage.message()); - result = mWebChromeClient.onConsoleMessage(consoleMessage); - String message = consoleMessage.message(); - if (result && message != null && message.startsWith("[blocked]")) { - Log.e(TAG, "Blocked URL: " + message); - } - } else { - result = false; - } - TraceEvent.end(); - return result; - } - - /** - * @see AwContentsClient#onFindResultReceived(int,int,boolean) - */ - @Override - public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, - boolean isDoneCounting) { - if (mFindListener == null) return; - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onFindResultReceived"); - mFindListener.onFindResultReceived(activeMatchOrdinal, numberOfMatches, isDoneCounting); - TraceEvent.end(); - } - - /** - * @See AwContentsClient#onNewPicture(Picture) - */ - @Override - public void onNewPicture(Picture picture) { - if (mPictureListener == null) return; - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onNewPicture"); - mPictureListener.onNewPicture(mWebView, picture); - TraceEvent.end(); - } - - @Override - public void onLoadResource(String url) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onLoadResource=" + url); - mWebViewClient.onLoadResource(mWebView, url); - TraceEvent.end(); - } - - @Override - public boolean onCreateWindow(boolean isDialog, boolean isUserGesture) { - Message m = mUiThreadHandler.obtainMessage( - NEW_WEBVIEW_CREATED, mWebView.new WebViewTransport()); - TraceEvent.begin(); - boolean result; - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onCreateWindow"); - result = mWebChromeClient.onCreateWindow(mWebView, isDialog, isUserGesture, m); - } else { - result = false; - } - TraceEvent.end(); - return result; - } - - /** - * @see AwContentsClient#onCloseWindow() - */ - @Override - public void onCloseWindow() { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onCloseWindow"); - mWebChromeClient.onCloseWindow(mWebView); - } - TraceEvent.end(); - } - - /** - * @see AwContentsClient#onRequestFocus() - */ - @Override - public void onRequestFocus() { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onRequestFocus"); - mWebChromeClient.onRequestFocus(mWebView); - } - TraceEvent.end(); - } - - /** - * @see AwContentsClient#onReceivedTouchIconUrl(String url, boolean precomposed) - */ - @Override - public void onReceivedTouchIconUrl(String url, boolean precomposed) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onReceivedTouchIconUrl=" + url); - mWebChromeClient.onReceivedTouchIconUrl(mWebView, url, precomposed); - } - TraceEvent.end(); - } - - /** - * @see AwContentsClient#onReceivedIcon(Bitmap bitmap) - */ - @Override - public void onReceivedIcon(Bitmap bitmap) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onReceivedIcon"); - mWebChromeClient.onReceivedIcon(mWebView, bitmap); - } - TraceEvent.end(); - } - - /** - * @see ContentViewClient#onPageStarted(String) - */ - @Override - public void onPageStarted(String url) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onPageStarted=" + url); - mWebViewClient.onPageStarted(mWebView, url, mWebView.getFavicon()); - TraceEvent.end(); - } - - /** - * @see ContentViewClient#onPageFinished(String) - */ - @Override - public void onPageFinished(String url) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onPageFinished=" + url); - mWebViewClient.onPageFinished(mWebView, url); - TraceEvent.end(); - - // See b/8208948 - // This fakes an onNewPicture callback after onPageFinished to allow - // CTS tests to run in an un-flaky manner. This is required as the - // path for sending Picture updates in Chromium are decoupled from the - // page loading callbacks, i.e. the Chrome compositor may draw our - // content and send the Picture before onPageStarted or onPageFinished - // are invoked. The CTS harness discards any pictures it receives before - // onPageStarted is invoked, so in the case we get the Picture before that and - // no further updates after onPageStarted, we'll fail the test by timing - // out waiting for a Picture. - // To ensure backwards compatibility, we need to defer sending Picture updates - // until onPageFinished has been invoked. This work is being done - // upstream, and we can revert this hack when it lands. - if (mPictureListener != null) { - ThreadUtils.postOnUiThreadDelayed(new Runnable() { - @Override - public void run() { - UnimplementedWebViewApi.invoke(); - if (mPictureListener != null) { - if (TRACE) Log.d(TAG, "onPageFinished-fake"); - mPictureListener.onNewPicture(mWebView, new Picture()); - } - } - }, 100); - } - } - - /** - * @see ContentViewClient#onReceivedError(int,String,String) - */ - @Override - public void onReceivedError(int errorCode, String description, String failingUrl) { - if (description == null || description.isEmpty()) { - // ErrorStrings is @hidden, so we can't do this in AwContents. - // Normally the net/ layer will set a valid description, but for synthesized callbacks - // (like in the case for intercepted requests) AwContents will pass in null. - description = mWebViewDelegate.getErrorString(mContext, errorCode); - } - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); - mWebViewClient.onReceivedError(mWebView, errorCode, description, failingUrl); - TraceEvent.end(); - } - - /** - * @see ContentViewClient#onReceivedTitle(String) - */ - @Override - public void onReceivedTitle(String title) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onReceivedTitle"); - mWebChromeClient.onReceivedTitle(mWebView, title); - } - TraceEvent.end(); - } - - - /** - * @see ContentViewClient#shouldOverrideKeyEvent(KeyEvent) - */ - @Override - public boolean shouldOverrideKeyEvent(KeyEvent event) { - // The check below is reflecting Clank's behavior and is a workaround for http://b/7697782. - // 1. The check for system key should be made in AwContents or ContentViewCore, before - // shouldOverrideKeyEvent() is called at all. - // 2. shouldOverrideKeyEvent() should be called in onKeyDown/onKeyUp, not from - // dispatchKeyEvent(). - if (!ContentViewClient.shouldPropagateKey(event.getKeyCode())) return true; - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "shouldOverrideKeyEvent"); - boolean result = mWebViewClient.shouldOverrideKeyEvent(mWebView, event); - TraceEvent.end(); - return result; - } - - - /** - * @see ContentViewClient#onStartContentIntent(Context, String) - * Callback when detecting a click on a content link. - */ - // TODO: Delete this method when removed from base class. - public void onStartContentIntent(Context context, String contentUrl) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "shouldOverrideUrlLoading=" + contentUrl); - mWebViewClient.shouldOverrideUrlLoading(mWebView, contentUrl); - TraceEvent.end(); - } - - @Override - public void onGeolocationPermissionsShowPrompt(String origin, - GeolocationPermissions.Callback callback) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onGeolocationPermissionsShowPrompt"); - mWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback); - } - TraceEvent.end(); - } - - @Override - public void onGeolocationPermissionsHidePrompt() { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onGeolocationPermissionsHidePrompt"); - mWebChromeClient.onGeolocationPermissionsHidePrompt(); - } - TraceEvent.end(); - } - - @Override - public void onPermissionRequest(AwPermissionRequest permissionRequest) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onPermissionRequest"); - if (mOngoingPermissionRequests == null) { - mOngoingPermissionRequests = - new WeakHashMap>(); - } - PermissionRequestAdapter adapter = new PermissionRequestAdapter(permissionRequest); - mOngoingPermissionRequests.put( - permissionRequest, new WeakReference(adapter)); - mWebChromeClient.onPermissionRequest(adapter); - } else { - // By default, we deny the permission. - permissionRequest.deny(); - } - TraceEvent.end(); - } - - @Override - public void onPermissionRequestCanceled(AwPermissionRequest permissionRequest) { - TraceEvent.begin(); - if (mWebChromeClient != null && mOngoingPermissionRequests != null) { - if (TRACE) Log.d(TAG, "onPermissionRequestCanceled"); - WeakReference weakRef = - mOngoingPermissionRequests.get(permissionRequest); - // We don't hold strong reference to PermissionRequestAdpater and don't expect the - // user only holds weak reference to it either, if so, user has no way to call - // grant()/deny(), and no need to be notified the cancellation of request. - if (weakRef != null) { - PermissionRequestAdapter adapter = weakRef.get(); - if (adapter != null) mWebChromeClient.onPermissionRequestCanceled(adapter); - } - } - TraceEvent.end(); - } - - private static class JsPromptResultReceiverAdapter implements JsResult.ResultReceiver { - private JsPromptResultReceiver mChromePromptResultReceiver; - private JsResultReceiver mChromeResultReceiver; - // We hold onto the JsPromptResult here, just to avoid the need to downcast - // in onJsResultComplete. - private final JsPromptResult mPromptResult = new JsPromptResult(this); - - public JsPromptResultReceiverAdapter(JsPromptResultReceiver receiver) { - mChromePromptResultReceiver = receiver; - } - - public JsPromptResultReceiverAdapter(JsResultReceiver receiver) { - mChromeResultReceiver = receiver; - } - - public JsPromptResult getPromptResult() { - return mPromptResult; - } - - @Override - public void onJsResultComplete(JsResult result) { - if (mChromePromptResultReceiver != null) { - if (mPromptResult.getResult()) { - mChromePromptResultReceiver.confirm(mPromptResult.getStringResult()); - } else { - mChromePromptResultReceiver.cancel(); - } - } else { - if (mPromptResult.getResult()) { - mChromeResultReceiver.confirm(); - } else { - mChromeResultReceiver.cancel(); - } - } - } - } - - @Override - public void handleJsAlert(String url, String message, JsResultReceiver receiver) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - final JsPromptResult res = - new JsPromptResultReceiverAdapter(receiver).getPromptResult(); - if (TRACE) Log.d(TAG, "onJsAlert"); - if (!mWebChromeClient.onJsAlert(mWebView, url, message, res)) { - new JsDialogHelper(res, JsDialogHelper.ALERT, null, message, url) - .showDialog(mContext); - } - } else { - receiver.cancel(); - } - TraceEvent.end(); - } - - @Override - public void handleJsBeforeUnload(String url, String message, JsResultReceiver receiver) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - final JsPromptResult res = - new JsPromptResultReceiverAdapter(receiver).getPromptResult(); - if (TRACE) Log.d(TAG, "onJsBeforeUnload"); - if (!mWebChromeClient.onJsBeforeUnload(mWebView, url, message, res)) { - new JsDialogHelper(res, JsDialogHelper.UNLOAD, null, message, url) - .showDialog(mContext); - } - } else { - receiver.cancel(); - } - TraceEvent.end(); - } - - @Override - public void handleJsConfirm(String url, String message, JsResultReceiver receiver) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - final JsPromptResult res = - new JsPromptResultReceiverAdapter(receiver).getPromptResult(); - if (TRACE) Log.d(TAG, "onJsConfirm"); - if (!mWebChromeClient.onJsConfirm(mWebView, url, message, res)) { - new JsDialogHelper(res, JsDialogHelper.CONFIRM, null, message, url) - .showDialog(mContext); - } - } else { - receiver.cancel(); - } - TraceEvent.end(); - } - - @Override - public void handleJsPrompt(String url, String message, String defaultValue, - JsPromptResultReceiver receiver) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - final JsPromptResult res = - new JsPromptResultReceiverAdapter(receiver).getPromptResult(); - if (TRACE) Log.d(TAG, "onJsPrompt"); - if (!mWebChromeClient.onJsPrompt(mWebView, url, message, defaultValue, res)) { - new JsDialogHelper(res, JsDialogHelper.PROMPT, defaultValue, message, url) - .showDialog(mContext); - } - } else { - receiver.cancel(); - } - TraceEvent.end(); - } - - @Override - public void onReceivedHttpAuthRequest(AwHttpAuthHandler handler, String host, String realm) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onReceivedHttpAuthRequest=" + host); - mWebViewClient.onReceivedHttpAuthRequest(mWebView, - new AwHttpAuthHandlerAdapter(handler), host, realm); - TraceEvent.end(); - } - - @Override - public void onReceivedSslError(final ValueCallback callback, SslError error) { - SslErrorHandler handler = new SslErrorHandler() { - @Override - public void proceed() { - callback.onReceiveValue(true); - } - @Override - public void cancel() { - callback.onReceiveValue(false); - } - }; - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onReceivedSslError"); - mWebViewClient.onReceivedSslError(mWebView, handler, error); - TraceEvent.end(); - } - - private static class ClientCertRequestImpl extends ClientCertRequest { - - final private AwContentsClientBridge.ClientCertificateRequestCallback mCallback; - final private String[] mKeyTypes; - final private Principal[] mPrincipals; - final private String mHost; - final private int mPort; - - public ClientCertRequestImpl( - AwContentsClientBridge.ClientCertificateRequestCallback callback, - String[] keyTypes, Principal[] principals, String host, int port) { - mCallback = callback; - mKeyTypes = keyTypes; - mPrincipals = principals; - mHost = host; - mPort = port; - } - - @Override - public String[] getKeyTypes() { - // This is already a copy of native argument, so return directly. - return mKeyTypes; - } - - @Override - public Principal[] getPrincipals() { - // This is already a copy of native argument, so return directly. - return mPrincipals; - } - - @Override - public String getHost() { - return mHost; - } - - @Override - public int getPort() { - return mPort; - } - - @Override - public void proceed(final PrivateKey privateKey, final X509Certificate[] chain) { - mCallback.proceed(privateKey, chain); - } - - @Override - public void ignore() { - mCallback.ignore(); - } - - @Override - public void cancel() { - mCallback.cancel(); - } - } - - @Override - public void onReceivedClientCertRequest( - AwContentsClientBridge.ClientCertificateRequestCallback callback, - String[] keyTypes, Principal[] principals, String host, int port) { - if (TRACE) Log.d(TAG, "onReceivedClientCertRequest"); - TraceEvent.begin(); - final ClientCertRequestImpl request = new ClientCertRequestImpl(callback, - keyTypes, principals, host, port); - mWebViewClient.onReceivedClientCertRequest(mWebView, request); - TraceEvent.end(); - } - - @Override - public void onReceivedLoginRequest(String realm, String account, String args) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onReceivedLoginRequest=" + realm); - mWebViewClient.onReceivedLoginRequest(mWebView, realm, account, args); - TraceEvent.end(); - } - - @Override - public void onFormResubmission(Message dontResend, Message resend) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onFormResubmission"); - mWebViewClient.onFormResubmission(mWebView, dontResend, resend); - TraceEvent.end(); - } - - @Override - public void onDownloadStart(String url, - String userAgent, - String contentDisposition, - String mimeType, - long contentLength) { - if (mDownloadListener != null) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, "onDownloadStart"); - mDownloadListener.onDownloadStart(url, - userAgent, - contentDisposition, - mimeType, - contentLength); - TraceEvent.end(); - } - } - - @Override - public void showFileChooser(final ValueCallback uploadFileCallback, - final AwContentsClient.FileChooserParams fileChooserParams) { - if (mWebChromeClient == null) { - uploadFileCallback.onReceiveValue(null); - return; - } - TraceEvent.begin(); - FileChooserParamsAdapter adapter = new FileChooserParamsAdapter( - fileChooserParams, mContext); - if (TRACE) Log.d(TAG, "showFileChooser"); - ValueCallback callbackAdapter = new ValueCallback() { - private boolean mCompleted; - @Override - public void onReceiveValue(Uri[] uriList) { - if (mCompleted) { - throw new IllegalStateException("showFileChooser result was already called"); - } - mCompleted = true; - String s[] = null; - if (uriList != null) { - s = new String[uriList.length]; - for(int i = 0; i < uriList.length; i++) { - s[i] = uriList[i].toString(); - } - } - uploadFileCallback.onReceiveValue(s); - } - }; - - // Invoke the new callback introduced in Lollipop. If the app handles - // it, we're done here. - if (mWebChromeClient.onShowFileChooser(mWebView, callbackAdapter, adapter)) { - return; - } - - // If the app did not handle it and we are running on Lollipop or newer, then - // abort. - if (mContext.getApplicationInfo().targetSdkVersion >= - Build.VERSION_CODES.LOLLIPOP) { - uploadFileCallback.onReceiveValue(null); - return; - } - - // Otherwise, for older apps, attempt to invoke the legacy (hidden) API for - // backwards compatibility. - ValueCallback innerCallback = new ValueCallback() { - private boolean mCompleted; - @Override - public void onReceiveValue(Uri uri) { - if (mCompleted) { - throw new IllegalStateException("showFileChooser result was already called"); - } - mCompleted = true; - uploadFileCallback.onReceiveValue( - uri == null ? null : new String[] { uri.toString() }); - } - }; - if (TRACE) Log.d(TAG, "openFileChooser"); - mWebChromeClient.openFileChooser(innerCallback, fileChooserParams.acceptTypes, - fileChooserParams.capture ? "*" : ""); - TraceEvent.end(); - } - - @Override - public void onScaleChangedScaled(float oldScale, float newScale) { - TraceEvent.begin(); - if (TRACE) Log.d(TAG, " onScaleChangedScaled"); - mWebViewClient.onScaleChanged(mWebView, oldScale, newScale); - TraceEvent.end(); - } - - @Override - public void onShowCustomView(View view, CustomViewCallback cb) { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onShowCustomView"); - mWebChromeClient.onShowCustomView(view, cb); - } - TraceEvent.end(); - } - - @Override - public void onHideCustomView() { - TraceEvent.begin(); - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "onHideCustomView"); - mWebChromeClient.onHideCustomView(); - } - TraceEvent.end(); - } - - @Override - protected View getVideoLoadingProgressView() { - TraceEvent.begin(); - View result; - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "getVideoLoadingProgressView"); - result = mWebChromeClient.getVideoLoadingProgressView(); - } else { - result = null; - } - TraceEvent.end(); - return result; - } - - @Override - public Bitmap getDefaultVideoPoster() { - TraceEvent.begin(); - Bitmap result = null; - if (mWebChromeClient != null) { - if (TRACE) Log.d(TAG, "getDefaultVideoPoster"); - result = mWebChromeClient.getDefaultVideoPoster(); - } - if (result == null) { - // The ic_media_video_poster icon is transparent so we need to draw it on a gray - // background. - Bitmap poster = BitmapFactory.decodeResource( - mContext.getResources(), - R.drawable.ic_media_video_poster); - result = Bitmap.createBitmap(poster.getWidth(), poster.getHeight(), poster.getConfig()); - result.eraseColor(Color.GRAY); - Canvas canvas = new Canvas(result); - canvas.drawBitmap(poster, 0f, 0f, null); - } - TraceEvent.end(); - return result; - } - - // TODO: Move to upstream. - private static class AwHttpAuthHandlerAdapter extends android.webkit.HttpAuthHandler { - private AwHttpAuthHandler mAwHandler; - - public AwHttpAuthHandlerAdapter(AwHttpAuthHandler awHandler) { - mAwHandler = awHandler; - } - - @Override - public void proceed(String username, String password) { - if (username == null) { - username = ""; - } - - if (password == null) { - password = ""; - } - mAwHandler.proceed(username, password); - } - - @Override - public void cancel() { - mAwHandler.cancel(); - } - - @Override - public boolean useHttpAuthUsernamePassword() { - return mAwHandler.isFirstAttempt(); - } - } - - // TODO: Move to the upstream once the PermissionRequest is part of SDK. - public static class PermissionRequestAdapter extends PermissionRequest { - // TODO: Move the below definitions to AwPermissionRequest. - private static long BITMASK_RESOURCE_VIDEO_CAPTURE = 1 << 1; - private static long BITMASK_RESOURCE_AUDIO_CAPTURE = 1 << 2; - private static long BITMASK_RESOURCE_PROTECTED_MEDIA_ID = 1 << 3; - - public static long toAwPermissionResources(String[] resources) { - long result = 0; - for (String resource : resources) { - if (resource.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) - result |= BITMASK_RESOURCE_VIDEO_CAPTURE; - else if (resource.equals(PermissionRequest.RESOURCE_AUDIO_CAPTURE)) - result |= BITMASK_RESOURCE_AUDIO_CAPTURE; - else if (resource.equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) - result |= BITMASK_RESOURCE_PROTECTED_MEDIA_ID; - } - return result; - } - - private static String[] toPermissionResources(long resources) { - ArrayList result = new ArrayList(); - if ((resources & BITMASK_RESOURCE_VIDEO_CAPTURE) != 0) - result.add(PermissionRequest.RESOURCE_VIDEO_CAPTURE); - if ((resources & BITMASK_RESOURCE_AUDIO_CAPTURE) != 0) - result.add(PermissionRequest.RESOURCE_AUDIO_CAPTURE); - if ((resources & BITMASK_RESOURCE_PROTECTED_MEDIA_ID) != 0) - result.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID); - String[] resource_array = new String[result.size()]; - return result.toArray(resource_array); - } - - private AwPermissionRequest mAwPermissionRequest; - private String[] mResources; - - public PermissionRequestAdapter(AwPermissionRequest awPermissionRequest) { - assert awPermissionRequest != null; - mAwPermissionRequest = awPermissionRequest; - } - - @Override - public Uri getOrigin() { - return mAwPermissionRequest.getOrigin(); - } - - @Override - public String[] getResources() { - synchronized (this) { - if (mResources == null) { - mResources = toPermissionResources(mAwPermissionRequest.getResources()); - } - return mResources; - } - } - - @Override - public void grant(String[] resources) { - long requestedResource = mAwPermissionRequest.getResources(); - if ((requestedResource & toAwPermissionResources(resources)) == requestedResource) - mAwPermissionRequest.grant(); - else - mAwPermissionRequest.deny(); - } - - @Override - public void deny() { - mAwPermissionRequest.deny(); - } - - } -} diff --git a/chromium/java/com/android/webview/chromium/WebViewDatabaseAdapter.java b/chromium/java/com/android/webview/chromium/WebViewDatabaseAdapter.java deleted file mode 100644 index 8ec44a3..0000000 --- a/chromium/java/com/android/webview/chromium/WebViewDatabaseAdapter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.webview.chromium; - -import android.content.Context; -import android.webkit.WebViewDatabase; - -import org.chromium.android_webview.AwFormDatabase; -import org.chromium.android_webview.HttpAuthDatabase; - -/** - * Chromium implementation of WebViewDatabase -- forwards calls to the - * chromium internal implementation. - */ -final class WebViewDatabaseAdapter extends WebViewDatabase { - - private AwFormDatabase mFormDatabase; - private HttpAuthDatabase mHttpAuthDatabase; - - public WebViewDatabaseAdapter(AwFormDatabase formDatabase, HttpAuthDatabase httpAuthDatabase) { - mFormDatabase = formDatabase; - mHttpAuthDatabase = httpAuthDatabase; - } - - @Override - public boolean hasUsernamePassword() { - // This is a deprecated API: intentional no-op. - return false; - } - - @Override - public void clearUsernamePassword() { - // This is a deprecated API: intentional no-op. - } - - @Override - public boolean hasHttpAuthUsernamePassword() { - return mHttpAuthDatabase.hasHttpAuthUsernamePassword(); - } - - @Override - public void clearHttpAuthUsernamePassword() { - mHttpAuthDatabase.clearHttpAuthUsernamePassword(); - } - - @Override - public boolean hasFormData() { - return mFormDatabase.hasFormData(); - } - - @Override - public void clearFormData() { - mFormDatabase.clearFormData(); - } -} diff --git a/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java b/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java deleted file mode 100644 index bf6a06f..0000000 --- a/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java +++ /dev/null @@ -1,345 +0,0 @@ -package com.android.webview.chromium; - -import android.app.Application; -import android.content.Context; -import android.content.pm.PackageInfo; -import android.content.res.AssetManager; -import android.content.res.Resources; -import android.graphics.Canvas; -import android.os.Trace; -import android.util.Log; -import android.util.SparseArray; -import android.view.View; -import android.webkit.WebViewFactory; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Factory class for {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate}s. - * - *

{@link WebViewDelegate com.android.webview.chromium.WebViewDelegate}s provide the same - * interface as {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} but without - * a dependency on the webkit class. Defining our own - * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} in frameworks/webview - * allows the WebView apk to be binary compatible with the API 21 version of the framework, in - * which {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been - * introduced. - * - *

The {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} interface and this - * factory class can be removed once we don't longer need to support WebView apk updates to devices - * running the API 21 version of the framework. At that point, we should use - * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} directly instead. - */ -class WebViewDelegateFactory { - - /** - * Copy of {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate}'s interface. - * See {@link WebViewDelegateFactory} for the reasons why this copy is needed. - */ - interface WebViewDelegate { - /** @see android.webkit.WebViewDelegate.OnTraceEnabledChangeListener */ - interface OnTraceEnabledChangeListener { - void onTraceEnabledChange(boolean enabled); - } - - /** @see android.webkit.WebViewDelegate#setOnTraceEnabledChangeListener */ - void setOnTraceEnabledChangeListener(final OnTraceEnabledChangeListener listener); - - /** @see android.webkit.WebViewDelegate#isTraceTagEnabled */ - boolean isTraceTagEnabled(); - - /** @see android.webkit.WebViewDelegate#canInvokeDrawGlFunctor */ - boolean canInvokeDrawGlFunctor(View containerView); - - /** @see android.webkit.WebViewDelegate#invokeDrawGlFunctor */ - void invokeDrawGlFunctor(View containerView, long nativeDrawGLFunctor, - boolean waitForCompletion); - - /** @see android.webkit.WebViewDelegate#callDrawGlFunction */ - void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor); - - /** @see android.webkit.WebViewDelegate#detachDrawGlFunctor */ - void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor); - - /** @see android.webkit.WebViewDelegate#getPackageId */ - int getPackageId(Resources resources, String packageName); - - /** @see android.webkit.WebViewDelegate#getApplication */ - Application getApplication(); - - /** @see android.webkit.WebViewDelegate#getErrorString */ - String getErrorString(Context context, int errorCode); - - /** @see android.webkit.WebViewDelegate#addWebViewAssetPath */ - void addWebViewAssetPath(Context context); - } - - /** - * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} that proxies - * requests to the given {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate}. - * - * @return the created delegate - */ - static WebViewDelegate createProxyDelegate(android.webkit.WebViewDelegate delegate) { - return new ProxyDelegate(delegate); - } - - /** - * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} compatible - * with the API 21 version of the framework in which - * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been - * introduced. - * - * @return the created delegate - */ - static WebViewDelegate createApi21CompatibilityDelegate() { - return new Api21CompatibilityDelegate(); - } - - /** - * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} that proxies requests - * to a {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate}. - */ - private static class ProxyDelegate implements WebViewDelegate { - - android.webkit.WebViewDelegate delegate; - - ProxyDelegate(android.webkit.WebViewDelegate delegate) { - this.delegate = delegate; - } - - @Override - public void setOnTraceEnabledChangeListener(final OnTraceEnabledChangeListener listener) { - delegate.setOnTraceEnabledChangeListener( - new android.webkit.WebViewDelegate.OnTraceEnabledChangeListener() { - @Override - public void onTraceEnabledChange(boolean enabled) { - listener.onTraceEnabledChange(enabled); - ; - } - }); - } - - @Override - public boolean isTraceTagEnabled() { - return delegate.isTraceTagEnabled(); - } - - @Override - public boolean canInvokeDrawGlFunctor(View containerView) { - return delegate.canInvokeDrawGlFunctor(containerView); - } - - @Override - public void invokeDrawGlFunctor(View containerView, long nativeDrawGLFunctor, - boolean waitForCompletion) { - delegate.invokeDrawGlFunctor(containerView, nativeDrawGLFunctor, waitForCompletion); - } - - @Override - public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor) { - delegate.callDrawGlFunction(canvas, nativeDrawGLFunctor); - } - - @Override - public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) { - delegate.detachDrawGlFunctor(containerView, nativeDrawGLFunctor); - } - - @Override - public int getPackageId(Resources resources, String packageName) { - return delegate.getPackageId(resources, packageName); - } - - @Override - public Application getApplication() { - return delegate.getApplication(); - } - - @Override - public String getErrorString(Context context, int errorCode) { - return delegate.getErrorString(context, errorCode); - } - - @Override - public void addWebViewAssetPath(Context context) { - delegate.addWebViewAssetPath(context); - } - } - - /** - * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} compatible with the - * API 21 version of the framework in which - * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been - * introduced. - * - *

This class implements the - * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} functionality by using - * reflection to call into hidden frameworks APIs released in the API-21 version of the - * framework. - */ - private static class Api21CompatibilityDelegate implements WebViewDelegate { - /** Copy of Trace.TRACE_TAG_WEBVIEW */ - private final static long TRACE_TAG_WEBVIEW = 1L << 4; - - /** Hidden APIs released in the API 21 version of the framework */ - private final Method mIsTagEnabledMethod; - private final Method mAddChangeCallbackMethod; - private final Method mGetViewRootImplMethod; - private final Method mInvokeFunctorMethod; - private final Method mCallDrawGLFunctionMethod; - private final Method mDetachFunctorMethod; - private final Method mGetAssignedPackageIdentifiersMethod; - private final Method mAddAssetPathMethod; - private final Method mCurrentApplicationMethod; - private final Method mGetStringMethod; - private final Method mGetLoadedPackageInfoMethod; - - Api21CompatibilityDelegate() { - try { - // Important: This reflection essentially defines a snapshot of some hidden APIs - // at version 21 of the framework for compatibility reasons, and the reflection - // should not be changed even if those hidden APIs change in future releases. - mIsTagEnabledMethod = Trace.class.getMethod("isTagEnabled", long.class); - mAddChangeCallbackMethod = Class.forName("android.os.SystemProperties") - .getMethod("addChangeCallback", Runnable.class); - mGetViewRootImplMethod = View.class.getMethod("getViewRootImpl"); - mInvokeFunctorMethod = Class.forName("android.view.ViewRootImpl") - .getMethod("invokeFunctor", long.class, boolean.class); - mDetachFunctorMethod = Class.forName("android.view.ViewRootImpl") - .getMethod("detachFunctor", long.class); - mCallDrawGLFunctionMethod = Class.forName("android.view.HardwareCanvas") - .getMethod("callDrawGLFunction", long.class); - mGetAssignedPackageIdentifiersMethod = AssetManager.class.getMethod( - "getAssignedPackageIdentifiers"); - mAddAssetPathMethod = AssetManager.class.getMethod( - "addAssetPath", String.class); - mCurrentApplicationMethod = Class.forName("android.app.ActivityThread") - .getMethod("currentApplication"); - mGetStringMethod = Class.forName("android.net.http.ErrorStrings") - .getMethod("getString", int.class, Context.class); - mGetLoadedPackageInfoMethod = Class.forName("android.webkit.WebViewFactory") - .getMethod("getLoadedPackageInfo"); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public void setOnTraceEnabledChangeListener(final OnTraceEnabledChangeListener listener) { - try { - mAddChangeCallbackMethod.invoke(null, new Runnable() { - @Override - public void run() { - listener.onTraceEnabledChange(isTraceTagEnabled()); - } - }); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public boolean isTraceTagEnabled() { - try { - return ((Boolean) mIsTagEnabledMethod.invoke(null, TRACE_TAG_WEBVIEW)); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public boolean canInvokeDrawGlFunctor(View containerView) { - try { - Object viewRootImpl = mGetViewRootImplMethod.invoke(containerView); - // viewRootImpl can be null during teardown when window is leaked. - return viewRootImpl != null; - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public void invokeDrawGlFunctor(View containerView, long nativeDrawGLFunctor, - boolean waitForCompletion) { - try { - Object viewRootImpl = mGetViewRootImplMethod.invoke(containerView); - if (viewRootImpl != null) { - mInvokeFunctorMethod.invoke(viewRootImpl, nativeDrawGLFunctor, waitForCompletion); - } - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor) { - try { - mCallDrawGLFunctionMethod.invoke(canvas, nativeDrawGLFunctor); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) { - try { - Object viewRootImpl = mGetViewRootImplMethod.invoke(containerView); - if (viewRootImpl != null) { - mDetachFunctorMethod.invoke(viewRootImpl, nativeDrawGLFunctor); - } - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public int getPackageId(Resources resources, String packageName) { - try { - SparseArray packageIdentifiers = - (SparseArray) mGetAssignedPackageIdentifiersMethod.invoke( - resources.getAssets()); - for (int i = 0; i < packageIdentifiers.size(); i++) { - final String name = (String) packageIdentifiers.valueAt(i); - - if (packageName.equals(name)) { - return packageIdentifiers.keyAt(i); - } - } - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - throw new RuntimeException("Package not found: " + packageName); - } - - @Override - public Application getApplication() { - try { - return (Application) mCurrentApplicationMethod.invoke(null); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public String getErrorString(Context context, int errorCode) { - try { - return (String) mGetStringMethod.invoke(null, errorCode, context); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - - @Override - public void addWebViewAssetPath(Context context) { - try { - PackageInfo info = (PackageInfo) mGetLoadedPackageInfoMethod.invoke(null); - mAddAssetPathMethod.invoke(context.getAssets(), info.applicationInfo.sourceDir); - } catch (Exception e) { - throw new RuntimeException("Invalid reflection", e); - } - } - } -} - diff --git a/chromium/package.mk b/chromium/package.mk deleted file mode 100644 index 1abe575..0000000 --- a/chromium/package.mk +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright (C) 2014 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. -# - -# This package provides the 'glue' layer between Chromium and WebView. - -LOCAL_PATH := $(call my-dir) -CHROMIUM_PATH := external/chromium_org - -ifeq (,$(wildcard $(CHROMIUM_PATH))) -# Some branches don't have the chromium sources; they shouldn't depend on -# webview, but just in case this is a mistake, warn about it. -$(warning Chromium sources missing, skipping webview package build) -else -# Chromium sources exist, build the package. - -# Java glue layer JAR, calls directly into the chromium AwContents Java API. -include $(CLEAR_VARS) - -LOCAL_PACKAGE_NAME := webview - -LOCAL_MANIFEST_FILE := AndroidManifest.xml - -LOCAL_MODULE_TAGS := optional - -LOCAL_SDK_VERSION := system_current - -LOCAL_STATIC_JAVA_LIBRARIES += android_webview_java_with_new_resources - -LOCAL_SRC_FILES := $(call all-java-files-under, java) -LOCAL_SRC_FILES += $(extra_java_files) - -LOCAL_JARJAR_RULES := $(CHROMIUM_PATH)/android_webview/build/jarjar-rules.txt - -include $(CHROMIUM_PATH)/android_webview/build/resources_config.mk -LOCAL_RESOURCE_DIR := \ - $(res_overrides) \ - $(LOCAL_PATH)/res \ - $(android_webview_resources_dirs) - -LOCAL_AAPT_FLAGS := $(android_webview_aapt_flags) -LOCAL_AAPT_FLAGS += --extra-packages com.android.webview.chromium -LOCAL_AAPT_FLAGS += --shared-lib - -include $(LOCAL_PATH)/version.mk -LOCAL_AAPT_FLAGS += --version-code "$(version_code)" --version-name "$(version_name)" - -LOCAL_JNI_SHARED_LIBRARIES += libwebviewchromium - -LOCAL_MULTILIB := both - -# If this build is just for apps, skip building the platform-side dependencies. -ifeq ($(TARGET_BUILD_APPS),) -LOCAL_REQUIRED_MODULES := \ - libwebviewchromium_loader \ - libwebviewchromium_plat_support -endif - -LOCAL_PROGUARD_ENABLED := full -LOCAL_PROGUARD_FLAG_FILES := proguard.flags - -LOCAL_JAVACFLAGS := -Xlint:unchecked -Werror - -include $(BUILD_PACKAGE) - -$(LOCAL_BUILT_MODULE): $(android_webview_intermediates_pak_additional_deps) -$(LOCAL_BUILT_MODULE): PRIVATE_ASSET_DIR += $(android_webview_asset_dirs) -# This is needed to force the grd->string.xml conversion to run before we -# attempt to generate the R.java file. -$(R_file_stamp): $(call intermediates-dir-for,GYP,android_webview_resources)/android_webview_resources.stamp - -ifneq ($(strip $(LOCAL_JARJAR_RULES)),) -# Add build rules to check that the jarjar'ed jar only contains whitelisted -# packages. Only enable this when we are running jarjar. -LOCAL_JAR_CHECK_WHITELIST := $(LOCAL_PATH)/jar_package_whitelist.txt - -jar_check_ok := $(intermediates.COMMON)/jar_check_ok -$(jar_check_ok): PRIVATE_JAR_CHECK := $(LOCAL_PATH)/tools/jar_check.py -$(jar_check_ok): PRIVATE_JAR_CHECK_WHITELIST := $(LOCAL_JAR_CHECK_WHITELIST) -$(jar_check_ok): $(full_classes_jarjar_jar) $(LOCAL_PATH)/tools/jar_check.py $(LOCAL_JAR_CHECK_WHITELIST) - @echo Jar check: $@ - $(hide) $(PRIVATE_JAR_CHECK) $< $(PRIVATE_JAR_CHECK_WHITELIST) - $(hide) touch $@ - -$(LOCAL_BUILT_MODULE): $(jar_check_ok) -endif - -endif # CHROMIUM_PATH existence test diff --git a/chromium/proguard.flags b/chromium/proguard.flags deleted file mode 100644 index b19519f..0000000 --- a/chromium/proguard.flags +++ /dev/null @@ -1,101 +0,0 @@ -# Most of the flags in this file are duplicated to refer to both the pre- and -# post-jarjar remapping versions of the class names. This enables the same -# config file to be used whether jarjar is enabled or not. - - -# Keep the factory and its public members; it's the main entry point used by the -# framework. --keep class com.android.webview.chromium.WebViewChromiumFactoryProvider { - public *; -} - -# Keep the native methods bound to plat_support. --keepclasseswithmembers class com.android.webview.chromium.** { - native ; -} - -# Keep everything related to the org.chromium JNI interface. --keepclasseswithmembers class com.android.org.chromium.** { - @**.AccessedByNative ; -} --keepclasseswithmembers class com.android.org.chromium.** { - @**.CalledByNative ; -} --keepclasseswithmembers class com.android.org.chromium.** { - @**.CalledByNativeUnchecked ; -} --keepclasseswithmembers class com.android.org.chromium.** { - native ; -} - -# Keep methods which get bound to JS interfaces via reflection. --keepclasseswithmembers class com.android.org.chromium.** { - @**.JavascriptInterface ; -} - -# Silence notes caused by use of @VisibleForTesting inside guava. This doesn't -# happen when using jarjar because @VisibleForTesting gets renamed as well. --dontnote com.google.common.annotations.VisibleForTesting - -# MediaPlayerBridge uses reflection to access internal metadata. --dontnote com.android.org.chromium.media.MediaPlayerBridge - -# AndroidKeyStore uses reflection to access internal OpenSSL state. --dontnote com.android.org.chromium.net.AndroidKeyStore - -# TraceEvent uses reflection to access internal trace info. --dontnote com.android.org.chromium.content.common.TraceEvent - -# ProxyChangeListener$ProxyReceiver uses reflection to access internal -# android.net.ProxyProperties. --dontnote com.android.org.chromium.net.ProxyChangeListener$ProxyReceiver - -# com.android.org.chromium.content.app.Linker dynamically casts to $TestRunner -# when running tests. We don't run these tests in WebView. --dontnote com.android.org.chromium.content.app.Linker$TestRunner - -# We need to keep these explicitly as they are parameters to methods which -# are entry points via @calledByNative. --keep class com.android.org.chromium.ui.autofill.AutofillSuggestion --keep class com.android.org.chromium.content.browser.ContentVideoViewClient --keep class com.android.org.chromium.ui.ColorSuggestion --keep class com.android.org.chromium.content.browser.input.DateTimeSuggestion --keep class com.android.org.chromium.content.browser.ContentViewCore$JavaScriptCallback --keep class com.android.org.chromium.content_public.browser.NavigationController - -# Keep these classes as they are parameters to methods that are native entry points. --keep class com.android.org.chromium.android_webview.AwBrowserContext --keep class com.android.org.chromium.base.library_loader.Linker$LibInfo - -# Keep this class and members as accessed via reflection --keep class com.android.webview.chromium.Drp { - public *; -} - -# Keep finalizer stuff from google-common used via reflection --keepclassmembers class com.android.org.chromium.com.google.common.** { - *** finalizeReferent(); -} --keepclassmembers class com.android.org.chromium.com.google.common.** { - *** startFinalizer(java.lang.Class,java.lang.Object); -} - -# Keep support framework support for SmartClip. --keep class com.android.webview.chromium.WebViewChromium { - public void extractSmartClipData(int,int,int,int); - public void setSmartClipResultHandler(android.os.Handler); -} - -# We need to explicitly keep classes and constructors referenced only in -# layout resources. --keep class com.android.org.chromium.ui.ColorPickerAdvanced { - (...); -} - --keep class com.android.org.chromium.ui.ColorPickerSimple { - (...); -} - --keep class com.android.org.chromium.ui.ColorPickerMoreButton { - (...); -} diff --git a/chromium/res/drawable-hdpi/ic_media_video_poster.png b/chromium/res/drawable-hdpi/ic_media_video_poster.png deleted file mode 100644 index 77b6b0e..0000000 Binary files a/chromium/res/drawable-hdpi/ic_media_video_poster.png and /dev/null differ diff --git a/chromium/res/drawable-hdpi/icon_webview.png b/chromium/res/drawable-hdpi/icon_webview.png deleted file mode 100644 index 4f9377f..0000000 Binary files a/chromium/res/drawable-hdpi/icon_webview.png and /dev/null differ diff --git a/chromium/res/drawable-ldpi/ic_media_video_poster.png b/chromium/res/drawable-ldpi/ic_media_video_poster.png deleted file mode 100644 index 7b34913..0000000 Binary files a/chromium/res/drawable-ldpi/ic_media_video_poster.png and /dev/null differ diff --git a/chromium/res/drawable-mdpi/ic_media_video_poster.png b/chromium/res/drawable-mdpi/ic_media_video_poster.png deleted file mode 100644 index f457f23..0000000 Binary files a/chromium/res/drawable-mdpi/ic_media_video_poster.png and /dev/null differ diff --git a/chromium/res/drawable-mdpi/icon_webview.png b/chromium/res/drawable-mdpi/icon_webview.png deleted file mode 100644 index 9bc6817..0000000 Binary files a/chromium/res/drawable-mdpi/icon_webview.png and /dev/null differ diff --git a/chromium/res/drawable-xhdpi/ic_media_video_poster.png b/chromium/res/drawable-xhdpi/ic_media_video_poster.png deleted file mode 100644 index 4aa4904..0000000 Binary files a/chromium/res/drawable-xhdpi/ic_media_video_poster.png and /dev/null differ diff --git a/chromium/res/drawable-xhdpi/icon_webview.png b/chromium/res/drawable-xhdpi/icon_webview.png deleted file mode 100644 index 9412fbe..0000000 Binary files a/chromium/res/drawable-xhdpi/icon_webview.png and /dev/null differ diff --git a/chromium/res/drawable-xxhdpi/icon_webview.png b/chromium/res/drawable-xxhdpi/icon_webview.png deleted file mode 100644 index bd8c447..0000000 Binary files a/chromium/res/drawable-xxhdpi/icon_webview.png and /dev/null differ diff --git a/chromium/res/values-af/strings.xml b/chromium/res/values-af/strings.xml deleted file mode 100644 index 5a9af53..0000000 --- a/chromium/res/values-af/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Dié weergawe van Android steun nie díe funksie nie." - diff --git a/chromium/res/values-am/strings.xml b/chromium/res/values-am/strings.xml deleted file mode 100644 index 944f0b5..0000000 --- a/chromium/res/values-am/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ይህ ተግባራዊ በዚህ የAndroid ስሪት ላይ የተደገ አይደለም።" - diff --git a/chromium/res/values-ar/strings.xml b/chromium/res/values-ar/strings.xml deleted file mode 100644 index 15f29db..0000000 --- a/chromium/res/values-ar/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "‏هذه الخدمة غير متوافقة مع هذا الإصدار من Android." - diff --git a/chromium/res/values-az-rAZ/strings.xml b/chromium/res/values-az-rAZ/strings.xml deleted file mode 100644 index 8f388bd..0000000 --- a/chromium/res/values-az-rAZ/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Bu funksionallıq Androidin bu versiyasında dəstəklənmir." - diff --git a/chromium/res/values-az/strings.xml b/chromium/res/values-az/strings.xml deleted file mode 100644 index 8f388bd..0000000 --- a/chromium/res/values-az/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Bu funksionallıq Androidin bu versiyasında dəstəklənmir." - diff --git a/chromium/res/values-bg/strings.xml b/chromium/res/values-bg/strings.xml deleted file mode 100644 index d57e8fd..0000000 --- a/chromium/res/values-bg/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Функционалността не се поддържа в тази версия на Android." - diff --git a/chromium/res/values-bn-rBD/strings.xml b/chromium/res/values-bn-rBD/strings.xml deleted file mode 100644 index 9add0e9..0000000 --- a/chromium/res/values-bn-rBD/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "এই কার্যকারিতাটি Android এর এই সংস্করণে সমর্থিত নয়।" - diff --git a/chromium/res/values-ca/strings.xml b/chromium/res/values-ca/strings.xml deleted file mode 100644 index a4c2a83..0000000 --- a/chromium/res/values-ca/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Aquesta funció no és compatible amb aquesta versió d\'Android." - diff --git a/chromium/res/values-cs/strings.xml b/chromium/res/values-cs/strings.xml deleted file mode 100644 index f0a8c29..0000000 --- a/chromium/res/values-cs/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Tuto funkci daná verze systému Android nepodporuje." - diff --git a/chromium/res/values-da/strings.xml b/chromium/res/values-da/strings.xml deleted file mode 100644 index 4284767..0000000 --- a/chromium/res/values-da/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Denne funktion understøttes ikke i denne version af Android." - diff --git a/chromium/res/values-de/strings.xml b/chromium/res/values-de/strings.xml deleted file mode 100644 index f714539..0000000 --- a/chromium/res/values-de/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Die Funktion wird von dieser Android-Version nicht unterstützt." - diff --git a/chromium/res/values-el/strings.xml b/chromium/res/values-el/strings.xml deleted file mode 100644 index 9e2d943..0000000 --- a/chromium/res/values-el/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Αυτή η λειτουργία δεν υποστηρίζεται σε αυτήν την έκδοση Android." - diff --git a/chromium/res/values-en-rAU/strings.xml b/chromium/res/values-en-rAU/strings.xml deleted file mode 100644 index 388e12c..0000000 --- a/chromium/res/values-en-rAU/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "This functionality is not supported in this version of Android." - diff --git a/chromium/res/values-en-rGB/strings.xml b/chromium/res/values-en-rGB/strings.xml deleted file mode 100644 index 388e12c..0000000 --- a/chromium/res/values-en-rGB/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "This functionality is not supported in this version of Android." - diff --git a/chromium/res/values-en-rIN/strings.xml b/chromium/res/values-en-rIN/strings.xml deleted file mode 100644 index 388e12c..0000000 --- a/chromium/res/values-en-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "This functionality is not supported in this version of Android." - diff --git a/chromium/res/values-es-rUS/strings.xml b/chromium/res/values-es-rUS/strings.xml deleted file mode 100644 index 1320a1c..0000000 --- a/chromium/res/values-es-rUS/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Incompatible con versión" - diff --git a/chromium/res/values-es/strings.xml b/chromium/res/values-es/strings.xml deleted file mode 100644 index 383c959..0000000 --- a/chromium/res/values-es/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Incompatible con versión." - diff --git a/chromium/res/values-et-rEE/strings.xml b/chromium/res/values-et-rEE/strings.xml deleted file mode 100644 index 4d9682d..0000000 --- a/chromium/res/values-et-rEE/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "See funktsioon pole selles Androidi versioonis toetatud." - diff --git a/chromium/res/values-eu-rES/strings.xml b/chromium/res/values-eu-rES/strings.xml deleted file mode 100644 index ec152a0..0000000 --- a/chromium/res/values-eu-rES/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android bertsio honek ez du funtzio hori onartzen." - diff --git a/chromium/res/values-fa/strings.xml b/chromium/res/values-fa/strings.xml deleted file mode 100644 index 4207c0b..0000000 --- a/chromium/res/values-fa/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "‏این عملکرد در این نسخه Android پشتیبانی نمی‌شود." - diff --git a/chromium/res/values-fi/strings.xml b/chromium/res/values-fi/strings.xml deleted file mode 100644 index 4350924..0000000 --- a/chromium/res/values-fi/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Toiminnallisuutta ei tueta tässä Android-versiossa." - diff --git a/chromium/res/values-fr-rCA/strings.xml b/chromium/res/values-fr-rCA/strings.xml deleted file mode 100644 index 39caa21..0000000 --- a/chromium/res/values-fr-rCA/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Cette fonctionnalité n\'est pas compatible avec cette version d\'Android." - diff --git a/chromium/res/values-fr/strings.xml b/chromium/res/values-fr/strings.xml deleted file mode 100644 index d735e7d..0000000 --- a/chromium/res/values-fr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Fonctionnalité non compatible avec cette version d\'Android." - diff --git a/chromium/res/values-gl-rES/strings.xml b/chromium/res/values-gl-rES/strings.xml deleted file mode 100644 index 4246bfa..0000000 --- a/chromium/res/values-gl-rES/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Esta funcionalidade non é compatible con esta versión de Android." - diff --git a/chromium/res/values-gu-rIN/strings.xml b/chromium/res/values-gu-rIN/strings.xml deleted file mode 100644 index f37f20a..0000000 --- a/chromium/res/values-gu-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android ના આ સંસ્કરણમાં આ કાર્યક્ષમતા સમર્થિત નથી." - diff --git a/chromium/res/values-hi/strings.xml b/chromium/res/values-hi/strings.xml deleted file mode 100644 index 6972fce..0000000 --- a/chromium/res/values-hi/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "कार्यक्षमता, Android वर्शन में समर्थित नहीं." - diff --git a/chromium/res/values-hr/strings.xml b/chromium/res/values-hr/strings.xml deleted file mode 100644 index e7e1d83..0000000 --- a/chromium/res/values-hr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Ver. Androida ne podrž. tu fun." - diff --git a/chromium/res/values-hu/strings.xml b/chromium/res/values-hu/strings.xml deleted file mode 100644 index 67b848c..0000000 --- a/chromium/res/values-hu/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Ez a funkció nem támogatott az Android ezen verzióján." - diff --git a/chromium/res/values-hy-rAM/strings.xml b/chromium/res/values-hy-rAM/strings.xml deleted file mode 100644 index 55dfcb1..0000000 --- a/chromium/res/values-hy-rAM/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Այս գործառույթը Android-ի այս տարբերակում չի աջակցվում:" - diff --git a/chromium/res/values-in/strings.xml b/chromium/res/values-in/strings.xml deleted file mode 100644 index d7b08bb..0000000 --- a/chromium/res/values-in/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Fungsi ini tidak didukung oleh versi Android ini." - diff --git a/chromium/res/values-is-rIS/strings.xml b/chromium/res/values-is-rIS/strings.xml deleted file mode 100644 index d6245e6..0000000 --- a/chromium/res/values-is-rIS/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Þessi eiginleiki er ekki studdur í þessari útgáfu af Android." - diff --git a/chromium/res/values-it/strings.xml b/chromium/res/values-it/strings.xml deleted file mode 100644 index f407a4b..0000000 --- a/chromium/res/values-it/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Questa funzionalità non è supportata in questa versione di Android." - diff --git a/chromium/res/values-iw/strings.xml b/chromium/res/values-iw/strings.xml deleted file mode 100644 index 9be0ed5..0000000 --- a/chromium/res/values-iw/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "פעולה לא נתמכת בגרסה זו." - diff --git a/chromium/res/values-ja/strings.xml b/chromium/res/values-ja/strings.xml deleted file mode 100644 index 44ca5a8..0000000 --- a/chromium/res/values-ja/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "この機能はこのバージョンのAndroidではサポートされていません。" - diff --git a/chromium/res/values-ka-rGE/strings.xml b/chromium/res/values-ka-rGE/strings.xml deleted file mode 100644 index 7735693..0000000 --- a/chromium/res/values-ka-rGE/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ამ ვერს. ფუნქც.მხარდაუჭ." - diff --git a/chromium/res/values-kk-rKZ/strings.xml b/chromium/res/values-kk-rKZ/strings.xml deleted file mode 100644 index 9248461..0000000 --- a/chromium/res/values-kk-rKZ/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Бұл фун. осы Android қолдам." - diff --git a/chromium/res/values-km-rKH/strings.xml b/chromium/res/values-km-rKH/strings.xml deleted file mode 100644 index c2cbf48..0000000 --- a/chromium/res/values-km-rKH/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "មុខងារនេះមិនត្រូវបានគាំទ្រនៅក្នុងកំណែ Android នេះទេ។" - diff --git a/chromium/res/values-kn-rIN/strings.xml b/chromium/res/values-kn-rIN/strings.xml deleted file mode 100644 index 8dbf6c9..0000000 --- a/chromium/res/values-kn-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android ನ ಈ ಆವೃತ್ತಿಯಲ್ಲಿ ಈ ಕಾರ್ಯಕ್ಷಮತೆಯು ಬೆಂಬಲಿತವಾಗಿಲ್ಲ." - diff --git a/chromium/res/values-ko/strings.xml b/chromium/res/values-ko/strings.xml deleted file mode 100644 index f097b7f..0000000 --- a/chromium/res/values-ko/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "사용 중인 Android 버전에서 지원되지 않는 기능입니다." - diff --git a/chromium/res/values-ky-rKG/strings.xml b/chromium/res/values-ky-rKG/strings.xml deleted file mode 100644 index 2262754..0000000 --- a/chromium/res/values-ky-rKG/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Бул функция ушул Android версиясында колдоого алынбайт." - diff --git a/chromium/res/values-lo-rLA/strings.xml b/chromium/res/values-lo-rLA/strings.xml deleted file mode 100644 index 1fa390b..0000000 --- a/chromium/res/values-lo-rLA/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ຄວາມ​ສາມາດນີ້​ຍັງບໍ່ຖືກ​ຮອງຮັບໃນ Android ເວີຊັນ​ນີ້ເທື່ອ." - diff --git a/chromium/res/values-lt/strings.xml b/chromium/res/values-lt/strings.xml deleted file mode 100644 index 3eee6c6..0000000 --- a/chromium/res/values-lt/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Šios v. „Android“ šios funkc. nepal." - diff --git a/chromium/res/values-lv/strings.xml b/chromium/res/values-lv/strings.xml deleted file mode 100644 index c6be5ba..0000000 --- a/chromium/res/values-lv/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Šajā Android versijā šī funkcija netiek atbalstīta." - diff --git a/chromium/res/values-mk-rMK/strings.xml b/chromium/res/values-mk-rMK/strings.xml deleted file mode 100644 index 8ca84e9..0000000 --- a/chromium/res/values-mk-rMK/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Функцијата не е поддржана во оваа верзија на Android." - diff --git a/chromium/res/values-ml-rIN/strings.xml b/chromium/res/values-ml-rIN/strings.xml deleted file mode 100644 index 3713095..0000000 --- a/chromium/res/values-ml-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android-ന്റെ ഈ പതിപ്പിൽ ഈ പ്രവർത്തനത്തെ പിന്തുണയ്ക്കില്ല." - diff --git a/chromium/res/values-mn-rMN/strings.xml b/chromium/res/values-mn-rMN/strings.xml deleted file mode 100644 index 31bc7ab..0000000 --- a/chromium/res/values-mn-rMN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Андройдын энэ хувилбар дээр энэ функц дэмжигдээгүй." - diff --git a/chromium/res/values-mr-rIN/strings.xml b/chromium/res/values-mr-rIN/strings.xml deleted file mode 100644 index 0ce6a26..0000000 --- a/chromium/res/values-mr-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android च्‍या या आवृत्तीत ही कार्यक्षमता समर्थित नाही." - diff --git a/chromium/res/values-ms-rMY/strings.xml b/chromium/res/values-ms-rMY/strings.xml deleted file mode 100644 index 219a935..0000000 --- a/chromium/res/values-ms-rMY/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Fungsi ini tidak disokong dalam Android versi ini." - diff --git a/chromium/res/values-my-rMM/strings.xml b/chromium/res/values-my-rMM/strings.xml deleted file mode 100644 index e819ed0..0000000 --- a/chromium/res/values-my-rMM/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ဤဗားရှင်းတွင် သုံးမရပါ။" - diff --git a/chromium/res/values-nb/strings.xml b/chromium/res/values-nb/strings.xml deleted file mode 100644 index a07b17f..0000000 --- a/chromium/res/values-nb/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Denne funksjonaliteten støttes ikke i denne Android-versjonen." - diff --git a/chromium/res/values-ne-rNP/strings.xml b/chromium/res/values-ne-rNP/strings.xml deleted file mode 100644 index ce13393..0000000 --- a/chromium/res/values-ne-rNP/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android को यस संस्करणमा यो कार्य समर्थित छैन।" - diff --git a/chromium/res/values-ne/strings.xml b/chromium/res/values-ne/strings.xml deleted file mode 100644 index 2f45b9c..0000000 --- a/chromium/res/values-ne/strings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/chromium/res/values-nl/strings.xml b/chromium/res/values-nl/strings.xml deleted file mode 100644 index c8ef70a..0000000 --- a/chromium/res/values-nl/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Deze functionaliteit wordt niet ondersteund in deze versie van Android." - diff --git a/chromium/res/values-pa-rIN/strings.xml b/chromium/res/values-pa-rIN/strings.xml deleted file mode 100644 index 2fdf77e..0000000 --- a/chromium/res/values-pa-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ਇਹ ਫੰਕਸ਼ਨੈਲਿਟੀ Android ਦੇ ਇਸ ਵਰਜਨ ਵਿੱਚ ਸਮਰਥਿਤ ਨਹੀਂ ਹੈ।" - diff --git a/chromium/res/values-pl/strings.xml b/chromium/res/values-pl/strings.xml deleted file mode 100644 index d7524ac..0000000 --- a/chromium/res/values-pl/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "W tej wersji Androida ta funkcja jest niedostępna." - diff --git a/chromium/res/values-pt-rPT/strings.xml b/chromium/res/values-pt-rPT/strings.xml deleted file mode 100644 index 460b29a..0000000 --- a/chromium/res/values-pt-rPT/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Esta funcionalidade não é compatível com esta versão do Android." - diff --git a/chromium/res/values-pt/strings.xml b/chromium/res/values-pt/strings.xml deleted file mode 100644 index b8db4b0..0000000 --- a/chromium/res/values-pt/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Não ac. neste Android." - diff --git a/chromium/res/values-ro/strings.xml b/chromium/res/values-ro/strings.xml deleted file mode 100644 index a45ff3a..0000000 --- a/chromium/res/values-ro/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Această funcție nu este acceptată în această versiune de Android." - diff --git a/chromium/res/values-ru/strings.xml b/chromium/res/values-ru/strings.xml deleted file mode 100644 index fb5c12f..0000000 --- a/chromium/res/values-ru/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Эта функция не поддерживается в данной версии Android" - diff --git a/chromium/res/values-si-rLK/strings.xml b/chromium/res/values-si-rLK/strings.xml deleted file mode 100644 index 039f0e1..0000000 --- a/chromium/res/values-si-rLK/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "මෙම ක්‍රියාකාරිත්වය මෙම Android අනුවාදයේ සහය නොදක්වයි." - diff --git a/chromium/res/values-si/strings.xml b/chromium/res/values-si/strings.xml deleted file mode 100644 index 2f45b9c..0000000 --- a/chromium/res/values-si/strings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/chromium/res/values-sk/strings.xml b/chromium/res/values-sk/strings.xml deleted file mode 100644 index 5989b27..0000000 --- a/chromium/res/values-sk/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Funkcia nie je v tejto verzii Androidu podporovaná." - diff --git a/chromium/res/values-sl/strings.xml b/chromium/res/values-sl/strings.xml deleted file mode 100644 index 501fb33..0000000 --- a/chromium/res/values-sl/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Ta funkcija ni podprta v tej različici Androida." - diff --git a/chromium/res/values-sq-rAL/strings.xml b/chromium/res/values-sq-rAL/strings.xml deleted file mode 100644 index 69f64bd..0000000 --- a/chromium/res/values-sq-rAL/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Ky funksion nuk mbështetet në këtë version të \"androidit\"." - diff --git a/chromium/res/values-sr/strings.xml b/chromium/res/values-sr/strings.xml deleted file mode 100644 index 0ca5ec1..0000000 --- a/chromium/res/values-sr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Ова функција није подржана у овој верзији Android-а." - diff --git a/chromium/res/values-sv/strings.xml b/chromium/res/values-sv/strings.xml deleted file mode 100644 index c97f584..0000000 --- a/chromium/res/values-sv/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Funktionen stöds inte i den här versionen av Android." - diff --git a/chromium/res/values-sw/strings.xml b/chromium/res/values-sw/strings.xml deleted file mode 100644 index 28afac3..0000000 --- a/chromium/res/values-sw/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Utendaji huu hauwezi kutumika katika toleo hili la Android." - diff --git a/chromium/res/values-ta-rIN/strings.xml b/chromium/res/values-ta-rIN/strings.xml deleted file mode 100644 index 66ed197..0000000 --- a/chromium/res/values-ta-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "இந்த Android பதிப்பில், செயல்பாடு ஆதரிக்கப்படவில்லை." - diff --git a/chromium/res/values-te-rIN/strings.xml b/chromium/res/values-te-rIN/strings.xml deleted file mode 100644 index cf369e8..0000000 --- a/chromium/res/values-te-rIN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "ఈ కార్యాచరణకు ఈ Android సంస్కరణలో మద్దతు లేదు." - diff --git a/chromium/res/values-th/strings.xml b/chromium/res/values-th/strings.xml deleted file mode 100644 index c25d58f..0000000 --- a/chromium/res/values-th/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Android ไม่รองรับ" - diff --git a/chromium/res/values-tl/strings.xml b/chromium/res/values-tl/strings.xml deleted file mode 100644 index 3aeb7fd..0000000 --- a/chromium/res/values-tl/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Hindi sinusuportahan functionality sa Android version na ito." - diff --git a/chromium/res/values-tr/strings.xml b/chromium/res/values-tr/strings.xml deleted file mode 100644 index c6833c5..0000000 --- a/chromium/res/values-tr/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Bu işlev, Android\'in bu sürümünde desteklenmiyor." - diff --git a/chromium/res/values-uk/strings.xml b/chromium/res/values-uk/strings.xml deleted file mode 100644 index 0774531..0000000 --- a/chromium/res/values-uk/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Функція не підтримується в цій версії Android." - diff --git a/chromium/res/values-ur-rPK/strings.xml b/chromium/res/values-ur-rPK/strings.xml deleted file mode 100644 index 0926aeb..0000000 --- a/chromium/res/values-ur-rPK/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "‏یہ فعالیت Android کے اس ورژن میں تعاون یافتہ نہیں ہے۔" - diff --git a/chromium/res/values-uz-rUZ/strings.xml b/chromium/res/values-uz-rUZ/strings.xml deleted file mode 100644 index 53c31b2..0000000 --- a/chromium/res/values-uz-rUZ/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Bu xususiyat Androidning ushbu versiyasida ishlamaydi." - diff --git a/chromium/res/values-vi/strings.xml b/chromium/res/values-vi/strings.xml deleted file mode 100644 index 29c7ee8..0000000 --- a/chromium/res/values-vi/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Chức năng này không được hỗ trợ trong phiên bản này của Android." - diff --git a/chromium/res/values-zh-rCN/strings.xml b/chromium/res/values-zh-rCN/strings.xml deleted file mode 100644 index fcaa983..0000000 --- a/chromium/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "此版本的Android系统不支持该功能。" - diff --git a/chromium/res/values-zh-rHK/strings.xml b/chromium/res/values-zh-rHK/strings.xml deleted file mode 100644 index 5a37ee7..0000000 --- a/chromium/res/values-zh-rHK/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "這個 Android 版本不支援這項功能。" - diff --git a/chromium/res/values-zh-rTW/strings.xml b/chromium/res/values-zh-rTW/strings.xml deleted file mode 100644 index 5a37ee7..0000000 --- a/chromium/res/values-zh-rTW/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "這個 Android 版本不支援這項功能。" - diff --git a/chromium/res/values-zu/strings.xml b/chromium/res/values-zu/strings.xml deleted file mode 100644 index 484b4c4..0000000 --- a/chromium/res/values-zu/strings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Lokhu kusebenza akusekelwe kule nguqulo ye-Android." - diff --git a/chromium/res/values/strings.xml b/chromium/res/values/strings.xml deleted file mode 100644 index ef71152..0000000 --- a/chromium/res/values/strings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - This functionality is not supported in this version of Android. - diff --git a/chromium/tools/buildbot/bb_webview_tot.sh b/chromium/tools/buildbot/bb_webview_tot.sh deleted file mode 100755 index 2b3ba8c..0000000 --- a/chromium/tools/buildbot/bb_webview_tot.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2012 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. - -# The buildbot script for the webview ToT bot. - -BB_INTERNAL_DIR="$(dirname ${0})" -ANDROID_SRC_ROOT="$(cd "${BB_INTERNAL_DIR}/../../../../.."; pwd)" -if [ -e ${ANDROID_SRC_ROOT}/external/chromium_tot ]; then - BB_DIR="${ANDROID_SRC_ROOT}/external/chromium_tot/src/build/android/buildbot" -else - BB_DIR="${ANDROID_SRC_ROOT}/external/chromium_org/build/android/buildbot" -fi -DEPOT_TOOLS_DIR="$(dirname $(which gclient))" -WEBVIEW_TOOLS_DIR="${ANDROID_SRC_ROOT}/frameworks/webview/chromium/tools" -. "$BB_DIR/buildbot_functions.sh" -. "$BB_INTERNAL_DIR/webview_buildbot_functions.sh" - -bb_webview_baseline_setup "${ANDROID_SRC_ROOT}" -bb_webview_remove_chromium_org -bb_webview_sync_upstream_chromium -bb_webview_gyp -bb_webview_build_android diff --git a/chromium/tools/buildbot/webview_buildbot_functions.sh b/chromium/tools/buildbot/webview_buildbot_functions.sh deleted file mode 100755 index 331a47c..0000000 --- a/chromium/tools/buildbot/webview_buildbot_functions.sh +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright (C) 2012 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. - -function bb_webview_set_lunch_type() { - case "$1" in - clank-webview) - LUNCH_TYPE="nakasi-eng" - ;; - clank-webview-tot) - LUNCH_TYPE="nakasi-eng" - ;; - *) - LUNCH_TYPE="" - echo "Unable to determine lunch type from: ${BUILDBOT_BUILDERNAME}" - echo "@@@STEP_FAILURE@@@" - exit 2 - ;; - esac - echo "Using lunch type: $LUNCH_TYPE" -} - -function bb_webview_build_android() { - echo "@@@BUILD_STEP Compile Android@@@" - - local MAKE_COMMAND="make" - if [ "$USE_GOMA" -eq 1 ]; then - echo "Building using GOMA" - MAKE_COMMAND="${GOMA_DIR}/goma-android-make" - fi - - MAKE_TARGET="webviewchromium" - - bb_run_step $MAKE_COMMAND $MAKE_PARAMS showcommands $MAKE_TARGET - - if [ "$USE_GOMA" -eq 1 ]; then - bb_stop_goma_internal - fi -} - -function bb_webview_goma_setup() { - # Set to 0 to disable goma in case of problems. - USE_GOMA=1 - if [ -z "$GOMA_DIR" ]; then - export GOMA_DIR=/b/build/goma - fi - if [ ! -d $GOMA_DIR ]; then - USE_GOMA=0 - fi - - if [ "$USE_GOMA" -eq 1 ]; then - MAKE_PARAMS="-j150 -l20" - else - MAKE_PARAMS="-j16" - fi - - bb_setup_goma_internal -} - -# Basic setup for all bots to run after a source tree checkout. -# Args: -# $1: Android source root. -function bb_webview_baseline_setup { - SRC_ROOT="$1" - cd $SRC_ROOT - - echo "@@@BUILD_STEP Environment setup@@@" - . build/envsetup.sh - - bb_webview_set_lunch_type $BUILDBOT_BUILDERNAME - lunch $LUNCH_TYPE - - if [[ $BUILDBOT_CLOBBER ]]; then - echo "@@@BUILD_STEP Clobber@@@" - - rm -rf ${ANDROID_PRODUCT_OUT} - rm -rf ${ANDROID_HOST_OUT} - fi - - # Add the upstream build/android folder to the Python path. - # This is required since we don't want to check out the clank scripts into a - # subfolder of the upstream chromium_org checkout (that would make repo think - # those are uncommited changes and cause potential issues). - export PYTHONPATH="$PYTHONPATH:${BB_DIR}/../" - - # The CTS bot runs using repo only. - export CHECKOUT="repo" - - bb_webview_goma_setup -} - -function bb_webview_smart_sync { - echo "@@@BUILD_STEP Smart Sync (sync -s) @@@" - bb_run_step repo sync -s -j8 -df - - # We always want to roll with the latest code in this project, regardless of - # what smartsync thinks. - echo "@@@BUILD_STEP Sync frameworks/webview@@@" - repo sync frameworks/webview -} - -function bb_webview_remove_chromium_org { - echo "@@@BUILD_STEP Removing chromium_org project@@@" - # This generates a local manifest that will exclude any projects from the - # external/chromium_org folder. - bb_run_step python ${WEBVIEW_TOOLS_DIR}/generate_local_manifest.py \ - ${ANDROID_SRC_ROOT} external/chromium_org - bb_webview_smart_sync -} - -function bb_webview_sync_upstream_chromium { - echo "@@@BUILD_STEP Sync upstream chromium@@@" - local CHROMIUM_TOT_DIR=${ANDROID_SRC_ROOT}/external/chromium_tot - local CHROMIUM_ORG_DIR=${ANDROID_SRC_ROOT}/external/chromium_org - if [ ! -e ${CHROMIUM_TOT_DIR} ]; then - echo "No chromium_tot checkout detected. Creating new one.." - mkdir -p ${CHROMIUM_TOT_DIR} - cd ${CHROMIUM_TOT_DIR} - - if [ ! -e ${CHROMIUM_ORG_DIR} ]; then - echo "Symlinking chromium_org to chromium_tot/src" - ln -s ${CHROMIUM_TOT_DIR}/src ${CHROMIUM_ORG_DIR} - else - echo "${CHROMIUM_ORG_DIR} should have been removed by local manifest." - echo "@@@STEP_FAILURE@@@" - exit 2 - fi - - # Prevent Android make recursing into this folder since we're - # exposing the src folder via a symlink. - touch ${CHROMIUM_TOT_DIR}/Android.mk - - echo "Cloning chromium_tot" - git clone --template=${DEPOT_TOOLS_DIR}/git-templates \ - https://chromium.googlesource.com/chromium/src.git - cd ${CHROMIUM_TOT_DIR}/src - git config target.os android - fi - - cd ${CHROMIUM_TOT_DIR}/src - echo "Updating" - git crup -j8 - - echo "@@@BUILD_STEP Print checked out chromium revision@@@" - git log -1 - - cd ${ANDROID_SRC_ROOT} -} - -function bb_webview_gyp { - echo "@@@BUILD_STEP Run gyp_webview@@@" - cd ${ANDROID_SRC_ROOT}/external/chromium_org - bb_run_step "./android_webview/tools/gyp_webview" - cd ${ANDROID_SRC_ROOT} -} diff --git a/chromium/tools/generate_local_manifest.py b/chromium/tools/generate_local_manifest.py deleted file mode 100644 index 91ab982..0000000 --- a/chromium/tools/generate_local_manifest.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Generate local manifest in an Android repository. - -This is used to generate a local manifest in an Android repository. The purpose -of the generated manifest is to remove the set of projects that exist under a -certain path. -""" - -import os -import sys -import xml.etree.ElementTree as ET - -def createLocalManifest(manifest_path, local_manifest_path, path_to_exclude): - manifest_tree = ET.parse(manifest_path) - local_manifest_root = ET.Element('manifest') - for project in manifest_tree.getroot().findall('project'): - project_path = project.get('path') - project_name = project.get('name') - exclude_project = ((project_path != None and - project_path.startswith(path_to_exclude)) or - (project_path == None and - project_name.startswith(path_to_exclude))) - if not exclude_project: - continue - print 'Excluding project name="%s" path="%s"' % (project_name, - project_path) - remove_project = ET.SubElement(local_manifest_root, 'remove-project') - remove_project.set('name', project.get('name')) - - local_manifest_tree = ET.ElementTree(local_manifest_root) - local_manifest_dir = os.path.dirname(local_manifest_path) - if not os.path.exists(local_manifest_dir): - os.makedirs(local_manifest_dir) - local_manifest_tree.write(local_manifest_path, - xml_declaration=True, - encoding='UTF-8', - method='xml') - -def main(): - if len(sys.argv) < 3: - print 'Too few arguments.' - sys.exit(-1) - - android_build_top = sys.argv[1] - path_to_exclude = sys.argv[2] - - manifest_filename = 'default.xml' - if len(sys.argv) >= 4: - manifest_filename = sys.argv[3] - - manifest_path = os.path.join(android_build_top, '.repo/manifests', - manifest_filename) - local_manifest_path = os.path.join(android_build_top, - '.repo/local_manifest.xml') - - - print 'Path to exclude: %s' % path_to_exclude - print 'Path to manifest file: %s' % manifest_path - createLocalManifest(manifest_path, local_manifest_path, path_to_exclude) - print 'Local manifest created in: %s' % local_manifest_path - -if __name__ == '__main__': - main() diff --git a/chromium/tools/jar_check.py b/chromium/tools/jar_check.py deleted file mode 100755 index 38a2ab4..0000000 --- a/chromium/tools/jar_check.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2013 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. -# - -"""Check that a jar file contains only allowed packages. - -Given a jar file (typically, the result of running jarjar to rename packages) -and a whitelist file of allowed package names, one per line, check that all the -classes in the jar are in one of those packages. -""" - -import contextlib -import sys -import zipfile - - -def JarCheck(jar_path, whitelist_path): - """Checks that the files in the jar are in whitelisted packages. - - Args: - jar_path: The path to the .jar file to be checked. - whitelist_path: The path to the whitelist file. - Returns: - A list of files that are not in whitelisted packages. - """ - with open(whitelist_path) as whitelist_file: - allowed_packages = tuple(x.replace('.', '/').replace('\n', '/') - for x in whitelist_file) - - with contextlib.closing(zipfile.ZipFile(jar_path)) as jar: - jar_contents = jar.namelist() - - invalid_files = [] - for filename in jar_contents: - # Zipfile entries with a trailing / are directories, we can ignore these. - # Also ignore jar meta-info. - if filename.endswith('/') or filename.startswith('META-INF/'): - continue - if not filename.startswith(allowed_packages): - invalid_files.append(filename) - - return invalid_files - - -def main(argv): - if len(argv) != 3: - print >>sys.stderr, 'Usage: %s jar_file whitelist_file' % argv[0] - return 2 - invalid_files = JarCheck(argv[1], argv[2]) - invalid_file_count = len(invalid_files) - if invalid_file_count == 0: - return 0 - print >>sys.stderr, ('jar_check found %s files not in a whitelisted package:' - % invalid_file_count) - for f in invalid_files: - print >>sys.stderr, f - return 1 - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/chromium/tools/merge_common.py b/chromium/tools/merge_common.py deleted file mode 100644 index 634e19c..0000000 --- a/chromium/tools/merge_common.py +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright (C) 2012 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. - -"""Common data/functions for the Chromium merging scripts.""" - -import logging -import os -import re -import subprocess - - -REPOSITORY_ROOT = os.path.join(os.environ['ANDROID_BUILD_TOP'], - 'external/chromium_org') - - -# Whitelist of projects that need to be merged to build WebView. We don't need -# the other upstream repositories used to build the actual Chrome app. -# Different stages of the merge process need different ways of looking at the -# list, so we construct different combinations below. - -THIRD_PARTY_PROJECTS_WITH_FLAT_HISTORY = [ - 'third_party/WebKit', -] - -THIRD_PARTY_PROJECTS_WITH_FULL_HISTORY = [ - 'sdch/open-vcdiff', - 'testing/gtest', - 'third_party/angle', - 'third_party/boringssl/src', - 'third_party/brotli/src', - 'third_party/eyesfree/src/android/java/src/com/googlecode/eyesfree/braille', - 'third_party/freetype', - 'third_party/icu', - 'third_party/leveldatabase/src', - 'third_party/libaddressinput/src', - 'third_party/libjingle/source/talk', - 'third_party/libjpeg_turbo', - 'third_party/libphonenumber/src/phonenumbers', - 'third_party/libphonenumber/src/resources', - 'third_party/libsrtp', - 'third_party/libvpx', - 'third_party/libyuv', - 'third_party/mesa/src', - 'third_party/openmax_dl', - 'third_party/opus/src', - 'third_party/ots', - 'third_party/sfntly/cpp/src', - 'third_party/skia', - 'third_party/smhasher/src', - 'third_party/usrsctp/usrsctplib', - 'third_party/webrtc', - 'third_party/yasm/source/patched-yasm', - 'tools/grit', - 'tools/gyp', - 'v8', -] - -PROJECTS_WITH_FLAT_HISTORY = ['.'] + THIRD_PARTY_PROJECTS_WITH_FLAT_HISTORY -PROJECTS_WITH_FULL_HISTORY = THIRD_PARTY_PROJECTS_WITH_FULL_HISTORY - -THIRD_PARTY_PROJECTS = (THIRD_PARTY_PROJECTS_WITH_FLAT_HISTORY + - THIRD_PARTY_PROJECTS_WITH_FULL_HISTORY) - -ALL_PROJECTS = ['.'] + THIRD_PARTY_PROJECTS -assert(set(ALL_PROJECTS) == - set(PROJECTS_WITH_FLAT_HISTORY + PROJECTS_WITH_FULL_HISTORY)) - -# Directories to be removed when flattening history. -PRUNE_WHEN_FLATTENING = { - 'third_party/WebKit': [ - 'LayoutTests', - ], -} - - -# Only projects that have their history flattened can have directories pruned. -assert all(p in PROJECTS_WITH_FLAT_HISTORY for p in PRUNE_WHEN_FLATTENING) - - -class MergeError(Exception): - """Used to signal an error that prevents the merge from being completed.""" - - -class CommandError(MergeError): - """This exception is raised when a process run by GetCommandStdout fails.""" - - def __init__(self, returncode, cmd, cwd, stdout, stderr): - super(CommandError, self).__init__() - self.returncode = returncode - self.cmd = cmd - self.cwd = cwd - self.stdout = stdout - self.stderr = stderr - - def __str__(self): - return ("Command '%s' returned non-zero exit status %d. cwd was '%s'.\n\n" - "===STDOUT===\n%s\n===STDERR===\n%s\n" % - (self.cmd, self.returncode, self.cwd, self.stdout, self.stderr)) - - -class TemporaryMergeError(MergeError): - """A merge error that can potentially be resolved by trying again later.""" - - -def Abbrev(commitish): - """Returns the abbrev commitish for a given Git SHA.""" - return commitish[:12] - - -def GetCommandStdout(args, cwd=REPOSITORY_ROOT, ignore_errors=False): - """Gets stdout from runnng the specified shell command. - - Similar to subprocess.check_output() except that it can capture stdout and - stderr separately for better error reporting. - - Args: - args: The command and its arguments as an iterable. - cwd: The working directory to use. Defaults to REPOSITORY_ROOT. - ignore_errors: Ignore the command's return code and stderr. - Returns: - A concatenation of stdout + stderr from running the command. - Raises: - CommandError: if the command exited with a nonzero status. - """ - p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = p.communicate() - output = stdout + ('\n===STDERR===\n' if stderr and stdout else '') + stderr - if p.returncode == 0 or ignore_errors: - return output - else: - raise CommandError(p.returncode, ' '.join(args), cwd, stdout, stderr) - - -def CheckNoConflictsAndCommitMerge(commit_message, unattended=False, - cwd=REPOSITORY_ROOT): - """Checks for conflicts and commits once they are resolved. - - Certain conflicts are resolved automatically; if any remain, the user is - prompted to resolve them. The user can specify a custom commit message. - - Args: - commit_message: The default commit message. - unattended: If running unattended, abort on conflicts. - cwd: Working directory to use. - Raises: - TemporaryMergeError: If there are conflicts in unattended mode. - """ - status = GetCommandStdout(['git', 'status', '--porcelain'], cwd=cwd) - conflicts_deleted_by_us = re.findall(r'^(?:DD|DU) ([^\n]+)$', status, - flags=re.MULTILINE) - if conflicts_deleted_by_us: - logging.info('Keeping ours for the following locally deleted files.\n %s', - '\n '.join(conflicts_deleted_by_us)) - GetCommandStdout(['git', 'rm', '-rf', '--ignore-unmatch'] + - conflicts_deleted_by_us, cwd=cwd) - - # If upstream renames a file we have deleted then it will conflict, but - # we shouldn't just blindly delete these files as they may have been renamed - # into a directory we don't delete. Let them get re-added; they will get - # re-deleted if they are still in a directory we delete. - conflicts_renamed_by_them = re.findall(r'^UA ([^\n]+)$', status, - flags=re.MULTILINE) - if conflicts_renamed_by_them: - logging.info('Adding theirs for the following locally deleted files.\n %s', - '\n '.join(conflicts_renamed_by_them)) - GetCommandStdout(['git', 'add', '-f'] + conflicts_renamed_by_them, cwd=cwd) - - while True: - status = GetCommandStdout(['git', 'status', '--porcelain'], cwd=cwd) - conflicts = re.findall(r'^((DD|AU|UD|UA|DU|AA|UU) [^\n]+)$', status, - flags=re.MULTILINE) - if not conflicts: - break - if unattended: - GetCommandStdout(['git', 'reset', '--hard'], cwd=cwd) - raise TemporaryMergeError('Cannot resolve merge conflicts.') - conflicts_string = '\n'.join([x[0] for x in conflicts]) - new_commit_message = raw_input( - ('The following conflicts exist and must be resolved.\n\n%s\n\nWhen ' - 'done, enter a commit message or press enter to use the default ' - '(\'%s\').\n\n') % (conflicts_string, commit_message)) - if new_commit_message: - commit_message = new_commit_message - - GetCommandStdout(['git', 'commit', '-m', commit_message], cwd=cwd) diff --git a/chromium/tools/merge_from_chromium.py b/chromium/tools/merge_from_chromium.py deleted file mode 100755 index 3145387..0000000 --- a/chromium/tools/merge_from_chromium.py +++ /dev/null @@ -1,581 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2012 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. - -"""Merge Chromium into the Android tree.""" - -import logging -import optparse -import os -import re -import sys - -import merge_common - - -# We need to import this *after* merging from upstream to get the latest -# version. Set it to none here to catch uses before it's imported. -webview_licenses = None - - -AUTOGEN_MESSAGE = 'This commit was generated by merge_from_chromium.py.' -SRC_GIT_BRANCH = 'refs/remotes/history/upstream-master' - - -def _ReadGitFile(sha1, path, git_url=None, git_branch=None): - """Reads a file from a (possibly remote) git project at a specific revision. - - Args: - sha1: The SHA1 at which to read. - path: The relative path of the file to read. - git_url: The URL of the git server, if reading a remote project. - git_branch: The branch to fetch, if reading a remote project. - Returns: - The contents of the specified file. - """ - if git_url: - merge_common.GetCommandStdout(['git', 'fetch', '-f', git_url, git_branch]) - return merge_common.GetCommandStdout(['git', 'show', '%s:%s' % (sha1, path)]) - - -def _ParseDEPS(deps_content): - """Parses the DEPS file from Chromium and returns its contents. - - Args: - deps_content: The contents of the DEPS file as text. - Returns: - A dictionary of the contents of DEPS at the specified revision - """ - - class FromImpl(object): - """Used to implement the From syntax.""" - - def __init__(self, module_name): - self.module_name = module_name - - def __str__(self): - return 'From("%s")' % self.module_name - - class _VarImpl(object): - - def __init__(self, custom_vars, local_scope): - self._custom_vars = custom_vars - self._local_scope = local_scope - - def Lookup(self, var_name): - """Implements the Var syntax.""" - if var_name in self._custom_vars: - return self._custom_vars[var_name] - elif var_name in self._local_scope.get('vars', {}): - return self._local_scope['vars'][var_name] - raise Exception('Var is not defined: %s' % var_name) - - tmp_locals = {} - var = _VarImpl({}, tmp_locals) - tmp_globals = {'From': FromImpl, 'Var': var.Lookup, 'deps_os': {}} - exec(deps_content) in tmp_globals, tmp_locals # pylint: disable=W0122 - return tmp_locals - - -def _GetProjectMergeInfo(projects, deps_vars): - """Gets the git URL and SHA1 for each project based on DEPS. - - Args: - projects: The list of projects to consider. - deps_vars: The dictionary of dependencies from DEPS. - Returns: - A dictionary from project to git URL and SHA1 - 'path: (url, sha1)' - Raises: - TemporaryMergeError: if a project to be merged is not found in DEPS. - """ - deps_fallback_order = [ - deps_vars['deps'], - deps_vars['deps_os']['unix'], - deps_vars['deps_os']['android'], - ] - result = {} - for path in projects: - for deps in deps_fallback_order: - if path: - upstream_path = os.path.join('src', path) - else: - upstream_path = 'src' - url_plus_sha1 = deps.get(upstream_path) - if url_plus_sha1: - break - else: - raise merge_common.TemporaryMergeError( - 'Could not find DEPS entry for project %s. This probably ' - 'means that the project list in merge_from_chromium.py needs to be ' - 'updated.' % path) - match = re.match('(.*?)@(.*)', url_plus_sha1) - url = match.group(1) - sha1 = match.group(2) - logging.debug(' Got URL %s and SHA1 %s for project %s', url, sha1, path) - result[path] = {'url': url, 'sha1': sha1} - return result - - -def _MergeProjects(version, root_sha1, target, unattended, buildspec_url): - """Merges each required Chromium project into the Android repository. - - DEPS is consulted to determine which revision each project must be merged - at. Only a whitelist of required projects are merged. - - Args: - version: The version to mention in generated commit messages. - root_sha1: The git hash to merge in the root repository. - target: The target branch to merge to. - unattended: Run in unattended mode. - buildspec_url: URL for buildspec repository, when merging a branch. - Returns: - The abbrev sha1 merged. It will be either |root_sha1| itself (when merging - chromium trunk) or the upstream sha1 of the release. - Raises: - TemporaryMergeError: If incompatibly licensed code is left after pruning. - """ - # The logic for this step lives here, in the Android tree, as it makes no - # sense for a Chromium tree to know about this merge. - - if unattended: - branch_create_flag = '-B' - else: - branch_create_flag = '-b' - branch_name = 'merge-from-chromium-%s' % version - - logging.debug('Parsing DEPS ...') - if root_sha1: - deps_content = _ReadGitFile(root_sha1, 'DEPS') - else: - # TODO(primiano): At some point the release branches will use DEPS as well, - # instead of .DEPS.git. Rename below when that day will come. - deps_content = _ReadGitFile('FETCH_HEAD', - 'releases/' + version + '/.DEPS.git', - buildspec_url, - 'master') - - deps_vars = _ParseDEPS(deps_content) - - merge_info = _GetProjectMergeInfo(merge_common.THIRD_PARTY_PROJECTS, - deps_vars) - - for path in merge_info: - # webkit needs special handling as we have a local mirror - local_mirrored = path == 'third_party/WebKit' - url = merge_info[path]['url'] - sha1 = merge_info[path]['sha1'] - dest_dir = os.path.join(merge_common.REPOSITORY_ROOT, path) - if local_mirrored: - remote = 'history' - else: - remote = 'goog' - merge_common.GetCommandStdout(['git', 'checkout', - branch_create_flag, branch_name, - '-t', remote + '/' + target], - cwd=dest_dir) - if not local_mirrored or not root_sha1: - logging.debug('Fetching project %s at %s ...', path, sha1) - fetch_args = ['git', 'fetch', url, sha1] - merge_common.GetCommandStdout(fetch_args, cwd=dest_dir) - if merge_common.GetCommandStdout(['git', 'rev-list', '-1', 'HEAD..' + sha1], - cwd=dest_dir): - logging.debug('Merging project %s at %s ...', path, sha1) - # Merge conflicts make git merge return 1, so ignore errors - merge_common.GetCommandStdout(['git', 'merge', '--no-commit', sha1], - cwd=dest_dir, ignore_errors=True) - merge_common.CheckNoConflictsAndCommitMerge( - 'Merge %s from %s at %s\n\n%s' % (path, url, sha1, AUTOGEN_MESSAGE), - cwd=dest_dir, unattended=unattended) - else: - logging.debug('No new commits to merge in project %s', path) - - # Handle root repository separately. - merge_common.GetCommandStdout(['git', 'checkout', - branch_create_flag, branch_name, - '-t', 'history/' + target]) - if not root_sha1: - merge_info = _GetProjectMergeInfo([''], deps_vars) - url = merge_info['']['url'] - merged_sha1 = merge_info['']['sha1'] - merge_common.GetCommandStdout(['git', 'fetch', url, merged_sha1]) - merged_sha1 = merge_common.Abbrev(merged_sha1) - merge_msg_version = '%s (%s)' % (version, merged_sha1) - else: - merge_msg_version = root_sha1 - merged_sha1 = root_sha1 - - logging.debug('Merging Chromium at %s ...', merged_sha1) - # Merge conflicts make git merge return 1, so ignore errors - merge_common.GetCommandStdout(['git', 'merge', '--no-commit', merged_sha1], - ignore_errors=True) - merge_common.CheckNoConflictsAndCommitMerge( - 'Merge Chromium at %s\n\n%s' - % (merge_msg_version, AUTOGEN_MESSAGE), unattended=unattended) - - logging.debug('Getting directories to exclude ...') - - # We import this now that we have merged the latest version. - # It imports to a global in order that it can be used to generate NOTICE - # later. We also disable writing bytecode to keep the source tree clean. - sys.path.append(os.path.join(merge_common.REPOSITORY_ROOT, 'android_webview', - 'tools')) - sys.dont_write_bytecode = True - global webview_licenses # pylint: disable=W0602 - import webview_licenses # pylint: disable=W0621,W0612,C6204 - import known_issues # pylint: disable=C6204 - - for path, exclude_list in known_issues.KNOWN_INCOMPATIBLE.iteritems(): - logging.debug(' %s', '\n '.join(os.path.join(path, x) for x in - exclude_list)) - dest_dir = os.path.join(merge_common.REPOSITORY_ROOT, path) - merge_common.GetCommandStdout(['git', 'rm', '-rf', '--ignore-unmatch'] + - exclude_list, cwd=dest_dir) - if _ModifiedFilesInIndex(dest_dir): - merge_common.GetCommandStdout(['git', 'commit', '-m', - 'Exclude unwanted directories'], - cwd=dest_dir) - assert(root_sha1 is None or root_sha1 == merged_sha1) - return merged_sha1 - - -def _CheckLicenses(): - """Check that no incompatibly licensed directories exist.""" - directories_left_over = webview_licenses.GetIncompatibleDirectories() - if directories_left_over: - raise merge_common.TemporaryMergeError( - 'Incompatibly licensed directories remain: ' + - '\n'.join(directories_left_over)) - - -def _GenerateMakefiles(version, unattended): - """Run gyp to generate the Android build system makefiles. - - Args: - version: The version to mention in generated commit messages. - unattended: Run in unattended mode. - """ - logging.debug('Generating makefiles ...') - - # TODO(torne): come up with a way to deal with hooks from DEPS properly - - # TODO(torne): The .tmp files are generated by - # third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp into the source - # tree. We should avoid this, or at least use a more specific name to avoid - # accidentally removing or adding other files. - for path in merge_common.ALL_PROJECTS: - dest_dir = os.path.join(merge_common.REPOSITORY_ROOT, path) - merge_common.GetCommandStdout(['git', 'rm', '--ignore-unmatch', - 'GypAndroid.*.mk', '*.target.*.mk', - '*.host.*.mk', '*.tmp'], cwd=dest_dir) - - try: - merge_common.GetCommandStdout(['android_webview/tools/gyp_webview', 'all']) - except merge_common.MergeError as e: - if not unattended: - raise - else: - for path in merge_common.ALL_PROJECTS: - merge_common.GetCommandStdout( - ['git', 'reset', '--hard'], - cwd=os.path.join(merge_common.REPOSITORY_ROOT, path)) - raise merge_common.TemporaryMergeError('Makefile generation failed: ' + - str(e)) - - for path in merge_common.ALL_PROJECTS: - dest_dir = os.path.join(merge_common.REPOSITORY_ROOT, path) - # git add doesn't have an --ignore-unmatch so we have to do this instead: - merge_common.GetCommandStdout(['git', 'add', '-f', 'GypAndroid.*.mk'], - ignore_errors=True, cwd=dest_dir) - merge_common.GetCommandStdout(['git', 'add', '-f', '*.target.*.mk'], - ignore_errors=True, cwd=dest_dir) - merge_common.GetCommandStdout(['git', 'add', '-f', '*.host.*.mk'], - ignore_errors=True, cwd=dest_dir) - merge_common.GetCommandStdout(['git', 'add', '-f', '*.tmp'], - ignore_errors=True, cwd=dest_dir) - # Only try to commit the makefiles if something has actually changed. - if _ModifiedFilesInIndex(dest_dir): - merge_common.GetCommandStdout( - ['git', 'commit', '-m', - 'Update makefiles after merge of Chromium at %s\n\n%s' % - (version, AUTOGEN_MESSAGE)], cwd=dest_dir) - - -def _ModifiedFilesInIndex(cwd=merge_common.REPOSITORY_ROOT): - """Returns true if git's index contains any changes.""" - status = merge_common.GetCommandStdout(['git', 'status', '--porcelain'], - cwd=cwd) - return re.search(r'^[MADRC]', status, flags=re.MULTILINE) is not None - - -def _GenerateNoticeFile(version): - """Generates and commits a NOTICE file containing code licenses. - - This covers all third-party code (from Android's perspective) that lives in - the Chromium tree. - - Args: - version: The version to mention in generated commit messages. - """ - logging.debug('Regenerating NOTICE file ...') - - contents = webview_licenses.GenerateNoticeFile() - - with open(os.path.join(merge_common.REPOSITORY_ROOT, 'NOTICE'), 'w') as f: - f.write(contents) - merge_common.GetCommandStdout(['git', 'add', 'NOTICE']) - # Only try to commit the NOTICE update if the file has actually changed. - if _ModifiedFilesInIndex(): - merge_common.GetCommandStdout([ - 'git', 'commit', '-m', - 'Update NOTICE file after merge of Chromium at %s\n\n%s' - % (version, AUTOGEN_MESSAGE)]) - - -def _GenerateLastChange(version, root_sha1): - """Write a build/util/LASTCHANGE file containing the current revision. - - The revision number is compiled into the binary at build time from this file. - - Args: - version: The version to mention in generated commit messages. - root_sha1: The SHA1 of the main project (before the merge). - """ - logging.debug('Updating LASTCHANGE ...') - with open(os.path.join(merge_common.REPOSITORY_ROOT, 'build/util/LASTCHANGE'), - 'w') as f: - f.write('LASTCHANGE=%s\n' % merge_common.Abbrev(root_sha1)) - merge_common.GetCommandStdout(['git', 'add', '-f', 'build/util/LASTCHANGE']) - logging.debug('Updating LASTCHANGE.blink ...') - with open(os.path.join(merge_common.REPOSITORY_ROOT, - 'build/util/LASTCHANGE.blink'), 'w') as f: - f.write('LASTCHANGE=%s\n' % _GetBlinkRevision()) - merge_common.GetCommandStdout(['git', 'add', '-f', - 'build/util/LASTCHANGE.blink']) - if _ModifiedFilesInIndex(): - merge_common.GetCommandStdout([ - 'git', 'commit', '-m', - 'Update LASTCHANGE file after merge of Chromium at %s\n\n%s' - % (version, AUTOGEN_MESSAGE)]) - - -def GetHEAD(): - """Fetch the latest HEAD revision from the Chromium Git mirror. - - Returns: - The latest HEAD revision (A Git abbrev SHA1). - """ - return _GetGitAbbrevSHA1(SRC_GIT_BRANCH, 'HEAD') - - -def _ParseSvnRevisionFromGitCommitMessage(commit_message): - return re.search(r'^git-svn-id: .*@([0-9]+)', commit_message, - flags=re.MULTILINE).group(1) - - -def _GetGitAbbrevSHA1(git_branch, revision): - """Returns an abbrev. SHA for the given revision (or branch, if HEAD).""" - assert revision - logging.debug('Getting Git revision for %s ...', revision) - - upstream = git_branch if revision == 'HEAD' else revision - - # Make sure the remote and the branch exist locally. - try: - merge_common.GetCommandStdout([ - 'git', 'show-ref', '--verify', '--quiet', git_branch]) - except merge_common.CommandError: - raise merge_common.TemporaryMergeError( - 'Cannot find the branch %s. Have you sync\'d master-chromium in this ' - 'checkout?' % git_branch) - - # Make sure the |upstream| Git object has been mirrored. - try: - merge_common.GetCommandStdout([ - 'git', 'merge-base', '--is-ancestor', upstream, git_branch]) - except merge_common.CommandError: - raise merge_common.TemporaryMergeError( - 'Upstream object (%s) not reachable from %s' % (upstream, git_branch)) - - abbrev_sha = merge_common.Abbrev(merge_common.GetCommandStdout( - ['git', 'rev-list', '--max-count=1', upstream]).split()[0]) - return abbrev_sha - - -def _GetBlinkRevision(): - # TODO(primiano): Switch to Git as soon as Blink gets migrated as well. - commit = merge_common.GetCommandStdout( - ['git', 'log', '-n1', '--grep=git-svn-id:', '--format=%H%n%b'], - cwd=os.path.join(merge_common.REPOSITORY_ROOT, 'third_party', 'WebKit')) - return _ParseSvnRevisionFromGitCommitMessage(commit) - - -def Snapshot(root_sha1, release, target, unattended, buildspec_url): - """Takes a snapshot of the Chromium tree and merges it into Android. - - Android makefiles and a top-level NOTICE file are generated and committed - after the merge. - - Args: - root_sha1: The abbrev sha1 in the Chromium git mirror to merge from. - release: The Chromium release version to merge from (e.g. "30.0.1599.20"). - Only one of root_sha1 and release should be specified. - target: The target branch to merge to. - unattended: Run in unattended mode. - buildspec_url: URL for buildspec repository, used when merging a release. - - Returns: - True if new commits were merged; False if no new commits were present. - """ - if release: - root_sha1 = None - version = release - else: - root_sha1 = _GetGitAbbrevSHA1(SRC_GIT_BRANCH, root_sha1) - version = root_sha1 - - assert (root_sha1 is not None and len(root_sha1) > 6) or version == release - - if root_sha1 and not merge_common.GetCommandStdout( - ['git', 'rev-list', '-1', 'HEAD..' + root_sha1]): - logging.info('No new commits to merge at %s (%s)', version, root_sha1) - return False - - logging.info('Snapshotting Chromium at %s (%s)', version, root_sha1) - - # 1. Merge, accounting for excluded directories - merged_sha1 = _MergeProjects(version, root_sha1, target, unattended, - buildspec_url) - - # 2. Generate Android makefiles - _GenerateMakefiles(version, unattended) - - # 3. Check for incompatible licenses - _CheckLicenses() - - # 4. Generate Android NOTICE file - _GenerateNoticeFile(version) - - # 5. Generate LASTCHANGE file - _GenerateLastChange(version, merged_sha1) - - return True - - -def Push(version, target): - """Push the finished snapshot to the Android repository.""" - src = 'merge-from-chromium-%s' % version - # Use forced pushes ('+' prefix) for the temporary and archive branches in - # case they already got updated by a previous (possibly failed?) merge, but - # do not force push to the real master-chromium branch as this could erase - # downstream changes. - refspecs = ['%s:%s' % (src, target), - '+%s:refs/archive/chromium-%s' % (src, version)] - if target == 'master-chromium': - refspecs.insert(0, '+%s:master-chromium-merge' % src) - for refspec in refspecs: - logging.debug('Pushing to server (%s) ...', refspec) - for path in merge_common.ALL_PROJECTS: - if path in merge_common.PROJECTS_WITH_FLAT_HISTORY: - remote = 'history' - else: - remote = 'goog' - logging.debug('Pushing %s', path) - dest_dir = os.path.join(merge_common.REPOSITORY_ROOT, path) - merge_common.GetCommandStdout(['git', 'push', remote, refspec], - cwd=dest_dir) - - -def main(): - parser = optparse.OptionParser(usage='%prog [options]') - parser.epilog = ('Takes a snapshot of the Chromium tree at the specified ' - 'Chromium Git revision and merges it into this repository. ' - 'Paths marked as excluded for license reasons are removed ' - 'as part of the merge. Also generates Android makefiles and ' - 'generates a top-level NOTICE file suitable for use in the ' - 'Android build.') - parser.add_option( - '', '--sha1', - default='HEAD', - help=('Merge to the specified chromium sha1 revision from ' + - SRC_GIT_BRANCH + ' branch. Default is HEAD, to merge from ToT.')) - parser.add_option( - '', '--release', - default=None, - help=('Merge to the specified chromium release buildspec (e.g., "30.0.' - '1599.20"). Only one of --sha1 and --release should be specified')) - parser.add_option( - '', '--buildspec_url', - default=None, - help=('Git URL for buildspec repository.')) - parser.add_option( - '', '--target', - default='master-chromium', metavar='BRANCH', - help=('Target branch to push to. Defaults to master-chromium.')) - parser.add_option( - '', '--push', - default=False, action='store_true', - help=('Push the result of a previous merge to the server. Note ' - '--sha1 must be given.')) - parser.add_option( - '', '--get_head', - default=False, action='store_true', - help=('Just print the current HEAD revision on stdout and exit.')) - parser.add_option( - '', '--unattended', - default=False, action='store_true', - help=('Run in unattended mode.')) - parser.add_option( - '', '--no_changes_exit', - default=0, type='int', - help=('Exit code to use if there are no changes to merge, for scripts.')) - (options, args) = parser.parse_args() - if args: - parser.print_help() - return 1 - - if 'ANDROID_BUILD_TOP' not in os.environ: - print >>sys.stderr, 'You need to run the Android envsetup.sh and lunch.' - return 1 - - if os.environ.get('GYP_DEFINES'): - print >>sys.stderr, ( - 'The environment is defining GYP_DEFINES (=%s). It will affect the ' - ' generated makefiles.' % os.environ['GYP_DEFINES']) - if not options.unattended and raw_input('Continue? [y/N]') != 'y': - return 1 - - logging.basicConfig(format='%(message)s', level=logging.DEBUG, - stream=sys.stdout) - - if options.get_head: - logging.disable(logging.CRITICAL) # Prevent log messages - print GetHEAD() - elif options.push: - if options.release: - Push(options.release, options.target) - elif options.sha1: - Push(options.sha1, options.target) - else: - print >>sys.stderr, 'You need to pass the version to push.' - return 1 - else: - if not Snapshot(options.sha1, options.release, options.target, - options.unattended, options.buildspec_url): - return options.no_changes_exit - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/chromium/tools/merge_to_android.py b/chromium/tools/merge_to_android.py deleted file mode 100755 index 9a2e78d..0000000 --- a/chromium/tools/merge_to_android.py +++ /dev/null @@ -1,394 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2012 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. - -"""Merge master-chromium to master within the Android tree.""" - -import logging -import optparse -import os -import re -import shutil -import subprocess -import sys - -import merge_common - - -AUTOGEN_MESSAGE = 'This commit was generated by merge_to_master.py.' -WEBVIEW_PROJECT = 'frameworks/webview' - - -def _GetAbsPath(project): - """Returns the full path to a given project (either Chromium or Android).""" - if project in merge_common.ALL_PROJECTS: - abs_path = os.path.join(merge_common.REPOSITORY_ROOT, project) - else: - abs_path = os.path.join(os.environ['ANDROID_BUILD_TOP'], project) - if not os.path.exists(abs_path): - raise merge_common.MergeError('Cannot find path ' + abs_path) - return abs_path - - -def _CheckoutSingleProject(project, target_branch): - """Checks out the tip of the target_branch into a local branch (merge-to-XXX). - - Args: - project: a Chromium project (., third_party/foo) or frameworks/webview. - target_branch: name of the target branch (in the goog remote). - """ - dest_dir = _GetAbsPath(project) - tracking_branch = 'goog/' + target_branch - logging.debug('Check out %-45s at %-16s', project, tracking_branch) - merge_common.GetCommandStdout(['git', 'remote', 'update', 'goog'], - cwd=dest_dir) - merge_common.GetCommandStdout(['git', 'checkout', - '-b', 'merge-to-' + target_branch, - '-t', tracking_branch], cwd=dest_dir) - - -def _FetchSingleProject(project, remote, remote_ref): - """Fetches a remote ref for the given project and returns the fetched SHA. - - Args: - project: a Chromium project (., third_party/foo) or frameworks/webview. - remote: Git remote name (goog for most projects, history for squashed ones). - remote_ref: the remote ref to fetch (e.g., refs/archive/chromium-XXX). - - Returns: - The SHA1 of the FETCH_HEAD. - """ - dest_dir = _GetAbsPath(project) - logging.debug('Fetch %-45s %s:%s', project, remote, remote_ref) - merge_common.GetCommandStdout(['git', 'fetch', remote, remote_ref], - cwd=dest_dir) - return merge_common.GetCommandStdout(['git', 'rev-parse', 'FETCH_HEAD'], - cwd=dest_dir).strip() - - -def _MergeSingleProject(project, merge_sha, revision, target_branch, flatten): - """Merges a single project at a given SHA. - - Args: - project: a Chromium project (., third_party/foo) or frameworks/webview. - merge_sha: the SHA to merge. - revision: Abbrev. commitish in the main Chromium repository. - target_branch: name of the target branch. - flatten: True: squash history while merging; False: perform a normal merge. - """ - dest_dir = _GetAbsPath(project) - if flatten: - # Make the previous merges into grafts so we can do a correct merge. - old_sha = merge_common.GetCommandStdout(['git', 'rev-parse', 'HEAD'], - cwd=dest_dir).strip() - merge_log = os.path.join(dest_dir, '.merged-revisions') - if os.path.exists(merge_log): - shutil.copyfile(merge_log, - os.path.join(dest_dir, '.git', 'info', 'grafts')) - - # Early out if there is nothing to merge. - if not merge_common.GetCommandStdout(['git', 'rev-list', '-1', - 'HEAD..' + merge_sha], cwd=dest_dir): - logging.debug('No new commits to merge in project %s', project) - return - - logging.debug('Merging project %s (flatten: %s)...', project, flatten) - merge_cmd = ['git', 'merge', '--no-commit'] - merge_cmd += ['--squash'] if flatten else ['--no-ff'] - merge_cmd += [merge_sha] - # Merge conflicts cause 'git merge' to return 1, so ignore errors - merge_common.GetCommandStdout(merge_cmd, cwd=dest_dir, ignore_errors=True) - - if flatten: - dirs_to_prune = merge_common.PRUNE_WHEN_FLATTENING.get(project, []) - if dirs_to_prune: - merge_common.GetCommandStdout(['git', 'rm', '--ignore-unmatch', '-rf'] + - dirs_to_prune, cwd=dest_dir) - - if project in merge_common.ALL_PROJECTS: - commit_msg = 'Merge from Chromium at DEPS revision %s' % revision - else: - commit_msg = 'Merge master-chromium into %s at %s' % (target_branch, - revision) - commit_msg += '\n\n' + AUTOGEN_MESSAGE - merge_common.CheckNoConflictsAndCommitMerge(commit_msg, cwd=dest_dir) - - if flatten: - # Generate the new grafts file and commit it on top of the merge. - new_sha = merge_common.GetCommandStdout(['git', 'rev-parse', 'HEAD'], - cwd=dest_dir).strip() - with open(merge_log, 'a+') as f: - f.write('%s %s %s\n' % (new_sha, old_sha, merge_sha)) - merge_common.GetCommandStdout(['git', 'add', '.merged-revisions'], - cwd=dest_dir) - merge_common.GetCommandStdout( - ['git', 'commit', '-m', - 'Record Chromium merge at DEPS revision %s\n\n%s' % - (revision, AUTOGEN_MESSAGE)], cwd=dest_dir) - - -def _IsAncestor(ref1, ref2, cwd): - """Checks whether ref1 is a ancestor of ref2 in the given Git repo.""" - cmd = ['git', 'merge-base', '--is-ancestor', ref1, ref2] - ret = subprocess.call(cmd, cwd=cwd) - if ret == 0: - return True - elif ret == 1: - return False - else: - raise merge_common.CommandError(ret, ' '.join(cmd), cwd, 'N/A', 'N/A') - - -def _MergeChromiumProjects(revision, target_branch, repo_shas=None, - force=False): - """Merges the Chromium projects from master-chromium to target_branch. - - The larger projects' histories are flattened in the process. - When repo_shas != None, it checks that the SHAs of the projects in the - archive match exactly the SHAs of the projects in repo.prop. - - Args: - revision: Abbrev. commitish in the main Chromium repository. - target_branch: target branch name to merge and push to. - repo_shas: optional dict. of expected revisions (only for --repo-prop). - force: True: merge anyways using the SHAs from repo.prop; False: bail out if - projects mismatch (archive vs repo.prop). - """ - # Sync and checkout ToT for all projects (creating the merge-to-XXX branch) - # and fetch the archive snapshot. - fetched_shas = {} - remote_ref = 'refs/archive/chromium-%s' % revision - for project in merge_common.PROJECTS_WITH_FLAT_HISTORY: - _CheckoutSingleProject(project, target_branch) - fetched_shas[project] = _FetchSingleProject(project, 'history', remote_ref) - for project in merge_common.PROJECTS_WITH_FULL_HISTORY: - _CheckoutSingleProject(project, target_branch) - fetched_shas[project] = _FetchSingleProject(project, 'goog', remote_ref) - - if repo_shas: - project_shas_mismatch = False - for project, merge_sha in fetched_shas.items(): # the dict can be modified. - expected_sha = repo_shas.get(project) - if expected_sha != merge_sha: - logging.warn('The SHA for project %s specified in the repo.prop (%s) ' - 'and the one in the archive (%s) differ.', - project, expected_sha, merge_sha) - dest_dir = _GetAbsPath(project) - if expected_sha is None: - reason = 'cannot find a SHA in the repo.pro for %s' % project - elif _IsAncestor(merge_sha, expected_sha, cwd=dest_dir): - reason = 'the SHA in repo.prop is ahead of the SHA in the archive. ' - log_cmd = ['git', 'log', '--oneline', '--graph', '--max-count=10', - '%s..%s' % (merge_sha, expected_sha)] - log_cmd_output = merge_common.GetCommandStdout(log_cmd, cwd=dest_dir) - reason += 'showing partial log (%s): \n %s' % (' '.join(log_cmd), - log_cmd_output) - elif _IsAncestor(expected_sha, merge_sha, cwd=dest_dir): - reason = 'The SHA is already merged in the archive' - else: - reason = 'The project history diverged. Consult your Git historian.' - - project_shas_mismatch = True - if force: - logging.debug('Merging the SHA in repo.prop anyways (due to --force)') - fetched_shas[project] = expected_sha - else: - logging.debug('Reason: %s', reason) - if not force and project_shas_mismatch: - raise merge_common.MergeError( - 'The revision of some projects in the archive is different from the ' - 'one provided in build.prop. See the log for more details. Re-run ' - 'with --force to continue.') - - for project in merge_common.PROJECTS_WITH_FLAT_HISTORY: - _MergeSingleProject(project, fetched_shas[project], revision, target_branch, - flatten=True) - for project in merge_common.PROJECTS_WITH_FULL_HISTORY: - _MergeSingleProject(project, fetched_shas[project], revision, target_branch, - flatten=False) - - -def _GetNearestUpstreamAbbrevSHA(reference='history/master-chromium'): - """Returns the abbrev. upstream SHA which closest to the given reference.""" - logging.debug('Getting upstream SHA for %s...', reference) - merge_common.GetCommandStdout(['git', 'remote', 'update', 'history']) - upstream_commit = merge_common.Abbrev(merge_common.GetCommandStdout([ - 'git', 'merge-base', 'history/upstream-master', reference])) - - # Pedantic check: look for the existence of a merge commit which contains the - # |upstream_commit| in its message and is its children. - merge_parents = merge_common.GetCommandStdout([ - 'git', 'rev-list', reference, '--grep', upstream_commit, '--merges', - '--parents', '-1']) - if upstream_commit not in merge_parents: - raise merge_common.MergeError( - 'Found upstream commit %s, but the merge child (%s) could not be found ' - 'or is not a parent of the upstream SHA') - logging.debug('Found nearest Chromium revision %s', upstream_commit) - return upstream_commit - - -def _MergeWithRepoProp(repo_prop_file, target_branch, force): - """Performs a merge using a repo.prop file (from Android build waterfall). - - This does NOT merge (unless forced with force=True) the pinned - revisions in repo.prop, as a repo.prop can snapshot an intermediate state - (between two automerger cycles). Instead, this looks up the archived snapshot - (generated by the chromium->master-chromium auto-merger) which is closest to - the given repo.prop (following the main Chromium project) and merges that one. - If the projects revisions don't match, it fails with detailed error messages. - - Args: - repo_prop_file: Path to a downloaded repo.prop file. - target_branch: name of the target branch to merget to. - force: ignores the aforementioned check and merged anyways. - """ - chromium_sha = None - webview_sha = None - repo_shas = {} # 'project/path' -> 'sha' - with open(repo_prop_file) as prop: - for line in prop: - repo, sha = line.split() - # Translate the Android repo paths into the relative project paths used in - # merge_common (e.g., platform/external/chromium_org/foo -> foo). - m = ( - re.match(r'^platform/(frameworks/.+)$', repo) or - re.match(r'^platform/external/chromium_org/?(.*?)(-history)?$', repo)) - if m: - project = m.group(1) if m.group(1) else '.' # '.' = Main project. - repo_shas[project] = sha - - chromium_sha = repo_shas.get('.') - webview_sha = repo_shas.get(WEBVIEW_PROJECT) - if not chromium_sha or not webview_sha: - raise merge_common.MergeError('SHAs for projects not found; ' - 'invalid build.prop?') - - # Check that the revisions in repo.prop and the on in the archive match. - archived_chromium_revision = _GetNearestUpstreamAbbrevSHA(chromium_sha) - logging.info('Merging Chromium at %s and WebView at %s', - archived_chromium_revision, webview_sha) - _MergeChromiumProjects(archived_chromium_revision, target_branch, repo_shas, - force) - - _CheckoutSingleProject(WEBVIEW_PROJECT, target_branch) - _MergeSingleProject(WEBVIEW_PROJECT, webview_sha, - archived_chromium_revision, target_branch, flatten=False) - - -def Push(target_branch): - """Push the finished snapshot to the Android repository. - - Creates first a CL for frameworks/webview (if the merge-to-XXX branch exists) - then wait for user confirmation and pushes the Chromium merges. This is to - give an opportunity to get a +2 for frameworks/webview and then push both - frameworks/webview and the Chromium projects atomically(ish). - - Args: - target_branch: name of the target branch (in the goog remote). - """ - merge_branch = 'merge-to-%s' % target_branch - - # Create a Gerrit CL for the frameworks/webview project (if needed). - dest_dir = _GetAbsPath(WEBVIEW_PROJECT) - did_upload_webview_cl = False - if merge_common.GetCommandStdout(['git', 'branch', '--list', merge_branch], - cwd=dest_dir): - # Check that there was actually something to merge. - merge_range = 'goog/%s..%s' % (target_branch, merge_branch) - if merge_common.GetCommandStdout(['git', 'rev-list', '-1', merge_range], - cwd=dest_dir): - logging.info('Uploading a merge CL for %s...', WEBVIEW_PROJECT) - refspec = '%s:refs/for/%s' % (merge_branch, target_branch) - upload = merge_common.GetCommandStdout(['git', 'push', 'goog', refspec], - cwd=dest_dir) - logging.info(upload) - did_upload_webview_cl = True - - prompt_msg = 'About push the Chromium projects merge. ' - if not did_upload_webview_cl: - logging.info('No merge CL needed for %s.', WEBVIEW_PROJECT) - else: - prompt_msg += ('At this point you should have the CL +2-ed and merge it ' - 'together with this push.') - prompt_msg += '\nPress "y" to continue: ' - if raw_input(prompt_msg) != 'y': - logging.warn('Push aborted by the user!') - return - - logging.debug('Pushing Chromium projects to %s ...', target_branch) - refspec = '%s:%s' % (merge_branch, target_branch) - for path in merge_common.ALL_PROJECTS: - logging.debug('Pushing %s', path) - dest_dir = _GetAbsPath(path) - # Delete the graft before pushing otherwise git will attempt to push all the - # grafted-in objects to the server as well as the ones we want. - graftfile = os.path.join(dest_dir, '.git', 'info', 'grafts') - if os.path.exists(graftfile): - os.remove(graftfile) - merge_common.GetCommandStdout(['git', 'push', 'goog', refspec], - cwd=dest_dir) - - -def main(): - parser = optparse.OptionParser(usage='%prog [options]') - parser.epilog = ('Takes the current master-chromium branch of the Chromium ' - 'projects in Android and merges them into master to publish ' - 'them.') - parser.add_option( - '', '--revision', - default=None, - help=('Merge to the specified archived master-chromium revision (abbrev. ' - 'SHA or release version) rather than using HEAD. e.g., ' - '--revision=a1b2c3d4e5f6 or --revision=38.0.2125.24')) - parser.add_option( - '', '--repo-prop', - default=None, metavar='FILE', - help=('Merge to the revisions specified in this repo.prop file.')) - parser.add_option( - '', '--force', - default=False, action='store_true', - help=('Skip history checks and merged anyways (only for --repo-prop).')) - parser.add_option( - '', '--push', - default=False, action='store_true', - help=('Push the result of a previous merge to the server.')) - parser.add_option( - '', '--target', - default='master', metavar='BRANCH', - help=('Target branch to push to. Defaults to master.')) - (options, args) = parser.parse_args() - if args: - parser.print_help() - return 1 - - logging.basicConfig(format='%(message)s', level=logging.DEBUG, - stream=sys.stdout) - - if options.push: - Push(options.target) - elif options.repo_prop: - _MergeWithRepoProp(os.path.expanduser(options.repo_prop), - options.target, options.force) - elif options.revision: - _MergeChromiumProjects(options.revision, options.target) - else: - first_upstream_sha = _GetNearestUpstreamAbbrevSHA() - _MergeChromiumProjects(first_upstream_sha, options.target) - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/chromium/tools/run_webview_cts.py b/chromium/tools/run_webview_cts.py deleted file mode 100755 index 411fd9d..0000000 --- a/chromium/tools/run_webview_cts.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2012 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. - -""" -Executes WebView CTS tests and verifies results against known failures. -""" - -import re -import signal -import subprocess -import sys - -# Eventually this list will be empty! -# If you add or remove tests from this lists please update the CTS -# spreadsheet! -EXPECTED_FAILURES = set([ - 'android.webkit.cts.WebViewClientTest#testOnScaleChanged', - 'android.webkit.cts.WebViewTest#testCapturePicture', - # BUG=crbug.com/162967 - 'android.webkit.cts.WebViewTest#testPageScroll', - 'android.webkit.cts.WebViewTest#testRequestChildRectangleOnScreen', - 'android.webkit.cts.WebViewTest#testScrollBarOverlay', - 'android.webkit.cts.WebViewTest#testSetInitialScale', - 'android.webkit.cts.WebViewTest#testSetScrollBarStyle', - 'android.webkit.cts.WebViewTest#testSetWebViewClient', - 'android.webkit.cts.WebViewTest#testZoom', - # b/8763845 - 'android.webkit.cts.WebViewTest#testFindAll', - # b/8763944 - 'android.webkit.cts.WebViewTest#testGetContentHeight', - # See b/8231433 for Geolocation test failures. - 'android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptAlways', - 'android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestReject', - 'android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptOnce', - # b/9159785 - 'android.webkit.cts.WebViewTest#testFindNext', - # b/5006389 - 'android.webkit.cts.WebViewTest#testFlingScroll', - # b/9103603 - 'android.webkit.cts.WebViewTest#testRequestImageRef', - # b/9121594 - 'android.webkit.cts.WebHistoryItemTest#testWebHistoryItem', - # Don't forget to update the spreadsheet! :) -]) - -def main(): - proc = None - - # Send INT signal to test runner and exit gracefully so not to lose all - # output information in a run. - def handler(signum, frame): - if proc: - proc.send_signal(signum) - signal.signal(signal.SIGINT, handler) - - proc = subprocess.Popen( - ['cts-tradefed', 'run', 'singleCommand', 'cts', '-p', 'android.webkit', '--screenshot-on-failure'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - (stdout, stderr) = proc.communicate(); - - passes = set(re.findall(r'.*: (.*) PASS', stdout)) - failures = set(re.findall(r'.*: (.*) FAIL', stdout)) - test_results = '%d passes; %d failures' % (len(passes), len(failures)) - - unexpected_passes = EXPECTED_FAILURES.difference(failures) - if len(unexpected_passes) > 0: - test_results += '\n' + 'UNEXPECTED PASSES (update expectations!):' - for test in unexpected_passes: - test_results += '\n' + '\t%s' % (test) - - unexpected_failures = failures.difference(EXPECTED_FAILURES) - if len(unexpected_failures) > 0: - test_results += '\n' + 'UNEXPECTED FAILURES (please fix!):' - for test in unexpected_failures: - test_results += '\n' + '\t%s' % (test) - - unexpected_failures_count = len(unexpected_failures) - unexpected_passes_count = len(unexpected_passes) - - # on the buildbot this is most useful at the start - print test_results - - print '\nstdout dump follows...' - print stdout - print '\n' - - # on the cmd line this is most useful at the end - print test_results - - # Allow buildbot script to distinguish failures and possibly out of date - # test expectations. - if len(passes) + len(failures) < 100: - print 'Ran less than 100 cts tests? Something must be wrong' - return 2 - elif unexpected_failures_count > 0: - return 1 - elif unexpected_passes_count >= 5: - print ('More than 5 new passes? Either you''re running webview classic, or ' - 'it really is time to fix failure expectations.') - return 2 - elif unexpected_passes_count > 0: - return 3 # STEP_WARNINGS - else: - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/chromium/version.mk b/chromium/version.mk deleted file mode 100644 index fe4b6ae..0000000 --- a/chromium/version.mk +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright (C) 2014 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. -# - -# The current version code scheme for the package apk is: -# Mbbbba -# where -# M - Chromium milestone number minus 36. (1 or more digits). This is to -# ensure that our version codes are lower than the ones currently used by -# Chrome for Android, so that we can adopt their scheme in future. -# bbbb - manually specified build number (exactly 4 digits). This defaults to -# 0000, or 9999 in local builds. -# a - device architecture (exactly 1 digit). Current valid values are: -# 1 : armv7-a -# 2 : armv8-a (arm64) -# 4 : mips -# 7 : x86 -# 8 : x86_64 -# 64-bit architectures must be higher than their corresponding 32-bit -# architectures to ensure that 64-bit devices receive the multiarch APK. -# x86 must be higher than ARM to avoid x86 devices receiving ARM APKs -# and running them in emulation. - -# TODO(torne): get this from Chromium automatically. -version_milestone := 40 -version_offset_milestone := $(shell echo $(version_milestone) \ - | awk '{print $$1 - 36}') - -ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" - version_build_number := 9999 - # BUILD_NUMBER has a timestamp in it, which means that - # it will change every time. Pick a stable value. - version_name_tag := eng.$(USER) -else - ifeq "$(version_build_number)" "" - version_build_number := 0000 - endif - version_name_tag := $(BUILD_NUMBER) -endif - -ifeq "$(TARGET_ARCH)" "x86_64" - version_arch := 8 -else ifeq "$(TARGET_ARCH)" "x86" - version_arch := 7 -else ifeq "$(TARGET_ARCH)" "mips" - version_arch := 4 -else ifeq "$(TARGET_ARCH)" "arm64" - version_arch := 2 -else ifeq "$(TARGET_ARCH)" "arm" - version_arch := 1 -else - version_arch := 0 - $(warning Could not determine target architecture for versioning) -endif - -version_code := $(version_offset_milestone)$(version_build_number)$(version_arch) - -# Use the milestone, build number and architecture to construct a version -# name like "37 (1424323-arm64)". -# TODO(torne): get the full version number from Chromium. -version_name := $(version_milestone) ($(version_name_tag)-$(TARGET_ARCH)) - -# Clean up locals -version_milestone := -version_build_number := -version_name_tag := -version_arch := -- cgit v1.2.3