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

Side by Side Diff: ui/file_manager/file_manager/common/js/util.js

Issue 971163002: Files.app: Let MetadataCacheModel use cached URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Namespace for utility functions. 6 * Namespace for utility functions.
7 */ 7 */
8 var util = {}; 8 var util = {};
9 9
10 /** 10 /**
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 return str('UI_LOCALE') || 'en'; 760 return str('UI_LOCALE') || 'en';
761 }; 761 };
762 762
763 /** 763 /**
764 * Converts array of entries to an array of corresponding URLs. 764 * Converts array of entries to an array of corresponding URLs.
765 * @param {Array<Entry>} entries Input array of entries. 765 * @param {Array<Entry>} entries Input array of entries.
766 * @return {!Array<string>} Output array of URLs. 766 * @return {!Array<string>} Output array of URLs.
767 */ 767 */
768 util.entriesToURLs = function(entries) { 768 util.entriesToURLs = function(entries) {
769 return entries.map(function(entry) { 769 return entries.map(function(entry) {
770 return entry.toURL(); 770 return entry['cachedUrl'] || entry.toURL();
fukino 2015/03/05 03:46:02 Coudl you use entry.cachedUrl for consistency and
hirono 2015/03/05 03:47:12 Closure compiler generates error for entry.cachedU
771 }); 771 });
772 }; 772 };
773 773
774 /** 774 /**
775 * Converts array of URLs to an array of corresponding Entries. 775 * Converts array of URLs to an array of corresponding Entries.
776 * 776 *
777 * @param {Array.<string>} urls Input array of URLs. 777 * @param {Array.<string>} urls Input array of URLs.
778 * @param {function(!Array.<!Entry>, !Array.<!URL>)=} opt_callback Completion 778 * @param {function(!Array.<!Entry>, !Array.<!URL>)=} opt_callback Completion
779 * callback with array of success Entries and failure URLs. 779 * callback with array of success Entries and failure URLs.
780 * @return {Promise} Promise fulfilled with the object that has entries property 780 * @return {Promise} Promise fulfilled with the object that has entries property
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 * @param {!cr.EventTarget} target 1030 * @param {!cr.EventTarget} target
1031 * @param {string} type 1031 * @param {string} type
1032 * @param {Function} handler 1032 * @param {Function} handler
1033 */ 1033 */
1034 util.addEventListenerToBackgroundComponent = function(target, type, handler) { 1034 util.addEventListenerToBackgroundComponent = function(target, type, handler) {
1035 target.addEventListener(type, handler); 1035 target.addEventListener(type, handler);
1036 window.addEventListener('pagehide', function() { 1036 window.addEventListener('pagehide', function() {
1037 target.removeEventListener(type, handler); 1037 target.removeEventListener(type, handler);
1038 }); 1038 });
1039 }; 1039 };
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698