OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @param {Object.<string, string>} stringData String data. | 8 * @param {Object.<string, string>} stringData String data. |
9 * @param {VolumeManager} volumeManager Volume manager. | 9 * @param {VolumeManager} volumeManager Volume manager. |
10 */ | 10 */ |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return args[0]; | 153 return args[0]; |
154 }); | 154 }); |
155 | 155 |
156 | 156 |
157 // If only 1 entry is selected, retrieve entries in the same directory. | 157 // If only 1 entry is selected, retrieve entries in the same directory. |
158 // Otherwise, just use the selectedEntries as an entry set. | 158 // Otherwise, just use the selectedEntries as an entry set. |
159 var allEntriesPromise = selectedEntriesPromise.then(function(entries) { | 159 var allEntriesPromise = selectedEntriesPromise.then(function(entries) { |
160 if (entries.length === 1) { | 160 if (entries.length === 1) { |
161 var parentPromise = new Promise(entries[0].getParent.bind(entries[0])); | 161 var parentPromise = new Promise(entries[0].getParent.bind(entries[0])); |
162 return parentPromise.then(getChildren).then(function(entries) { | 162 return parentPromise.then(getChildren).then(function(entries) { |
163 return entries.filter(FileType.isImageOrVideo); | 163 return entries.filter(FileType.isImage); |
164 }); | 164 }); |
165 } else { | 165 } else { |
166 return entries; | 166 return entries; |
167 } | 167 } |
168 }); | 168 }); |
169 | 169 |
170 // Open entries. | 170 // Open entries. |
171 return Promise.all([ | 171 return Promise.all([ |
172 appWindowPromise, | 172 appWindowPromise, |
173 allEntriesPromise, | 173 allEntriesPromise, |
(...skipping 30 matching lines...) Expand all Loading... |
204 chrome.runtime.onMessageExternal.addListener(function(message) { | 204 chrome.runtime.onMessageExternal.addListener(function(message) { |
205 if (message.name !== 'testResourceLoaded') | 205 if (message.name !== 'testResourceLoaded') |
206 return; | 206 return; |
207 var script = document.createElement('script'); | 207 var script = document.createElement('script'); |
208 script.src = | 208 script.src = |
209 'chrome-extension://ejhcmmdhhpdhhgmifplfmjobgegbibkn' + | 209 'chrome-extension://ejhcmmdhhpdhhgmifplfmjobgegbibkn' + |
210 '/gallery/test_loader.js'; | 210 '/gallery/test_loader.js'; |
211 document.documentElement.appendChild(script); | 211 document.documentElement.appendChild(script); |
212 }); | 212 }); |
213 } | 213 } |
OLD | NEW |