| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview.shell; | 5 package org.chromium.android_webview.shell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 import android.widget.FrameLayout; | 26 import android.widget.FrameLayout; |
| 27 import android.widget.ImageButton; | 27 import android.widget.ImageButton; |
| 28 import android.widget.LinearLayout; | 28 import android.widget.LinearLayout; |
| 29 import android.widget.TextView; | 29 import android.widget.TextView; |
| 30 import android.widget.TextView.OnEditorActionListener; | 30 import android.widget.TextView.OnEditorActionListener; |
| 31 | 31 |
| 32 import org.chromium.android_webview.AwBrowserContext; | 32 import org.chromium.android_webview.AwBrowserContext; |
| 33 import org.chromium.android_webview.AwBrowserProcess; | 33 import org.chromium.android_webview.AwBrowserProcess; |
| 34 import org.chromium.android_webview.AwContents; | 34 import org.chromium.android_webview.AwContents; |
| 35 import org.chromium.android_webview.AwContentsClient; | 35 import org.chromium.android_webview.AwContentsClient; |
| 36 import org.chromium.android_webview.AwContentsStatics; | |
| 37 import org.chromium.android_webview.AwDevToolsServer; | 36 import org.chromium.android_webview.AwDevToolsServer; |
| 38 import org.chromium.android_webview.AwSettings; | 37 import org.chromium.android_webview.AwSettings; |
| 39 import org.chromium.android_webview.test.AwTestContainerView; | 38 import org.chromium.android_webview.test.AwTestContainerView; |
| 40 import org.chromium.android_webview.test.NullContentsClient; | 39 import org.chromium.android_webview.test.NullContentsClient; |
| 41 import org.chromium.base.BaseSwitches; | 40 import org.chromium.base.BaseSwitches; |
| 42 import org.chromium.base.CommandLine; | 41 import org.chromium.base.CommandLine; |
| 43 import org.chromium.base.ContextUtils; | 42 import org.chromium.base.ContextUtils; |
| 44 import org.chromium.base.Log; | 43 import org.chromium.base.Log; |
| 45 import org.chromium.base.TraceEvent; | 44 import org.chromium.base.TraceEvent; |
| 46 import org.chromium.content.app.ContentApplication; | 45 import org.chromium.content.app.ContentApplication; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 private static final String INITIAL_URL = "about:blank"; | 58 private static final String INITIAL_URL = "about:blank"; |
| 60 private AwBrowserContext mBrowserContext; | 59 private AwBrowserContext mBrowserContext; |
| 61 private AwDevToolsServer mDevToolsServer; | 60 private AwDevToolsServer mDevToolsServer; |
| 62 private AwTestContainerView mAwTestContainerView; | 61 private AwTestContainerView mAwTestContainerView; |
| 63 private WebContents mWebContents; | 62 private WebContents mWebContents; |
| 64 private NavigationController mNavigationController; | 63 private NavigationController mNavigationController; |
| 65 private EditText mUrlTextView; | 64 private EditText mUrlTextView; |
| 66 private ImageButton mPrevButton; | 65 private ImageButton mPrevButton; |
| 67 private ImageButton mNextButton; | 66 private ImageButton mNextButton; |
| 68 | 67 |
| 69 // This is the same as data_reduction_proxy::switches::kEnableDataReductionP
roxy. | |
| 70 private static final String ENABLE_DATA_REDUCTION_PROXY = "enable-spdy-proxy
-auth"; | |
| 71 // This is the same as data_reduction_proxy::switches::kDataReductionProxyKe
y. | |
| 72 private static final String DATA_REDUCTION_PROXY_KEY = "spdy-proxy-auth-valu
e"; | |
| 73 | |
| 74 @Override | 68 @Override |
| 75 public void onCreate(Bundle savedInstanceState) { | 69 public void onCreate(Bundle savedInstanceState) { |
| 76 super.onCreate(savedInstanceState); | 70 super.onCreate(savedInstanceState); |
| 77 | 71 |
| 78 AwShellResourceProvider.registerResources(this); | 72 AwShellResourceProvider.registerResources(this); |
| 79 | 73 |
| 80 ContentApplication.initCommandLine(this); | 74 ContentApplication.initCommandLine(this); |
| 81 waitForDebuggerIfNeeded(); | 75 waitForDebuggerIfNeeded(); |
| 82 | 76 |
| 83 ContextUtils.initApplicationContext(getApplicationContext()); | 77 ContextUtils.initApplicationContext(getApplicationContext()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 initializeNavigationButtons(); | 98 initializeNavigationButtons(); |
| 105 | 99 |
| 106 String startupUrl = getUrlFromIntent(getIntent()); | 100 String startupUrl = getUrlFromIntent(getIntent()); |
| 107 if (TextUtils.isEmpty(startupUrl)) { | 101 if (TextUtils.isEmpty(startupUrl)) { |
| 108 startupUrl = INITIAL_URL; | 102 startupUrl = INITIAL_URL; |
| 109 } | 103 } |
| 110 | 104 |
| 111 mAwTestContainerView.getAwContents().loadUrl(startupUrl); | 105 mAwTestContainerView.getAwContents().loadUrl(startupUrl); |
| 112 AwContents.setShouldDownloadFavicons(); | 106 AwContents.setShouldDownloadFavicons(); |
| 113 mUrlTextView.setText(startupUrl); | 107 mUrlTextView.setText(startupUrl); |
| 114 | |
| 115 if (CommandLine.getInstance().hasSwitch(ENABLE_DATA_REDUCTION_PROXY)) { | |
| 116 String key = CommandLine.getInstance().getSwitchValue(DATA_REDUCTION
_PROXY_KEY); | |
| 117 if (key != null && !key.isEmpty()) { | |
| 118 AwContentsStatics.setDataReductionProxyKey(key); | |
| 119 AwContentsStatics.setDataReductionProxyEnabled(true); | |
| 120 } | |
| 121 } | |
| 122 } | 108 } |
| 123 | 109 |
| 124 @Override | 110 @Override |
| 125 public void onDestroy() { | 111 public void onDestroy() { |
| 126 if (mDevToolsServer != null) { | 112 if (mDevToolsServer != null) { |
| 127 mDevToolsServer.destroy(); | 113 mDevToolsServer.destroy(); |
| 128 mDevToolsServer = null; | 114 mDevToolsServer = null; |
| 129 } | 115 } |
| 130 super.onDestroy(); | 116 super.onDestroy(); |
| 131 } | 117 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 286 } |
| 301 | 287 |
| 302 private void waitForDebuggerIfNeeded() { | 288 private void waitForDebuggerIfNeeded() { |
| 303 if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUG
GER)) { | 289 if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUG
GER)) { |
| 304 Log.e(TAG, "Waiting for Java debugger to connect..."); | 290 Log.e(TAG, "Waiting for Java debugger to connect..."); |
| 305 android.os.Debug.waitForDebugger(); | 291 android.os.Debug.waitForDebugger(); |
| 306 Log.e(TAG, "Java debugger connected. Resuming execution."); | 292 Log.e(TAG, "Java debugger connected. Resuming execution."); |
| 307 } | 293 } |
| 308 } | 294 } |
| 309 } | 295 } |
| OLD | NEW |