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

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 94e67dd841d38323afd7ef20022ac23056bb297f..b595014982120415d817c5653056d317ef48f78e 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
@@ -6,6 +6,7 @@ package com.android.webview.chromium;
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;
@@ -60,6 +61,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;
@@ -1746,6 +1748,20 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
mAwContents.setLayoutParams(layoutParams);
}
+ // Overrides WebViewProvider.ViewDelegate.onActivityResult (not in system api jar yet).
sgurun-gerrit only 2015/10/16 00:06:53 add this to cleanup crbug.
hush (inactive) 2015/10/20 23:16:09 Done.
+ 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
@@ -2240,6 +2256,20 @@ 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
+ assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
sgurun-gerrit only 2015/10/16 00:06:53 nit: I don't think java asserts are functional.
Torne 2015/10/16 12:49:40 Yeah, don't use asserts, they are off by default b
hush (inactive) 2015/10/20 23:16:09 Ok. I just deleted it.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698