From b92ed3043a8c1d9c2c068a31b14c5373576d02d2 Mon Sep 17 00:00:00 2001 From: Marcin Kosiba Date: Mon, 20 Oct 2014 18:25:05 +0100 Subject: Hook up WebView.onScrollChanged This hooks up WebView.onScrollChanged to the coresponding AwContents method. We have defensive code in AwContents to sync scroll offset because many apps override onScrollChanged without calling super.onScrollChanged and so we ended up not noticing this was never hooked up. Change-Id: I09f9cb21808fc9229bbbe498d8d9b5400fe3c6b5 --- .../java/com/android/webview/chromium/WebViewChromium.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'chromium/java/com/android/webview') diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java index a6111aa..ef2bf7c 100644 --- a/chromium/java/com/android/webview/chromium/WebViewChromium.java +++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java @@ -1872,7 +1872,17 @@ class WebViewChromium implements WebViewProvider, } @Override - public void onScrollChanged(int l, int t, int oldl, int oldt) { + 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.onContainerViewScrolled(l, t, oldl, oldt); } @Override -- cgit v1.2.3 From f730607b461c2e789fda9bb9b05386a53ecb4338 Mon Sep 17 00:00:00 2001 From: Hui Shu Date: Wed, 3 Sep 2014 11:17:31 -0700 Subject: Suport initializing DRP from cmd line switches. If there is a command line switch to enable the data reduction proxy, we will try to initialize the DRP by reading the DRP key from command line. If the key from command line is empty, use the key embedded in WebView apk. BUG: 17211028 Change-Id: I496b0d8a9dcd1763d4bbf2065e2d9e996ba6e873 (cherry picked from commit e41c9c1d9c3bf72381f8e0acd62bd17346bf1d7e) (cherry picked from commit ca3ebe61951d92501599e3120c0fd30b0d7264de) --- .../chromium/DataReductionProxyManager.java | 41 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'chromium/java/com/android/webview') diff --git a/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java b/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java index 7fe449c..32006bf 100644 --- a/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java +++ b/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java @@ -33,6 +33,7 @@ import android.util.Log; import android.webkit.WebView; import org.chromium.android_webview.AwContentsStatics; +import org.chromium.base.CommandLine; import java.lang.reflect.Field; @@ -51,6 +52,11 @@ public final class DataReductionProxyManager { private static final String DRP_CLASS = "com.android.webview.chromium.Drp"; private static final String TAG = "DataReductionProxySettingListener"; + // This is the same as Chromium data_reduction_proxy::switches::kEnableDataReductionProxy. + private static final String ENABLE_DATA_REDUCTION_PROXY = "enable-spdy-proxy-auth"; + // This is the same as Chromium data_reduction_proxy::switches::kDataReductionProxyKey. + private static final String DATA_REDUCTION_PROXY_KEY = "spdy-proxy-auth-value"; + /* * Listen for DataReductionProxySetting changes and take action. * TODO: This is the old mechanism. Will be obsolete after L release. @@ -77,20 +83,45 @@ public final class DataReductionProxyManager { public DataReductionProxyManager() { } public void start(final Context context) { - final String key = readKey(); - if (key == null || key.isEmpty()) { + // This is the DRP key embedded in WebView apk. + final String embeddedKey = readKey(); + + // Developers could test DRP by passing ENABLE_DATA_REDUCTION_PROXY and (optionally) + // DATA_REDUCTION_PROXY_KEY to the commandline switches. In this case, we will try to + // initialize DRP from commandline. And ignore user's preference. If + // DATA_REDUCTION_PROXY_KEY is specified in commandline, use it. Otherwise, use the key + // embedded in WebView apk. + CommandLine cl = CommandLine.getInstance(); + if (cl.hasSwitch(ENABLE_DATA_REDUCTION_PROXY)) { + String key = cl.getSwitchValue(DATA_REDUCTION_PROXY_KEY, embeddedKey); + if (key == null || key.isEmpty()) { + return; + } + + // Now we will enable DRP because we've got a commandline switch to enable it. + // We won't listen to Google Settings preference change because commandline switches + // trump that. + AwContentsStatics.setDataReductionProxyKey(key); + AwContentsStatics.setDataReductionProxyEnabled(true); return; } - applyDataReductionProxySettingsAsync(context, key); + + // Now, there is no commandline switches to enable DRP, and reading the + // DRP key from WebView apk failed. Just return and leave DRP disabled. + if (embeddedKey == null || embeddedKey.isEmpty()) { + return; + } + + applyDataReductionProxySettingsAsync(context, embeddedKey); IntentFilter filter = new IntentFilter(); filter.addAction(WebView.DATA_REDUCTION_PROXY_SETTING_CHANGED); - mProxySettingListener = new ProxySettingListener(key); + mProxySettingListener = new ProxySettingListener(embeddedKey); context.registerReceiver(mProxySettingListener, filter); ContentResolver resolver = context.getContentResolver(); mProxySettingObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange, Uri uri) { - applyDataReductionProxySettingsAsync(context, key); + applyDataReductionProxySettingsAsync(context, embeddedKey); } }; resolver.registerContentObserver( -- cgit v1.2.3 From 89b33e2103cee15b08a31a48b379b846bc690891 Mon Sep 17 00:00:00 2001 From: Marcin Kosiba Date: Mon, 20 Oct 2014 18:25:05 +0100 Subject: Fix typo in WebViewChromium.onScrollChanged Change-Id: Id265d12cb981673f404440d808c9d8f51185c89b --- chromium/java/com/android/webview/chromium/WebViewChromium.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chromium/java/com/android/webview') diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java index ef2bf7c..a5b31b3 100644 --- a/chromium/java/com/android/webview/chromium/WebViewChromium.java +++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java @@ -1882,7 +1882,7 @@ class WebViewChromium implements WebViewProvider, }); return; } - mAwContents.onContainerViewScrolled(l, t, oldl, oldt); + mAwContents.onContainerViewScrollChanged(l, t, oldl, oldt); } @Override -- cgit v1.2.3