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

Unified Diff: chrome/browser/resources/file_manager/common/js/util.js

Issue 144783002: Simplify directory initialization in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 6 years, 11 months 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/file_manager/common/js/util.js
diff --git a/chrome/browser/resources/file_manager/common/js/util.js b/chrome/browser/resources/file_manager/common/js/util.js
index afd14faf41eb1ee0b99473be65f4c1eac3f99291..fcbeeeb49eaea616eeb8e235c6467c444c93f006 100644
--- a/chrome/browser/resources/file_manager/common/js/util.js
+++ b/chrome/browser/resources/file_manager/common/js/util.js
@@ -672,27 +672,29 @@ util.createChild = function(parent, opt_className, opt_tag) {
};
/**
- * Update the app state.
+ * Updates the app state.
+ * TODO(mtomasz): Migrate to URLs.
*
- * @param {string} path Path to be put in the address bar after the hash.
- * If null the hash is left unchanged.
- * @param {string|Object=} opt_param Search parameter. Used directly if string,
- * stringified if object. If omitted the search query is left unchanged.
- */
-util.updateAppState = function(path, opt_param) {
+ * @param {string} currentDirectoryPath Currently opened path. If null the path
+ * is left unchanged.
+ * @param {string} selectionPath Currently selected path. If null the path is
+* left unchanged.
+ * @param {string|Object=} opt_param Additional parameters, to be stored. If
+ * null, then left unchanged.
+ */
+util.updateAppState = function(currentDirectoryPath, selectionPath, opt_param) {
window.appState = window.appState || {};
- if (typeof opt_param == 'string')
- window.appState.params = {};
- else if (typeof opt_param == 'object')
+ if (opt_param !== undefined && opt_param !== null)
window.appState.params = opt_param;
- if (path)
- window.appState.defaultPath = path;
+ if (currentDirectoryPath !== null)
+ window.appState.currentDirectoryPath = currentDirectoryPath;
+ if (selectionPath !== null)
+ window.appState.selectionPath = selectionPath;
util.saveAppState();
- return;
};
/**
- * Return a translated string.
+ * Returns a translated string.
*
* Wrapper function to make dealing with translated strings more concise.
* Equivalent to loadTimeData.getString(id).
@@ -705,7 +707,7 @@ function str(id) {
}
/**
- * Return a translated string with arguments replaced.
+ * Returns a translated string with arguments replaced.
*
* Wrapper function to make dealing with translated strings more concise.
* Equivalent to loadTimeData.getStringF(id, ...).

Powered by Google App Engine
This is Rietveld 408576698