| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Namespace for utility functions. | 8 * Namespace for utility functions. |
| 9 */ | 9 */ |
| 10 var util = {}; | 10 var util = {}; |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 util.createChild = function(parent, opt_className, opt_tag) { | 677 util.createChild = function(parent, opt_className, opt_tag) { |
| 678 var child = parent.ownerDocument.createElement(opt_tag || 'div'); | 678 var child = parent.ownerDocument.createElement(opt_tag || 'div'); |
| 679 if (opt_className) | 679 if (opt_className) |
| 680 child.className = opt_className; | 680 child.className = opt_className; |
| 681 parent.appendChild(child); | 681 parent.appendChild(child); |
| 682 return child; | 682 return child; |
| 683 }; | 683 }; |
| 684 | 684 |
| 685 /** | 685 /** |
| 686 * Updates the app state. | 686 * Updates the app state. |
| 687 * TODO(mtomasz): Migrate to URLs. | |
| 688 * | 687 * |
| 689 * @param {string} currentDirectoryPath Currently opened path. If null the path | 688 * @param {string} currentDirectoryURL Currently opened directory as an URL. |
| 690 * is left unchanged. | 689 * If null the value is left unchanged. |
| 691 * @param {string} selectionPath Currently selected path. If null the path is | 690 * @param {string} selectionURL Currently selected entry as an URL. If null the |
| 692 * left unchanged. | 691 * value is left unchanged. |
| 693 * @param {string|Object=} opt_param Additional parameters, to be stored. If | 692 * @param {string|Object=} opt_param Additional parameters, to be stored. If |
| 694 * null, then left unchanged. | 693 * null, then left unchanged. |
| 695 */ | 694 */ |
| 696 util.updateAppState = function(currentDirectoryPath, selectionPath, opt_param) { | 695 util.updateAppState = function(currentDirectoryURL, selectionURL, opt_param) { |
| 697 window.appState = window.appState || {}; | 696 window.appState = window.appState || {}; |
| 698 if (opt_param !== undefined && opt_param !== null) | 697 if (opt_param !== undefined && opt_param !== null) |
| 699 window.appState.params = opt_param; | 698 window.appState.params = opt_param; |
| 700 if (currentDirectoryPath !== null) | 699 if (currentDirectoryURL !== null) |
| 701 window.appState.currentDirectoryPath = currentDirectoryPath; | 700 window.appState.currentDirectoryURL = currentDirectoryURL; |
| 702 if (selectionPath !== null) | 701 if (selectionURL !== null) |
| 703 window.appState.selectionPath = selectionPath; | 702 window.appState.selectionURL = selectionURL; |
| 704 util.saveAppState(); | 703 util.saveAppState(); |
| 705 }; | 704 }; |
| 706 | 705 |
| 707 /** | 706 /** |
| 708 * Returns a translated string. | 707 * Returns a translated string. |
| 709 * | 708 * |
| 710 * Wrapper function to make dealing with translated strings more concise. | 709 * Wrapper function to make dealing with translated strings more concise. |
| 711 * Equivalent to loadTimeData.getString(id). | 710 * Equivalent to loadTimeData.getString(id). |
| 712 * | 711 * |
| 713 * @param {string} id The id of the string to return. | 712 * @param {string} id The id of the string to return. |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 * @enum {string} | 1297 * @enum {string} |
| 1299 * @const | 1298 * @const |
| 1300 */ | 1299 */ |
| 1301 util.VolumeType = Object.freeze({ | 1300 util.VolumeType = Object.freeze({ |
| 1302 DRIVE: 'drive', | 1301 DRIVE: 'drive', |
| 1303 DOWNLOADS: 'downloads', | 1302 DOWNLOADS: 'downloads', |
| 1304 REMOVABLE: 'removable', | 1303 REMOVABLE: 'removable', |
| 1305 ARCHIVE: 'archive', | 1304 ARCHIVE: 'archive', |
| 1306 CLOUD_DEVICE: 'cloud_device' | 1305 CLOUD_DEVICE: 'cloud_device' |
| 1307 }); | 1306 }); |
| OLD | NEW |