diff options
author | Axesh R. Ajmera <aajmera@codeaurora.org> | 2015-03-16 18:20:41 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2015-05-19 12:47:40 -0700 |
commit | e6b11aa976a40c135fe4abd57f7389ec8ea85135 (patch) | |
tree | 2bbd2ff4737b0b5f43ce69f73da2d7164ca4c313 /src/com/android | |
parent | b487d5d9ab5ddec76efb5c9dc48fa69259e3c06a (diff) | |
download | android_packages_apps_Gello-e6b11aa976a40c135fe4abd57f7389ec8ea85135.tar.gz android_packages_apps_Gello-e6b11aa976a40c135fe4abd57f7389ec8ea85135.tar.bz2 android_packages_apps_Gello-e6b11aa976a40c135fe4abd57f7389ec8ea85135.zip |
Restore Snapshot Tab feature
When tabs were getting killed the state
of the Snapshot Tab was not getting saved
or restored.
Change-Id: I7bddb045b15a7c23fd210158389cf779c633fba6
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/browser/SnapshotTab.java | 10 | ||||
-rw-r--r-- | src/com/android/browser/TabControl.java | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/com/android/browser/SnapshotTab.java b/src/com/android/browser/SnapshotTab.java index 7f87cf23..13e94b88 100644 --- a/src/com/android/browser/SnapshotTab.java +++ b/src/com/android/browser/SnapshotTab.java @@ -49,6 +49,10 @@ public class SnapshotTab extends Tab { private long mDateCreated; private boolean mIsLive; private String mLiveUrl; + private Bundle mSavedState; + + // Used for saving and restoring each Tab + static final String SNAPSHOT_ID = "snapshotId"; public SnapshotTab(WebViewController wvcontroller, long snapshotId) { super(wvcontroller, null, null); @@ -116,7 +120,11 @@ public class SnapshotTab extends Tab { if (mIsLive) { return super.saveState(); } - return null; + + mSavedState = new Bundle(); + mSavedState.putLong(SNAPSHOT_ID, mSnapshotId); + + return mSavedState; } public long getDateCreated() { diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java index 73c6a1ff..2488ec23 100644 --- a/src/com/android/browser/TabControl.java +++ b/src/com/android/browser/TabControl.java @@ -438,7 +438,15 @@ class TabControl { && state.getBoolean(Tab.INCOGNITO)) { // ignore tab } else if (id == currentId || restoreAll) { - Tab t = createNewTab(state, false); + Tab t = null; + // Add special check to restore Snapshot Tab if needed + if (state.getLong(SnapshotTab.SNAPSHOT_ID, -1) != -1 ) { + t = (SnapshotTab) createSnapshotTab( state.getLong(SnapshotTab.SNAPSHOT_ID) ); + } else { + // presume its a normal Tab + t = createNewTab(state, false); + } + if (t == null) { // We could "break" at this point, but we want // sNextId to be set correctly. |