Prevent webview reuse
Bug: 4742007
Bug: 4770356
Also pipe all loadUrl's through Tab so that it can immediately
update its internal state. This is necessary as javascript:
uris do not cause onPageStarted/finished callbacks to happen,
thus the url and title of the Tab do not update.
Change-Id: I6d17e8627db505eaa9158339fdfc7afd2c6672a2
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 58a7491..bc5868f 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -20,14 +20,12 @@
import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.ContentResolver;
-import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.graphics.Bitmap;
-import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.net.http.SslError;
@@ -69,11 +67,6 @@
import com.android.common.speech.LoggingEvents;
import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -1861,7 +1854,6 @@
return null;
}
byte[] data = stream.toByteArray();
- ContentResolver cr = mActivity.getContentResolver();
ContentValues values = new ContentValues();
values.put(Snapshots.TITLE, mCurrentState.mTitle);
values.put(Snapshots.URL, mCurrentState.mUrl);
@@ -1870,4 +1862,12 @@
return values;
}
+ public void loadUrl(String url, Map<String, String> headers) {
+ if (mMainView != null) {
+ mCurrentState = new PageState(mActivity, false, url, null);
+ mWebViewController.onPageStarted(this, mMainView, null);
+ mMainView.loadUrl(url, headers);
+ }
+ }
+
}