diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-10-27 14:57:39 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-10-27 14:57:39 +0000 |
commit | b60534d5e551871dc3724de4ed1da98b2cc5bee3 (patch) | |
tree | 6d4fd7e5ffae632b073d214d65cc04231775b969 /chromium/java | |
parent | bfcff7200dd1986b8ab61565e7f598410e3304fb (diff) | |
parent | 89b33e2103cee15b08a31a48b379b846bc690891 (diff) | |
download | webview-b60534d5e551871dc3724de4ed1da98b2cc5bee3.tar.gz |
Merge master-chromium into master at 614f7b807940
This commit was generated by merge_to_master.py.
Change-Id: Ieb34abff7c3789e7b41ef995d9b65c9d9932dc7f
Diffstat (limited to 'chromium/java')
-rw-r--r-- | chromium/java/com/android/webview/chromium/DataReductionProxyManager.java | 41 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromium.java | 12 |
2 files changed, 47 insertions, 6 deletions
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( diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java index e29c3d3..34a6660 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.onContainerViewScrollChanged(l, t, oldl, oldt); } @Override |