Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2417)

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java

Issue 1399613002: Public glue layer plumbing for View#startActivityForResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
index 8348baa56fc4be8a83f2ba67f62f1c058227fd62..50fc24217123a8e4c4e80b56d70599bebfa585ca 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
@@ -8,6 +8,7 @@ import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.assist.AssistStructure.ViewNode;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -62,6 +63,7 @@ import org.chromium.content_public.browser.NavigationHistory;
import java.io.BufferedWriter;
import java.io.File;
+import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Map;
import java.util.Queue;
@@ -1750,6 +1752,21 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
mAwContents.setLayoutParams(layoutParams);
}
+ // Overrides WebViewProvider.ViewDelegate.onActivityResult (not in system api jar yet).
+ // crbug.com/543272.
+ public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
+ if (checkNeedsPost()) {
+ mRunQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ onActivityResult(requestCode, resultCode, data);
+ }
+ });
+ return;
+ }
+ mAwContents.onActivityResult(requestCode, resultCode, data);
+ }
+
@Override
public boolean performLongClick() {
// Return false unless the WebView is attached to a View with a parent
@@ -2245,6 +2262,19 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
}
@Override
+ public void super_startActivityForResult(Intent intent, int requestCode) {
+ // TODO(hush): Use mWebViewPrivate.super_startActivityForResult
+ // after N release. crbug.com/543272.
+ try {
+ Method startActivityForResultMethod =
+ View.class.getMethod("startActivityForResult", Intent.class, int.class);
+ startActivityForResultMethod.invoke(mWebView, intent, requestCode);
+ } catch (Exception e) {
+ throw new RuntimeException("Invalid reflection", e);
+ }
+ }
+
+ @Override
public boolean awakenScrollBars() {
mWebViewPrivate.awakenScrollBars(0);
// TODO: modify the WebView.PrivateAccess to provide a return value.
« no previous file with comments | « android_webview/apk/java/proguard.flags ('k') | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698