Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| index 69d11cf978e8029adf93e805b3e2ad632d3cddc1..935ba9bbb7968b56c6d62d1475940b13de62df0a 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| @@ -9,6 +9,7 @@ import android.annotation.TargetApi; |
| import android.app.Activity; |
| import android.app.SearchManager; |
| import android.content.ClipboardManager; |
| +import android.content.ContentResolver; |
| import android.content.Context; |
| import android.content.ContextWrapper; |
| import android.content.Intent; |
| @@ -102,10 +103,8 @@ import java.util.Map.Entry; |
| * being tied to the view system. |
| */ |
| @JNINamespace("content") |
| -public class ContentViewCore implements |
| - AccessibilityStateChangeListener, ScreenOrientationObserver, |
| - SystemCaptioningBridge.SystemCaptioningBridgeListener { |
| - |
| +public class ContentViewCore implements AccessibilityStateChangeListener, ScreenOrientationObserver, |
| + SystemCaptioningBridge.SystemCaptioningBridgeListener { |
| private static final String TAG = "cr.ContentViewCore"; |
| // Used to avoid enabling zooming in / out if resulting zooming will |
| @@ -2091,7 +2090,19 @@ public class ContentViewCore implements |
| intent.putExtra(Intent.EXTRA_PROCESS_TEXT, query); |
| try { |
| - getContext().startActivity(intent); |
| + if (getContentViewClient().doesPerformProcessText()) { |
| + getContentViewClient().startProcessTextIntent(intent); |
| + } else { |
| + getWindowAndroid().showIntent( |
| + intent, new WindowAndroid.IntentCallback() { |
| + @Override |
| + public void onIntentCompleted(WindowAndroid window, |
| + int resultCode, ContentResolver contentResolver, |
| + Intent data) { |
| + onReceivedProcessTextResult(resultCode, data); |
| + } |
| + }, null); |
| + } |
| } catch (android.content.ActivityNotFoundException ex) { |
| // If no app handles it, do nothing. |
| } |
| @@ -3044,6 +3055,16 @@ public class ContentViewCore implements |
| settings.getTextTrackTextShadow(), settings.getTextTrackTextSize()); |
| } |
| + public void onReceivedProcessTextResult(int resultCode, Intent data) { |
|
jdduke (slow)
2015/10/22 00:43:56
Javadoc, definitely need some description here of
hush (inactive)
2015/10/22 19:27:37
Done.
|
| + if (mActionMode == null) return; |
|
jdduke (slow)
2015/10/22 00:43:56
Can you do a sanity check that this works OK with
hush (inactive)
2015/10/22 19:27:37
Yeah.. I just found that it does not always work o
|
| + if (resultCode == Activity.RESULT_OK && data != null) { |
| + CharSequence result = data.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT); |
| + if (result != null && isSelectionEditable()) { |
| + mWebContents.replace(result.toString()); |
| + } |
| + } |
| + } |
| + |
| /** |
| * Returns true if accessibility is on and touch exploration is enabled. |
| */ |