| 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; |
| 11 import android.os.Bundle; | 11 import android.os.Bundle; |
| 12 import android.text.TextUtils; | 12 import android.text.TextUtils; |
| 13 import android.view.ActionMode; | |
| 14 import android.view.Gravity; | 13 import android.view.Gravity; |
| 15 import android.view.KeyEvent; | 14 import android.view.KeyEvent; |
| 16 import android.view.View; | 15 import android.view.View; |
| 17 import android.view.View.OnClickListener; | 16 import android.view.View.OnClickListener; |
| 18 import android.view.View.OnFocusChangeListener; | 17 import android.view.View.OnFocusChangeListener; |
| 19 import android.view.ViewGroup; | 18 import android.view.ViewGroup; |
| 20 import android.view.ViewGroup.LayoutParams; | 19 import android.view.ViewGroup.LayoutParams; |
| 21 import android.view.WindowManager; | 20 import android.view.WindowManager; |
| 22 import android.view.inputmethod.EditorInfo; | 21 import android.view.inputmethod.EditorInfo; |
| 23 import android.view.inputmethod.InputMethodManager; | 22 import android.view.inputmethod.InputMethodManager; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 import org.chromium.android_webview.AwContentsStatics; | 35 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.Log; | 42 import org.chromium.base.Log; |
| 44 import org.chromium.base.TraceEvent; | 43 import org.chromium.base.TraceEvent; |
| 45 import org.chromium.content.app.ContentApplication; | 44 import org.chromium.content.app.ContentApplication; |
| 46 import org.chromium.content.browser.WebActionMode; | |
| 47 import org.chromium.content.browser.WebActionModeCallback; | |
| 48 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; | |
| 49 import org.chromium.content_public.browser.LoadUrlParams; | 45 import org.chromium.content_public.browser.LoadUrlParams; |
| 50 import org.chromium.content_public.browser.NavigationController; | 46 import org.chromium.content_public.browser.NavigationController; |
| 51 import org.chromium.content_public.browser.WebContents; | 47 import org.chromium.content_public.browser.WebContents; |
| 52 | 48 |
| 53 import java.net.URI; | 49 import java.net.URI; |
| 54 import java.net.URISyntaxException; | 50 import java.net.URISyntaxException; |
| 55 | 51 |
| 56 /** | 52 /** |
| 57 * This is a lightweight activity for tests that only require WebView functional
ity. | 53 * This is a lightweight activity for tests that only require WebView functional
ity. |
| 58 */ | 54 */ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 mCustomView = null; | 154 mCustomView = null; |
| 159 } | 155 } |
| 160 | 156 |
| 161 @Override | 157 @Override |
| 162 public boolean shouldOverrideKeyEvent(KeyEvent event) { | 158 public boolean shouldOverrideKeyEvent(KeyEvent event) { |
| 163 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { | 159 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { |
| 164 return true; | 160 return true; |
| 165 } | 161 } |
| 166 return false; | 162 return false; |
| 167 } | 163 } |
| 168 | |
| 169 @Override | |
| 170 public WebActionMode startActionMode( | |
| 171 View view, ActionHandler actionHandler, boolean floating) { | |
| 172 if (floating) return null; | |
| 173 ActionMode.Callback callback = | |
| 174 new WebActionModeCallback(view.getContext(), actionHandl
er); | |
| 175 ActionMode actionMode = view.startActionMode(callback); | |
| 176 return actionMode != null ? new WebActionMode(actionMode) : null
; | |
| 177 } | |
| 178 }; | 164 }; |
| 179 | 165 |
| 180 SharedPreferences sharedPreferences = | 166 SharedPreferences sharedPreferences = |
| 181 getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); | 167 getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); |
| 182 if (mBrowserContext == null) { | 168 if (mBrowserContext == null) { |
| 183 mBrowserContext = new AwBrowserContext(sharedPreferences); | 169 mBrowserContext = new AwBrowserContext(sharedPreferences); |
| 184 } | 170 } |
| 185 final AwSettings awSettings = new AwSettings(this /*context*/, | 171 final AwSettings awSettings = new AwSettings(this /*context*/, |
| 186 false /*isAccessFromFileURLsGrantedByDefault*/, false /*supports
LegacyQuirks*/); | 172 false /*isAccessFromFileURLsGrantedByDefault*/, false /*supports
LegacyQuirks*/); |
| 187 // Required for WebGL conformance tests. | 173 // Required for WebGL conformance tests. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 281 } |
| 296 | 282 |
| 297 private void waitForDebuggerIfNeeded() { | 283 private void waitForDebuggerIfNeeded() { |
| 298 if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUG
GER)) { | 284 if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUG
GER)) { |
| 299 Log.e(TAG, "Waiting for Java debugger to connect..."); | 285 Log.e(TAG, "Waiting for Java debugger to connect..."); |
| 300 android.os.Debug.waitForDebugger(); | 286 android.os.Debug.waitForDebugger(); |
| 301 Log.e(TAG, "Java debugger connected. Resuming execution."); | 287 Log.e(TAG, "Java debugger connected. Resuming execution."); |
| 302 } | 288 } |
| 303 } | 289 } |
| 304 } | 290 } |
| OLD | NEW |