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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.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/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 7962c18db76aa5b7efe6e365bd0caab65a0b06b0..347400d2c2559bb8398e6453c1acd7e8422ee0a1 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -8,6 +8,7 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentCallbacks2;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -151,6 +152,11 @@ public class AwContents implements SmartClipProvider,
* @see View#getScrollBarStyle()
*/
int super_getScrollBarStyle();
+
+ /**
+ * @see View#startActivityForResult(Intent, int)
+ */
+ void super_startActivityForResult(Intent intent, int requestCode);
}
/**
@@ -2169,6 +2175,22 @@ public class AwContents implements SmartClipProvider,
// View and ViewGroup method implementations
//--------------------------------------------------------------------------------------------
+ public void startActivityForResult(Context context, Intent intent, int requestCode) {
+ if (ContentViewCore.activityFromContext(context) == null) {
+ // View#startActivityForResult will throw a RuntimeException if the
+ // view context is not an activity.
+ // If WebView is not created with an activity context, use startActivity instead.
+ context.startActivity(intent);
sgurun-gerrit only 2015/10/14 17:40:13 how is this even supposed to work? startActivityFo
hush (inactive) 2015/10/14 21:33:59 Because the view context is not activity, startAct
sgurun-gerrit only 2015/10/14 23:08:01 Nop, I don't agree. This is a general purpose meth
hush (inactive) 2015/10/15 01:38:06 This if-statement is to address the case of firing
+ }
+
+ mInternalAccessAdapter.super_startActivityForResult(intent, requestCode);
+ }
+
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ // TODO(hush): Forward the activity result to content view core and
+ // replace the text with translated text.
sgurun-gerrit only 2015/10/14 17:40:13 you will implement this in a follow up cl right af
hush (inactive) 2015/10/14 21:33:59 Yes. I have it in https://codereview.chromium.org/
+ }
+
/**
* @see android.webkit.View#onTouchEvent()
*/

Powered by Google App Engine
This is Rietveld 408576698