| Index: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java
|
| index db0b9ce59501e3e9c102f21b01d4a8f8094fbd03..2b385527e6dd9a9321061310384afef5751acc89 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentMigrationHelper.java
|
| @@ -39,6 +39,7 @@ import org.chromium.chrome.browser.favicon.FaviconHelper;
|
| import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback;
|
| import org.chromium.chrome.browser.ntp.NativePageFactory;
|
| import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
|
| +import org.chromium.chrome.browser.preferences.DocumentModeManager;
|
| import org.chromium.chrome.browser.profiles.Profile;
|
| import org.chromium.chrome.browser.tab.Tab;
|
| import org.chromium.chrome.browser.tab.TabIdManager;
|
| @@ -506,16 +507,19 @@ public class DocumentMigrationHelper {
|
| tabModel.addEntryForMigration(entry);
|
| }
|
|
|
| -
|
| /**
|
| * Migrates tabs with state to and from document mode.
|
| * @param toDocumentMode Whether the user is opting out. If true the migration is from Document
|
| * to Classic mode.
|
| - * @param activity The activity to use for launching intent if needed.
|
| + * @param activity The activity to use for {@link DocumentModeManager} state update and
|
| + * launching intent if needed.
|
| * @param terminate Whether the application process should be terminated after the migration.
|
| */
|
| public static void migrateTabs(boolean toDocumentMode, final Activity activity,
|
| boolean terminate) {
|
| + DocumentModeManager documentModeManager = DocumentModeManager.getInstance(activity);
|
| + documentModeManager.setOptOutCleanUpPending(true);
|
| +
|
| // Allowing StrictMode violations as above. See http://crbug.com/493157 for context.
|
| StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
| StrictMode.allowThreadDiskWrites();
|
| @@ -523,8 +527,11 @@ public class DocumentMigrationHelper {
|
| int terminateMode =
|
| terminate ? FINALIZE_MODE_RESTART_APP : FINALIZE_MODE_FINISH_ACTIVITY;
|
| if (toDocumentMode) {
|
| + documentModeManager.setOptedOutState(DocumentModeManager.OPT_OUT_PROMO_DISMISSED);
|
| migrateTabsFromClassicToDocument(activity, terminateMode);
|
| } else {
|
| + documentModeManager.setOptedOutState(
|
| + DocumentModeManager.OPTED_OUT_OF_DOCUMENT_MODE);
|
| migrateTabsFromDocumentToClassic(activity, terminateMode);
|
| }
|
| } finally {
|
|
|