Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5064)

Unified Diff: chrome/browser/resources/settings/route.js

Issue 2442843002: Override SigninManager::SignOut if force-signin is enabled. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/route.js
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js
index a8bb749454d4a28f21bf5da618ec7e5ff77d0bba..e988f8ef25de849246af1b6a9d8566478f11c732 100644
--- a/chrome/browser/resources/settings/route.js
+++ b/chrome/browser/resources/settings/route.js
@@ -334,16 +334,23 @@ cr.define('settings', function() {
};
/**
- * Navigates to the previous route if it has an equal or lesser depth.
- * If there is no previous route in history meeting those requirements,
- * this navigates to the immediate parent. This will never exit Settings.
+ * Return true if the previous route exsited in the history and has an equal
+ * or lesser depth. Otherwise, return false.
*/
- var navigateToPreviousRoute = function() {
+ var isPreviousRouteExistedInHistory = function() {
var previousRoute =
window.history.state &&
assert(getRouteForPath(/** @type {string} */ (window.history.state)));
+ return previousRoute && previousRoute.depth <= currentRoute_.depth;
+ };
- if (previousRoute && previousRoute.depth <= currentRoute_.depth)
+ /**
+ * Navigates to the previous route if it has an equal or lesser depth.
+ * If there is no previous route in history meeting those requirements,
+ * this navigates to the immediate parent. This will never exit Settings.
+ */
+ var navigateToPreviousRoute = function() {
+ if (isPreviousRouteExistedInHistory())
tommycli 2016/11/02 18:46:57 I'm sorry - but I just don't think this is a good
window.history.back();
else
navigateTo(currentRoute_.parent || Route.BASIC);
@@ -364,6 +371,7 @@ cr.define('settings', function() {
getQueryParameters: getQueryParameters,
lastRouteChangeWasPopstate: lastRouteChangeWasPopstate,
navigateTo: navigateTo,
+ isPreviousRouteExistedInHistory: isPreviousRouteExistedInHistory,
navigateToPreviousRoute: navigateToPreviousRoute,
};
});

Powered by Google App Engine
This is Rietveld 408576698