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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 353163002: [Android] Switch to Gin Java Bridge implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed AwSettingsTest#testBlockNetworkLoadsWithAudio Created 6 years, 5 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
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 849748947ff8d4483adc2a52e7e68b20061a551f..14fc683ce2a3b04029329860664ce9e8a6287645 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -23,6 +23,7 @@ import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Pair;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -804,6 +805,13 @@ public class AwContents {
if (wasAttached) onDetachedFromWindow();
if (!wasPaused) onPause();
+ // Save injected JavaScript interfaces.
+ Map<String, Pair<Object, Class>> javascriptInterfaces =
+ new HashMap<String, Pair<Object, Class>>();
+ if (mContentViewCore != null) {
+ javascriptInterfaces.putAll(mContentViewCore.getJavascriptInterfaces());
+ }
+
setNewAwContents(popupNativeAwContents);
// Finally refresh all view state for mContentViewCore and mNativeAwContents.
@@ -817,6 +825,14 @@ public class AwContents {
if (wasViewVisible) setViewVisibilityInternal(true);
if (wasWindowFocused) onWindowFocusChanged(wasWindowFocused);
if (wasFocused) onFocusChanged(true, 0, null);
+
+ // Restore injected JavaScript interfaces.
+ for (Map.Entry<String, Pair<Object, Class>> entry : javascriptInterfaces.entrySet()) {
+ mContentViewCore.addPossiblyUnsafeJavascriptInterface(
+ entry.getValue().first,
+ entry.getKey(),
+ entry.getValue().second);
+ }
}
/**
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698