Java Code Examples for org.chromium.chrome.browser.incognito.IncognitoNotificationManager#dismissIncognitoNotification()

The following examples show how to use org.chromium.chrome.browser.incognito.IncognitoNotificationManager#dismissIncognitoNotification() . 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: DocumentModeAssassin.java    From delion with Apache License 2.0 6 votes vote down vote up
/** Moves the user to tabbed mode by opting them out and removing all the tasks. */
final void switchToTabbedMode() {
    ThreadUtils.assertOnUiThread();
    if (!setStage(STAGE_WRITE_TABMODEL_METADATA_DONE, STAGE_CHANGE_SETTINGS_STARTED)) return;

    // Record that the user has opted-out of document mode now that their data has been
    // safely copied to the other directory.
    Log.d(TAG, "Setting tabbed mode preference.");
    clearOptedOutState();
    TabSwitcherCallout.setIsTabSwitcherCalloutNecessary(getContext(), true);

    // Remove all the {@link DocumentActivity} tasks from Android's Recents list.  Users
    // viewing Recents during migration will continue to see their tabs until they exit.
    // Reselecting a migrated tab will kick the user to the launcher without crashing.
    // TODO(dfalcantara): Confirm that the different Android flavors work the same way.
    createActivityDelegate().finishAllDocumentActivities();

    // Dismiss the "Close all incognito tabs" notification.
    IncognitoNotificationManager.dismissIncognitoNotification();

    setStage(STAGE_CHANGE_SETTINGS_STARTED, STAGE_CHANGE_SETTINGS_DONE);
}
 
Example 2
Source File: OffTheRecordTabModel.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Destroys the Incognito profile when all Incognito tabs have been closed.  Also resets the
 * delegate TabModel to be a stub EmptyTabModel.
 */
protected void destroyIncognitoIfNecessary() {
    ThreadUtils.assertOnUiThread();
    if (!isEmpty() || mDelegateModel instanceof EmptyTabModel || mIsAddingTab) {
        return;
    }

    Profile profile = getProfile();
    mDelegateModel.destroy();

    // Only delete the incognito profile if there are no incognito tabs open in any tab
    // model selector as the profile is shared between them.
    if (profile != null && !mDelegate.doOffTheRecordTabsExist()) {
        IncognitoNotificationManager.dismissIncognitoNotification();

        profile.destroyWhenAppropriate();
    }

    mDelegateModel = EmptyTabModel.getInstance();
}
 
Example 3
Source File: IncognitoTabModel.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Destroys the Incognito profile when all Incognito tabs have been closed.  Also resets the
 * delegate TabModel to be a stub EmptyTabModel.
 */
protected void destroyIncognitoIfNecessary() {
    ThreadUtils.assertOnUiThread();
    if (!isEmpty() || mDelegateModel instanceof EmptyTabModel || mIsAddingTab) {
        return;
    }

    Profile profile = getProfile();
    mDelegateModel.destroy();

    // Only delete the incognito profile if there are no incognito tabs open in any tab
    // model selector as the profile is shared between them.
    if (profile != null && !mDelegate.doIncognitoTabsExist()) {
        IncognitoNotificationManager.dismissIncognitoNotification();

        profile.destroyWhenAppropriate();
    }

    mDelegateModel = EmptyTabModel.getInstance();
}
 
Example 4
Source File: DocumentModeAssassin.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/** Moves the user to tabbed mode by opting them out and removing all the tasks. */
final void switchToTabbedMode() {
    ThreadUtils.assertOnUiThread();
    if (!setStage(STAGE_WRITE_TABMODEL_METADATA_DONE, STAGE_CHANGE_SETTINGS_STARTED)) return;

    // Record that the user has opted-out of document mode now that their data has been
    // safely copied to the other directory.
    Log.d(TAG, "Setting tabbed mode preference.");
    setOptedOutState(OPTED_OUT_OF_DOCUMENT_MODE);
    TabSwitcherCallout.setIsTabSwitcherCalloutNecessary(getContext(), true);

    // Remove all the {@link DocumentActivity} tasks from Android's Recents list.  Users
    // viewing Recents during migration will continue to see their tabs until they exit.
    // Reselecting a migrated tab will kick the user to the launcher without crashing.
    // TODO(dfalcantara): Confirm that the different Android flavors work the same way.
    createActivityDelegate().finishAllDocumentActivities();

    // Dismiss the "Close all incognito tabs" notification.
    IncognitoNotificationManager.dismissIncognitoNotification();

    setStage(STAGE_CHANGE_SETTINGS_STARTED, STAGE_CHANGE_SETTINGS_DONE);
}
 
Example 5
Source File: IncognitoTabModel.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Destroys the Incognito profile when all Incognito tabs have been closed.  Also resets the
 * delegate TabModel to be a stub EmptyTabModel.
 */
protected void destroyIncognitoIfNecessary() {
    ThreadUtils.assertOnUiThread();
    if (!isEmpty() || mDelegateModel instanceof EmptyTabModel || mIsAddingTab
            || mIsPendingTabAdd) {
        return;
    }

    Profile profile = getProfile();
    mDelegateModel.destroy();

    // Only delete the incognito profile if there are no incognito tabs open in any tab
    // model selector as the profile is shared between them.
    if (profile != null && !mDelegate.doIncognitoTabsExist()) {
        IncognitoNotificationManager.dismissIncognitoNotification();

        profile.destroyWhenAppropriate();
    }

    mDelegateModel = EmptyTabModel.getInstance();
}
 
Example 6
Source File: DocumentModeAssassin.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/** Moves the user to tabbed mode by opting them out and removing all the tasks. */
final void switchToTabbedMode() {
    ThreadUtils.assertOnUiThread();
    if (!setStage(STAGE_WRITE_TABMODEL_METADATA_DONE, STAGE_CHANGE_SETTINGS_STARTED)) return;

    // Record that the user has opted-out of document mode now that their data has been
    // safely copied to the other directory.
    Log.d(TAG, "Setting tabbed mode preference.");
    setOptedOutState(OPTED_OUT_OF_DOCUMENT_MODE);
    TabSwitcherCallout.setIsTabSwitcherCalloutNecessary(true);

    // Remove all the {@link DocumentActivity} tasks from Android's Recents list.  Users
    // viewing Recents during migration will continue to see their tabs until they exit.
    // Reselecting a migrated tab will kick the user to the launcher without crashing.
    // TODO(dfalcantara): Confirm that the different Android flavors work the same way.
    createActivityDelegate().finishAllDocumentActivities();

    // Dismiss the "Close all incognito tabs" notification.
    IncognitoNotificationManager.dismissIncognitoNotification();

    setStage(STAGE_CHANGE_SETTINGS_STARTED, STAGE_CHANGE_SETTINGS_DONE);
}
 
Example 7
Source File: OffTheRecordDocumentTabModel.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void destroyIncognitoIfNecessary() {
    super.destroyIncognitoIfNecessary();
    if (!mActivityDelegate.isIncognitoDocumentAccessibleToUser()) {
        IncognitoNotificationManager.dismissIncognitoNotification();
    }
}
 
Example 8
Source File: IncognitoDocumentTabModel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void destroyIncognitoIfNecessary() {
    super.destroyIncognitoIfNecessary();
    if (!mActivityDelegate.isIncognitoDocumentAccessibleToUser()) {
        IncognitoNotificationManager.dismissIncognitoNotification();
    }
}
 
Example 9
Source File: IncognitoDocumentTabModel.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void destroyIncognitoIfNecessary() {
    super.destroyIncognitoIfNecessary();
    if (!mActivityDelegate.isIncognitoDocumentAccessibleToUser()) {
        IncognitoNotificationManager.dismissIncognitoNotification();
    }
}
 
Example 10
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void finishNativeInitialization() {
    try {
        TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");

        launchFirstRunExperience();

        ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this);
        // Promos can only be shown when we start with ACTION_MAIN intent and
        // after FRE is complete.
        if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete(this)) {
            // Only show promos on the second oppurtunity. This is because we show FRE on the
            // first oppurtunity, and we don't want to show such content back to back.
            if (preferenceManager.getPromosSkippedOnFirstStart()) {
                // Data reduction promo should be temporarily suppressed if the sign in promo is
                // shown to avoid nagging users too much.
                if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
                    DataReductionPromoScreen.launchDataReductionPromo(this);
                }
            } else {
                preferenceManager.setPromosSkippedOnFirstStart(true);
            }
        }

        refreshSignIn();

        initializeUI();

        // The dataset has already been created, we need to initialize our state.
        mTabModelSelectorImpl.notifyChanged();

        getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
                Window.PROGRESS_VISIBILITY_OFF);

        // Check for incognito tabs to handle the case where Chrome was swiped away in the
        // background.
        int incognitoCount = TabWindowManager.getInstance().getIncognitoTabCount();
        if (incognitoCount == 0) IncognitoNotificationManager.dismissIncognitoNotification();

        super.finishNativeInitialization();
    } finally {
        TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
    }
}
 
Example 11
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void finishNativeInitialization() {
    try {
        TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");

        launchFirstRunExperience();

        refreshSignIn();

        ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this);
        // Promos can only be shown when we start with ACTION_MAIN intent and
        // after FRE is complete.
        if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete()) {
            // Only show promos on the second oppurtunity. This is because we show FRE on the
            // first oppurtunity, and we don't want to show such content back to back.
            if (preferenceManager.getPromosSkippedOnFirstStart()) {
                // Data reduction promo should be temporarily suppressed if the sign in promo is
                // shown to avoid nagging users too much.
                if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
                    DataReductionPromoScreen.launchDataReductionPromo(this);
                }
            } else {
                preferenceManager.setPromosSkippedOnFirstStart(true);
            }

            // Notify users experimenting with WebAPKs if they need to do extra steps to enable
            // WebAPKs.
            ChromeWebApkHost.launchWebApkRequirementsDialogIfNeeded(this);
        }

        initializeUI();

        // The dataset has already been created, we need to initialize our state.
        mTabModelSelectorImpl.notifyChanged();

        getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
                Window.PROGRESS_VISIBILITY_OFF);

        // Check for incognito tabs to handle the case where Chrome was swiped away in the
        // background.
        int incognitoCount = TabWindowManager.getInstance().getIncognitoTabCount();
        if (incognitoCount == 0) IncognitoNotificationManager.dismissIncognitoNotification();

        // LocaleManager can only function after the native library is loaded.
        mLocaleManager = LocaleManager.getInstance();
        mLocaleManager.showSearchEnginePromoIfNeeded(this);

        super.finishNativeInitialization();
    } finally {
        TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
    }
}
 
Example 12
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void finishNativeInitialization() {
    try {
        TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");

        refreshSignIn();

        initializeUI();

        // The dataset has already been created, we need to initialize our state.
        mTabModelSelectorImpl.notifyChanged();

        ApiCompatibilityUtils.setWindowIndeterminateProgress(getWindow());

        // Check for incognito tabs to handle the case where Chrome was swiped away in the
        // background.
        if (TabWindowManager.getInstance().canDestroyIncognitoProfile()) {
            IncognitoNotificationManager.dismissIncognitoNotification();
        }

        // LocaleManager can only function after the native library is loaded.
        mLocaleManager = LocaleManager.getInstance();
        boolean searchEnginePromoShown =
                mLocaleManager.showSearchEnginePromoIfNeeded(this, null);

        ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance();
        // Promos can only be shown when we start with ACTION_MAIN intent and
        // after FRE is complete. Native initialization can finish before the FRE flow is
        // complete, and this will only show promos on the second opportunity. This is
        // because the FRE is shown on the first opportunity, and we don't want to show such
        // content back to back.
        if (!searchEnginePromoShown && !mIntentWithEffect
                && FirstRunStatus.getFirstRunFlowComplete()
                && preferenceManager.getPromosSkippedOnFirstStart()) {
            // Data reduction promo should be temporarily suppressed if the sign in promo is
            // shown to avoid nagging users too much.
            if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
                DataReductionPromoScreen.launchDataReductionPromo(this);
            }
        } else {
            preferenceManager.setPromosSkippedOnFirstStart(true);
        }

        super.finishNativeInitialization();
    } finally {
        TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
    }
}