Skip to content

Commit

Permalink
[Hera] Excise a bunch of document mode code
Browse files Browse the repository at this point in the history
Deprecated document mode code is hindering efforts to refactor
other classes.  Excise as much DocumentActivity related code
as possible in one swoop so that it's easy to find later, if
for some reason it's needed.

* Force all users entering DocumentActivity through the migration
  pathway without checking if they're in document mode.  There
  should be no valid way to trigger a DocumentActivity, short of
  being inside Recents when migration is completed and reselecting
  an old Document tab.

* Delete practically everything inside the DocumentActivity class
  to make it easier to determine dead dependencies in classes that
  are being refactored.

* Delete all DocumentActivity-launching related functions from
  ChromeLauncherActivity, and things that spiral out from there.

* Delete most of the document mode tests.

* Deletes a bunch of DocumentTabModel related code.  Migration
  pathways still seem to be intact.

BUG=582539

Review-Url: https://codereview.chromium.org/2011433003
Cr-Commit-Position: refs/heads/master@{#396062}
  • Loading branch information
dfalcantara authored and Commit bot committed May 26, 2016
1 parent 4c34ac5 commit 35eb7ce
Show file tree
Hide file tree
Showing 32 changed files with 71 additions and 6,064 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.device.DeviceClassManager;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.document.DocumentUma;
import org.chromium.chrome.browser.firstrun.FirstRunActivity;
import org.chromium.chrome.browser.firstrun.FirstRunFlowSequencer;
import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor;
Expand Down Expand Up @@ -378,10 +377,6 @@ public void onStartWithNative() {
if (getActivityTab() == null) mLayoutManager.showOverview(false);

resetSavedInstanceState();

if (FeatureUtilities.isDocumentModeEligible(this)) {
DocumentUma.recordInDocumentMode(false);
}
}

@Override
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,8 @@

package org.chromium.chrome.browser.document;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;

import org.chromium.chrome.browser.cookies.CookiesFetcher;
import org.chromium.chrome.browser.incognito.IncognitoNotificationManager;
import org.chromium.content.browser.crypto.CipherFactory;
import org.chromium.content.browser.crypto.CipherFactory.CipherDataObserver;

/**
* {@link DocumentActivity} for incognito tabs.
* Deprecated, but kept around because it was exported in Chrome's Manifest.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class IncognitoDocumentActivity extends DocumentActivity {
/**
* Responsible for observing when cipher data generation is complete and saving
* the new cipher data in the CipherKeyActivity.
*/
private static class CipherKeySaver implements CipherDataObserver {
private final Context mContext;

public CipherKeySaver(Context context) {
mContext = context;
CipherFactory.getInstance().addCipherDataObserver(this);
}

@Override
public void onCipherDataGenerated() {
mContext.startActivity(
CipherKeyActivity.createIntent(mContext, null, null));
CipherFactory.getInstance().removeCipherDataObserver(this);
}
}

private static CipherKeySaver sCipherKeySaver;

private static void maybeCreateCipherKeySaver(Context context) {
if (sCipherKeySaver == null && !CipherFactory.getInstance().hasCipher()) {
sCipherKeySaver = new CipherKeySaver(context);
}
}

@Override
protected boolean isIncognito() {
return true;
}

@Override
public void preInflationStartup() {
CipherFactory.getInstance().restoreFromBundle(getSavedInstanceState());
maybeCreateCipherKeySaver(this);
super.preInflationStartup();
}

@Override
public void onResume() {
super.onResume();
IncognitoNotificationManager.showIncognitoNotification();
}

@Override
public void onResumeWithNative() {
super.onResumeWithNative();
CookiesFetcher.restoreCookies(this);
}

@Override
public void onPauseWithNative() {
CookiesFetcher.persistCookies(this);
super.onPauseWithNative();
}

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
CipherFactory.getInstance().saveToBundle(outState);

// Save out the URL that was originally used to spawn this activity because we don't pass it
// in through the Intent.
String initialUrl = determineInitialUrl(determineTabId());
outState.putString(KEY_INITIAL_URL, initialUrl);
}

@Override
protected String determineInitialUrl(int tabId) {
// Check if the URL was saved in the Bundle.
if (getSavedInstanceState() != null) {
String initialUrl = getSavedInstanceState().getString(KEY_INITIAL_URL);
if (initialUrl != null) return initialUrl;
}

return super.determineInitialUrl(tabId);
}
}
Loading

0 comments on commit 35eb7ce

Please sign in to comment.