org.chromium.content.browser.crypto.CipherFactory Java Examples

The following examples show how to use org.chromium.content.browser.crypto.CipherFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    CipherFactory.getInstance().saveToBundle(outState);
    outState.putBoolean("is_incognito_selected", getCurrentTabModel().isIncognito());
    outState.putBoolean(FRE_RUNNING, mIsOnFirstRun);
    outState.putInt(WINDOW_INDEX,
            TabWindowManager.getInstance().getIndexForWindow(this));
}
 
Example #2
Source File: CipherKeyActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        CipherFactory.getInstance().restoreFromBundle(savedInstanceState);
    }
    Intent nextIntent = (Intent) getIntent().getParcelableExtra(FORWARD_INTENT);
    if (nextIntent != null) {
        startActivity(nextIntent, (Bundle) getIntent().getParcelableExtra(FORWARD_OPTIONS));
    }
}
 
Example #3
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    CipherFactory.getInstance().saveToBundle(outState);
    outState.putBoolean("is_incognito_selected", getCurrentTabModel().isIncognito());
    outState.putBoolean(FRE_RUNNING, mIsOnFirstRun);
    outState.putInt(WINDOW_INDEX,
            TabWindowManager.getInstance().getIndexForWindow(this));
}
 
Example #4
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    CipherFactory.getInstance().saveToBundle(outState);
    outState.putBoolean("is_incognito_selected", getCurrentTabModel().isIncognito());
    outState.putBoolean(FRE_RUNNING, mIsOnFirstRun);
    outState.putInt(WINDOW_INDEX,
            TabWindowManager.getInstance().getIndexForWindow(this));
}
 
Example #5
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeState() {
    // This method goes through 3 steps:
    // 1. Load the saved tab state (but don't start restoring the tabs yet).
    // 2. Process the Intent that this activity received and if that should result in any
    //    new tabs, create them.  This is done after step 1 so that the new tab gets
    //    created after previous tab state was restored.
    // 3. If no tabs were created in any of the above steps, create an NTP, otherwise
    //    start asynchronous tab restore (loading the previously active tab synchronously
    //    if no new tabs created in step 2).

    // Only look at the original intent if this is not a "restoration" and we are allowed to
    // process intents. Any subsequent intents are carried through onNewIntent.
    try {
        TraceEvent.begin("ChromeTabbedActivity.initializeState");

        super.initializeState();

        Intent intent = getIntent();

        CipherFactory.getInstance().restoreFromBundle(getSavedInstanceState());

        boolean noRestoreState =
                CommandLine.getInstance().hasSwitch(ChromeSwitches.NO_RESTORE_STATE);
        if (noRestoreState) {
            // Clear the state files because they are inconsistent and useless from now on.
            mTabModelSelectorImpl.clearState();
        } else if (!mIsOnFirstRun) {
            // State should be clear when we start first run and hence we do not need to load
            // a previous state. This may change the current Model, watch out for initialization
            // based on the model.
            mTabModelSelectorImpl.loadState();
        }

        mIntentWithEffect = false;
        if ((mIsOnFirstRun || getSavedInstanceState() == null) && intent != null
                && !mIntentHandler.shouldIgnoreIntent(ChromeTabbedActivity.this, intent)) {
            mIntentWithEffect = mIntentHandler.onNewIntent(ChromeTabbedActivity.this, intent);
        }

        mCreatedTabOnStartup = getCurrentTabModel().getCount() > 0
                || mTabModelSelectorImpl.getRestoredTabCount() > 0
                || mIntentWithEffect;

        // We always need to try to restore tabs. The set of tabs might be empty, but at least
        // it will trigger the notification that tab restore is complete which is needed by
        // other parts of Chrome such as sync.
        boolean activeTabBeingRestored = !mIntentWithEffect;
        mTabModelSelectorImpl.restoreTabs(activeTabBeingRestored);

        // Only create an initial tab if no tabs were restored and no intent was handled.
        // Also, check whether the active tab was supposed to be restored and that the total
        // tab count is now non zero.  If this is not the case, tab restore failed and we need
        // to create a new tab as well.
        if (!mCreatedTabOnStartup
                || (activeTabBeingRestored && getTabModelSelector().getTotalTabCount() == 0)) {
            // If homepage URI is not determined, due to PartnerBrowserCustomizations provider
            // async reading, then create a tab at the async reading finished. If it takes
            // too long, just create NTP.
            PartnerBrowserCustomizations.setOnInitializeAsyncFinished(
                    new Runnable() {
                        @Override
                        public void run() {
                            createInitialTab();
                        }
                    }, INITIAL_TAB_CREATION_TIMEOUT_MS);
        }

        RecordHistogram.recordBooleanHistogram(
                "MobileStartup.ColdStartupIntent", mIntentWithEffect);
    } finally {
        TraceEvent.end("ChromeTabbedActivity.initializeState");
    }
}
 
Example #6
Source File: CipherKeyActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    CipherFactory.getInstance().saveToBundle(outState);
}
 
Example #7
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeState() {
    // This method goes through 3 steps:
    // 1. Load the saved tab state (but don't start restoring the tabs yet).
    // 2. Process the Intent that this activity received and if that should result in any
    //    new tabs, create them.  This is done after step 1 so that the new tab gets
    //    created after previous tab state was restored.
    // 3. If no tabs were created in any of the above steps, create an NTP, otherwise
    //    start asynchronous tab restore (loading the previously active tab synchronously
    //    if no new tabs created in step 2).

    // Only look at the original intent if this is not a "restoration" and we are allowed to
    // process intents. Any subsequent intents are carried through onNewIntent.
    try {
        TraceEvent.begin("ChromeTabbedActivity.initializeState");

        super.initializeState();

        Intent intent = getIntent();

        boolean hadCipherData =
                CipherFactory.getInstance().restoreFromBundle(getSavedInstanceState());

        boolean noRestoreState =
                CommandLine.getInstance().hasSwitch(ChromeSwitches.NO_RESTORE_STATE);
        if (noRestoreState) {
            // Clear the state files because they are inconsistent and useless from now on.
            mTabModelSelectorImpl.clearState();
        } else if (!mIsOnFirstRun) {
            // State should be clear when we start first run and hence we do not need to load
            // a previous state. This may change the current Model, watch out for initialization
            // based on the model.
            // Never attempt to restore incognito tabs when this activity was previously swiped
            // away in Recents. http://crbug.com/626629
            boolean ignoreIncognitoFiles = !hadCipherData;
            mTabModelSelectorImpl.loadState(ignoreIncognitoFiles);
        }

        mIntentWithEffect = false;
        if ((mIsOnFirstRun || getSavedInstanceState() == null) && intent != null) {
            if (mVrShellDelegate.isVrIntent(intent)) {
                // TODO(mthiesse): Improve startup when started from a VR intent. Right now
                // we launch out of VR, partially load out of VR, then switch into VR.
                mVrShellDelegate.enterVRIfNecessary();
            } else if (!mIntentHandler.shouldIgnoreIntent(ChromeTabbedActivity.this, intent)) {
                mIntentWithEffect = mIntentHandler.onNewIntent(ChromeTabbedActivity.this,
                        intent);
            }
        }

        mCreatedTabOnStartup = getCurrentTabModel().getCount() > 0
                || mTabModelSelectorImpl.getRestoredTabCount() > 0
                || mIntentWithEffect;

        // We always need to try to restore tabs. The set of tabs might be empty, but at least
        // it will trigger the notification that tab restore is complete which is needed by
        // other parts of Chrome such as sync.
        boolean activeTabBeingRestored = !mIntentWithEffect;
        mTabModelSelectorImpl.restoreTabs(activeTabBeingRestored);

        // Only create an initial tab if no tabs were restored and no intent was handled.
        // Also, check whether the active tab was supposed to be restored and that the total
        // tab count is now non zero.  If this is not the case, tab restore failed and we need
        // to create a new tab as well.
        if (!mCreatedTabOnStartup
                || (activeTabBeingRestored && getTabModelSelector().getTotalTabCount() == 0)) {
            // If homepage URI is not determined, due to PartnerBrowserCustomizations provider
            // async reading, then create a tab at the async reading finished. If it takes
            // too long, just create NTP.
            PartnerBrowserCustomizations.setOnInitializeAsyncFinished(
                    new Runnable() {
                        @Override
                        public void run() {
                            createInitialTab();
                        }
                    }, INITIAL_TAB_CREATION_TIMEOUT_MS);
        }

        RecordHistogram.recordBooleanHistogram(
                "MobileStartup.ColdStartupIntent", mIntentWithEffect);
    } finally {
        TraceEvent.end("ChromeTabbedActivity.initializeState");
    }
}