Chromium Code Reviews| 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 402797215b229541eb22dbb4026f04ebd9c94b25..1dfde3c0f152ae09eefa7b9ea8f2fb42d86d0526 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) { |
|
hirono
2014/01/23 05:35:57
How about creating AppState class and making the m
mtomasz
2014/01/23 06:27:04
Sounds good, but let me limit scope of this CL to
hirono
2014/01/23 06:43:18
SGTM!
|
| 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, ...). |