Commit ffe2c7a6 authored by hush's avatar hush Committed by Commit bot

Make AndroidWebView shell init data reduction proxy from commandline

To enable data reduction proxy on the commandline, you need:

build/android/adb_android_webview_command_line --enable-spdy-proxy-auth
--spdy-proxy-auth-value=[your real key]

BUG=

Review URL: https://codereview.chromium.org/664243003

Cr-Commit-Position: refs/heads/master@{#300622}
parent 7d5f646b
...@@ -32,10 +32,12 @@ import org.chromium.android_webview.AwBrowserContext; ...@@ -32,10 +32,12 @@ import org.chromium.android_webview.AwBrowserContext;
import org.chromium.android_webview.AwBrowserProcess; import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.android_webview.AwContents; import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwContentsClient; import org.chromium.android_webview.AwContentsClient;
import org.chromium.android_webview.AwContentsStatics;
import org.chromium.android_webview.AwDevToolsServer; import org.chromium.android_webview.AwDevToolsServer;
import org.chromium.android_webview.AwSettings; import org.chromium.android_webview.AwSettings;
import org.chromium.android_webview.test.AwTestContainerView; import org.chromium.android_webview.test.AwTestContainerView;
import org.chromium.android_webview.test.NullContentsClient; import org.chromium.android_webview.test.NullContentsClient;
import org.chromium.base.CommandLine;
import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
...@@ -55,6 +57,11 @@ public class AwShellActivity extends Activity { ...@@ -55,6 +57,11 @@ public class AwShellActivity extends Activity {
private ImageButton mPrevButton; private ImageButton mPrevButton;
private ImageButton mNextButton; private ImageButton mNextButton;
// This is the same as data_reduction_proxy::switches::kEnableDataReductionProxy.
private static final String ENABLE_DATA_REDUCTION_PROXY = "enable-spdy-proxy-auth";
// This is the same as data_reduction_proxy::switches::kDataReductionProxyKey.
private static final String DATA_REDUCTION_PROXY_KEY = "spdy-proxy-auth-value";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -82,6 +89,14 @@ public class AwShellActivity extends Activity { ...@@ -82,6 +89,14 @@ public class AwShellActivity extends Activity {
mAwTestContainerView.getAwContents().loadUrl(new LoadUrlParams(startupUrl)); mAwTestContainerView.getAwContents().loadUrl(new LoadUrlParams(startupUrl));
AwContents.setShouldDownloadFavicons(); AwContents.setShouldDownloadFavicons();
mUrlTextView.setText(startupUrl); mUrlTextView.setText(startupUrl);
if (CommandLine.getInstance().hasSwitch(ENABLE_DATA_REDUCTION_PROXY)) {
String key = CommandLine.getInstance().getSwitchValue(DATA_REDUCTION_PROXY_KEY);
if (key != null && !key.isEmpty()) {
AwContentsStatics.setDataReductionProxyKey(key);
AwContentsStatics.setDataReductionProxyEnabled(true);
}
}
} }
private AwTestContainerView createAwTestContainerView() { private AwTestContainerView createAwTestContainerView() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment