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

Unified Diff: chrome/browser/resources/file_manager/js/action_choice.js

Issue 10918271: [filemanager] Improved action choices for a mounted drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/action_choice.js
===================================================================
--- chrome/browser/resources/file_manager/js/action_choice.js (revision 157111)
+++ chrome/browser/resources/file_manager/js/action_choice.js (working copy)
@@ -103,21 +103,39 @@
*/
ActionChoice.prototype.loadSource_ = function(source) {
var onTraversed = function(results) {
- this.previews_.removeAttribute('loading');
+ var videos = results.filter(FileType.isVideo);
+ var videoLabel = this.dom_.querySelector('label[for=watch-single-video]');
+ if (videos.length == 1) {
+ var name = videos[0].name;
+ var extPos = name.lastIndexOf('.');
Vladislav Kaznacheev 2012/09/17 19:46:14 We have a function that does this in ImageUtil. Pl
dgozman 2012/09/18 11:28:09 Yeah, I just didn't want to include ImageUtil here
+ if (extPos != -1)
+ name = name.substring(0, extPos);
+ videoLabel.textContent = loadTimeData.getStringF(
+ 'ACTION_CHOICE_WATCH_SINGLE_VIDEO', name);
+ this.singleVideo_ = videos[0];
+ } else {
+ videoLabel.parentNode.style.display = 'none';
+ }
+
var mediaFiles = results.filter(FileType.isImageOrVideo);
+ if (mediaFiles.length == 0) {
+ this.dom_.querySelector('#import-photos-to-drive').parentNode.
Vladislav Kaznacheev 2012/09/17 19:46:14 This branch will be executed if we have a single v
dgozman 2012/09/18 11:28:09 Why not? We still can backup it from the device to
+ style.display = 'none';
+ }
+ var previews = results;
if (mediaFiles.length < ActionChoice.PREVIEW_COUNT) {
this.counter_.textContent = loadTimeData.getStringF(
'ACTION_CHOICE_COUNTER_NO_MEDIA', results.length);
} else {
this.counter_.textContent = loadTimeData.getStringF(
'ACTION_CHOICE_COUNTER', results.length, mediaFiles.length);
- results = mediaFiles;
+ previews = mediaFiles;
}
-
- var count = Math.min(results.length, ActionChoice.PREVIEW_COUNT);
+ this.previews_.removeAttribute('loading');
+ var count = Math.min(previews.length, ActionChoice.PREVIEW_COUNT);
for (var index = 0; index < count; index++) {
- this.renderPreview_(results[index]);
+ this.renderPreview_(previews[index]);
}
}.bind(this);
@@ -125,6 +143,7 @@
this.sourceEntry_ = entry;
// TODO(dgozman): add icon.
this.title_.textContent = entry.name;
+ this.document_.querySelector('title').textContent = entry.name;
util.traverseTree(entry, onTraversed, 0 /* infinite depth */);
}.bind(this);
@@ -185,6 +204,9 @@
var url = chrome.extension.getURL('main.html') +
'#' + this.sourceEntry_.fullPath;
chrome.windows.create({url: url, type: 'popup'});
+ } else if (this.document_.querySelector('#watch-single-video').checked) {
+ chrome.fileBrowserPrivate.viewFiles([this.singleVideo_.toURL()], 'watch',
+ function(success) {});
}
this.close_();
};

Powered by Google App Engine
This is Rietveld 408576698