org.chromium.chrome.browser.tabmodel.TabWindowManager Java Examples
The following examples show how to use
org.chromium.chrome.browser.tabmodel.TabWindowManager.
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 |
@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: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@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 #3
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 5 votes |
@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 delion with Apache License 2.0 | 4 votes |
@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 #5
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@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 #6
Source File: TabWebContentsDelegateAndroid.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * When STOP button in the media capture notification is clicked, pass the event to native * to stop the media capture. */ public static void notifyStopped(int tabId) { final Tab tab = TabWindowManager.getInstance().getTabById(tabId); if (tab != null) nativeNotifyStopped(tab.getWebContents()); }
Example #7
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 4 votes |
@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"); } }
Example #8
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 4 votes |
/** * Determine whether the incognito profile needs to be destroyed as part of startup. This is * only needed on L+ when it is possible to swipe away tasks from Android recents without * killing the process. When this occurs, the normal incognito profile shutdown does not * happen, which can leave behind incognito cookies from an existing session. */ @SuppressLint("NewApi") private boolean shouldDestroyIncognitoProfile() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return false; Context context = ContextUtils.getApplicationContext(); ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); PackageManager pm = context.getPackageManager(); Set<Integer> tabbedModeTaskIds = new HashSet<>(); for (AppTask task : manager.getAppTasks()) { RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task); if (info == null) continue; String className = DocumentUtils.getTaskClassName(task, pm); if (isTabbedModeClassName(className)) { tabbedModeTaskIds.add(info.id); } } if (tabbedModeTaskIds.size() == 0) { return Profile.getLastUsedProfile().hasOffTheRecordProfile(); } List<WeakReference<Activity>> activities = ApplicationStatus.getRunningActivities(); for (int i = 0; i < activities.size(); i++) { Activity activity = activities.get(i).get(); if (activity == null) continue; tabbedModeTaskIds.remove(activity.getTaskId()); } // If all tabbed mode tasks listed in Android recents are alive, check to see if // any have incognito tabs exist. If all are alive and no tabs exist, we should ensure that // we delete the incognito profile if one is around still. if (tabbedModeTaskIds.size() == 0) { return TabWindowManager.getInstance().canDestroyIncognitoProfile() && Profile.getLastUsedProfile().hasOffTheRecordProfile(); } // In this case, we have tabbed mode activities listed in recents that do not have an // active running activity associated with them. We can not accurately get an incognito // tab count as we do not know if any incognito tabs are associated with the yet unrestored // tabbed mode. Thus we do not proactivitely destroy the incognito profile. return false; }
Example #9
Source File: TabWebContentsDelegateAndroid.java From 365browser with Apache License 2.0 | 4 votes |
/** * When STOP button in the media capture notification is clicked, pass the event to native * to stop the media capture. */ public static void notifyStopped(int tabId) { final Tab tab = TabWindowManager.getInstance().getTabById(tabId); if (tab != null) nativeNotifyStopped(tab.getWebContents()); }