From: Serg Date: Tue, 31 Jan 2017 22:12:27 -0500 Subject: Add exit menu item Corrected Exit functionality License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- chrome/android/java/res/menu/main_menu.xml | 6 ++++++ .../org/chromium/chrome/browser/ApplicationLifetime.java | 2 ++ .../org/chromium/chrome/browser/ChromeTabbedActivity.java | 4 ++++ .../src/org/chromium/chrome/browser/app/ChromeActivity.java | 6 ++++++ .../chrome/browser/init/ChromeLifetimeController.java | 6 +++++- .../browser/ui/android/strings/android_chrome_strings.grd | 3 +++ 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml --- a/chrome/android/java/res/menu/main_menu.xml +++ b/chrome/android/java/res/menu/main_menu.xml @@ -163,6 +163,9 @@ found in the LICENSE file. + @@ -189,6 +192,9 @@ found in the LICENSE file. + diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java b/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java --- a/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java @@ -6,6 +6,7 @@ package org.chromium.chrome.browser; import org.chromium.base.ObserverList; import org.chromium.base.annotations.CalledByNative; +import org.chromium.chrome.browser.incognito.IncognitoNotificationManager; /** * Watches for when Chrome is told to restart itself. @@ -42,6 +43,7 @@ public class ApplicationLifetime { @CalledByNative public static void terminate(boolean restart) { + IncognitoNotificationManager.dismissIncognitoNotification(); for (Observer observer : sObservers) { observer.onTerminate(restart); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java @@ -236,6 +236,8 @@ import java.util.Locale; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import org.chromium.chrome.browser.ApplicationLifetime; + /** * This is the main activity for ChromeMobile when not running in document mode. All the tabs * are accessible via a chrome specific tab switching UI. @@ -2271,6 +2273,8 @@ public class ChromeTabbedActivity extends ChromeActivity return true; } + if (id == R.id.exit_id) { + ApplicationLifetime.terminate(false); + return true; + } + if (id == R.id.update_menu_id) { UpdateMenuItemHelper.getInstance().onMenuItemClicked(this); return true; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java --- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java @@ -82,7 +82,11 @@ class ChromeLifetimeController implements ApplicationLifetime.Observer, // Kick off a timer to kill the process after a delay, which fires only if the Activities // take too long to be finished. - mHandler.postDelayed(mRestartRunnable, WATCHDOG_DELAY_MS); + if (restart) { + mHandler.postDelayed(mRestartRunnable, WATCHDOG_DELAY_MS); + } else { + fireBrowserRestartActivityIntent(); + } } @Override diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -3859,6 +3859,9 @@ To change this setting, <resetlink>reset sync

Dark theme + + Exit + Appearance -- 2.25.1