diff options
author | dgozman@chromium.org <dgozman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 14:30:39 +0000 |
---|---|---|
committer | dgozman@chromium.org <dgozman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 14:30:39 +0000 |
commit | 257b7e7bdc9091dc2a3e6ec9fbff684d89d32c68 (patch) | |
tree | 221be49c08aee840cc4fc2c721fe79523dcfa35c /chrome | |
parent | f3c5326c0c15f244236304b279db2b6ee610e939 (diff) | |
download | chromium_src-257b7e7bdc9091dc2a3e6ec9fbff684d89d32c68.zip chromium_src-257b7e7bdc9091dc2a3e6ec9fbff684d89d32c68.tar.gz chromium_src-257b7e7bdc9091dc2a3e6ec9fbff684d89d32c68.tar.bz2 |
[filemanager] Improved action choices for a mounted drive.
Also fixed blank titles.
BUG=147629
TEST=See bug.
Review URL: https://codereview.chromium.org/10918271
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
5 files changed, 51 insertions, 16 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 36e8cde..fde2dd5 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -11765,7 +11765,7 @@ Some features may be unavailable. Please check that the profile exists and you </message> <message name="IDS_FILE_BROWSER_ACTION_CHOICE_PHOTOS_DRIVE" desc="In the action choice dialog, label of action to import photos to Drive."> - Backup photos to Google Drive + Import photos to Google Drive </message> <message name="IDS_FILE_BROWSER_ACTION_CHOICE_VIEW_FILES" desc="In the action choice dialog, label of action to view all files."> View all files diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 3b0c517..22e88ee 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -1672,6 +1672,7 @@ bool FileDialogStringsFunction::RunImpl() { SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_PHOTOS_DRIVE); SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_VIEW_FILES); + SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_WATCH_SINGLE_VIDEO); SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_OK); SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_COUNTER_NO_MEDIA); SET_STRING(IDS_FILE_BROWSER, ACTION_CHOICE_COUNTER); diff --git a/chrome/browser/resources/file_manager/action_choice.html b/chrome/browser/resources/file_manager/action_choice.html index 3523b7c..197a797 100644 --- a/chrome/browser/resources/file_manager/action_choice.html +++ b/chrome/browser/resources/file_manager/action_choice.html @@ -47,15 +47,20 @@ <div class="choices"> <div> - <input id="import-photos-to-drive" type="radio" name="action" checked> + <input id="view-files" type="radio" name="action" checked> + <label for="view-files" + i18n-content="ACTION_CHOICE_VIEW_FILES"></label> + </div> + + <div> + <input id="import-photos-to-drive" type="radio" name="action"> <label for="import-photos-to-drive" i18n-content="ACTION_CHOICE_PHOTOS_DRIVE"></label> </div> <div> - <input id="view-files" type="radio" name="action"> - <label for="view-files" - i18n-content="ACTION_CHOICE_VIEW_FILES"></label> + <input id="watch-single-video" type="radio" name="action"> + <label for="watch-single-video"></label> </div> </div> diff --git a/chrome/browser/resources/file_manager/css/action_choice.css b/chrome/browser/resources/file_manager/css/action_choice.css index 15a7a13..75345cb 100644 --- a/chrome/browser/resources/file_manager/css/action_choice.css +++ b/chrome/browser/resources/file_manager/css/action_choice.css @@ -89,16 +89,21 @@ } .choices label[for=import-photos-to-drive] { - /* TODO(dgozman): change to the right one */ - background: - url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_GSHEET') no-repeat; + background: -webkit-image-set( + url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_DRIVE') 1x, + url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_DRIVE@2x') 2x) no-repeat; padding-left: 20px; } .choices label[for=view-files] { - /* TODO(dgozman): change to the right one */ - background: - url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_GDOC') no-repeat; + background: url(../images/icon16.png) no-repeat; + padding-left: 20px; +} + +.choices label[for=watch-single-video] { + background: -webkit-image-set( + url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_VIDEO') 1x, + url('chrome://theme/IDR_FILE_MANAGER_IMG_FILETYPE_VIDEO@2x') 2x) no-repeat; padding-left: 20px; } diff --git a/chrome/browser/resources/file_manager/js/action_choice.js b/chrome/browser/resources/file_manager/js/action_choice.js index 379ede1..d7cd054 100644 --- a/chrome/browser/resources/file_manager/js/action_choice.js +++ b/chrome/browser/resources/file_manager/js/action_choice.js @@ -103,21 +103,41 @@ ActionChoice.prototype.initDom_ = function() { */ 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('.'); + // TODO(dgozman): use GetFileNameFromFullName once it is moved to + // appropriate place. + 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. + 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 +145,7 @@ ActionChoice.prototype.loadSource_ = function(source) { 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 +206,9 @@ ActionChoice.prototype.onOk_ = function() { 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_(); }; |