Chromium Code Reviews| 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 /** | 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 Loading... | |
| 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 Loading... | |
| 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 }; |
| OLD | NEW |