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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 2520103002: Delete tab state files when the user explicitly closes a CCT. (Closed)
Patch Set: Created 4 years, 1 month 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 | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicy.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
index 2bb8fcdf6ac225dbcf7d8f2230c3ed8f8f12394a..d5d54de75482625f17da8da12748f5ef685271b9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -64,7 +64,6 @@ import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModelObserver;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl;
-import org.chromium.chrome.browser.tabmodel.TabPersistencePolicy;
import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.util.UrlUtilities;
@@ -98,6 +97,7 @@ public class CustomTabActivity extends ChromeActivity {
private CustomTabContentHandler mCustomTabContentHandler;
private Tab mMainTab;
private CustomTabBottomBarDelegate mBottomBarDelegate;
+ private CustomTabTabPersistencePolicy mTabPersistencePolicy;
// This is to give the right package name while using the client's resources during an
// overridePendingTransition call.
@@ -341,10 +341,10 @@ public class CustomTabActivity extends ChromeActivity {
@Override
protected TabModelSelector createTabModelSelector() {
- TabPersistencePolicy persistencePolicy = new CustomTabTabPersistencePolicy(
+ mTabPersistencePolicy = new CustomTabTabPersistencePolicy(
getTaskId(), getSavedInstanceState() != null);
- return new TabModelSelectorImpl(this, this, persistencePolicy, false, false);
+ return new TabModelSelectorImpl(this, this, mTabPersistencePolicy, false, false);
}
@Override
@@ -600,7 +600,12 @@ public class CustomTabActivity extends ChromeActivity {
public void onStopWithNative() {
super.onStopWithNative();
setActiveContentHandler(null);
- if (!mIsClosing) getTabModelSelector().saveState();
+ if (mIsClosing) {
+ getTabModelSelector().closeAllTabs(true);
+ mTabPersistencePolicy.deleteMetadataStateFileAsync();
+ } else {
+ getTabModelSelector().saveState();
+ }
}
/**
@@ -862,6 +867,14 @@ public class CustomTabActivity extends ChromeActivity {
}
/**
+ * @return The tab persistence policy for this activity.
+ */
+ @VisibleForTesting
+ CustomTabTabPersistencePolicy getTabPersistencePolicyForTest() {
+ return mTabPersistencePolicy;
+ }
+
+ /**
* Opens the URL currently being displayed in the Custom Tab in the regular browser.
* @param forceReparenting Whether tab reparenting should be forced for testing.
*
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicy.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698