OSDN Git Service

DO NOT MERGE Fix vanishing title/url in window picker
authorJohn Reck <jreck@google.com>
Thu, 12 May 2011 17:13:11 +0000 (10:13 -0700)
committerJohn Reck <jreck@google.com>
Thu, 12 May 2011 18:22:17 +0000 (11:22 -0700)
 Bug: 2289137
 This was caused by two bugs. The first is that when creating
 picker data from a webview, it created a new instance of picker
 data before checking if there was actually data to use.
 The second is that when the webview of a tab was restored, it would
 clear the old picker data, which it shouldn't have done.

Change-Id: Ib03a22e32d35f0f686dffc663adcbbddba28db9b

src/com/android/browser/Tab.java

index af0cdf8..6eaf4b1 100644 (file)
@@ -43,6 +43,7 @@ import android.os.Message;
 import android.os.SystemClock;
 import android.provider.Browser;
 import android.speech.RecognizerResultsIntent;
+import android.text.TextUtils;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -1862,8 +1863,8 @@ class Tab {
     // Populate the picker data using the given history item and the current top
     // WebView.
     private void populatePickerData(WebHistoryItem item) {
-        mPickerData = new PickerData();
-        if (item != null) {
+        if (item != null && !TextUtils.isEmpty(item.getUrl())) {
+            mPickerData = new PickerData();
             mPickerData.mUrl = item.getUrl();
             mPickerData.mTitle = item.getTitle();
             mPickerData.mFavicon = item.getFavicon();
@@ -1950,7 +1951,6 @@ class Tab {
         // Restore the internal state even if the WebView fails to restore.
         // This will maintain the app id, original url and close-on-exit values.
         mSavedState = null;
-        mPickerData = null;
         mCloseOnExit = b.getBoolean(CLOSEONEXIT);
         mAppId = b.getString(APPID);
         mOriginalUrl = b.getString(ORIGINALURL);