mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 721341 - Get zombie tab thumbnails from database. r=blassey
This commit is contained in:
parent
24d618f1de
commit
080d09ed44
@ -40,6 +40,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.FloatSize;
|
||||
import org.mozilla.gecko.gfx.GeckoSoftwareLayerClient;
|
||||
import org.mozilla.gecko.gfx.IntSize;
|
||||
@ -596,6 +597,13 @@ abstract public class GeckoApp
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos);
|
||||
processThumbnail(tab, bitmap, bos.toByteArray());
|
||||
} else {
|
||||
if (!tab.hasLoaded()) {
|
||||
byte[] thumbnail = BrowserDB.getThumbnailForUrl(getContentResolver(), tab.getURL());
|
||||
if (thumbnail != null)
|
||||
processThumbnail(tab, null, thumbnail);
|
||||
return;
|
||||
}
|
||||
|
||||
mLastScreen = null;
|
||||
int sw = forceBigSceenshot ? mSoftwareLayerClient.getWidth() : tab.getMinScreenshotWidth();
|
||||
int sh = forceBigSceenshot ? mSoftwareLayerClient.getHeight(): tab.getMinScreenshotHeight();
|
||||
@ -1290,6 +1298,7 @@ abstract public class GeckoApp
|
||||
return;
|
||||
|
||||
tab.updateTitle(title);
|
||||
tab.setHasLoaded(true);
|
||||
|
||||
// Make the UI changes
|
||||
mMainHandler.post(new Runnable() {
|
||||
|
@ -83,6 +83,7 @@ public final class Tab {
|
||||
private String mContentType;
|
||||
private boolean mHasTouchListeners;
|
||||
private ArrayList<View> mPluginViews;
|
||||
private boolean mHasLoaded;
|
||||
|
||||
public static final class HistoryEntry {
|
||||
public String mUri; // must never be null
|
||||
@ -116,6 +117,7 @@ public final class Tab {
|
||||
mDocumentURI = "";
|
||||
mContentType = "";
|
||||
mPluginViews = new ArrayList<View>();
|
||||
mHasLoaded = false;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
@ -436,6 +438,14 @@ public final class Tab {
|
||||
return mDoorHangers;
|
||||
}
|
||||
|
||||
public void setHasLoaded(boolean hasLoaded) {
|
||||
mHasLoaded = hasLoaded;
|
||||
}
|
||||
|
||||
public boolean hasLoaded() {
|
||||
return mHasLoaded;
|
||||
}
|
||||
|
||||
void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
|
||||
if (event.equals("New")) {
|
||||
final String uri = message.getString("uri");
|
||||
|
@ -277,6 +277,8 @@ public class Tabs implements GeckoEventListener {
|
||||
Tab tab = addTab(message);
|
||||
if (message.getBoolean("selected"))
|
||||
selectTab(tab.getId());
|
||||
if (message.getBoolean("delayLoad"))
|
||||
tab.setHasLoaded(false);
|
||||
} else if (event.equals("Tab:Close")) {
|
||||
Tab tab = getTab(message.getInt("tabID"));
|
||||
closeTab(tab);
|
||||
|
@ -1440,7 +1440,8 @@ Tab.prototype = {
|
||||
parentId: ("parentId" in aParams) ? aParams.parentId : -1,
|
||||
external: ("external" in aParams) ? aParams.external : false,
|
||||
selected: ("selected" in aParams) ? aParams.selected : true,
|
||||
title: aParams.title || ""
|
||||
title: aParams.title || "",
|
||||
delayLoad: aParams.delayLoad || false
|
||||
}
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
|
Loading…
Reference in New Issue
Block a user