diff options
author | thorogood@chromium.org <thorogood@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 03:29:22 +0000 |
---|---|---|
committer | thorogood@chromium.org <thorogood@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 03:29:22 +0000 |
commit | 34e62dde80525a525852a36c815e54a44ac2bdd9 (patch) | |
tree | 888494d157ce4d15da6824f244c2e9e07a18e112 /chrome/browser/resources/file_manager/js/file_tasks.js | |
parent | 4b0c2ad084c1e317c10b5b05c637e0d0a0d03162 (diff) | |
download | chromium_src-34e62dde80525a525852a36c815e54a44ac2bdd9.zip chromium_src-34e62dde80525a525852a36c815e54a44ac2bdd9.tar.gz chromium_src-34e62dde80525a525852a36c815e54a44ac2bdd9.tar.bz2 |
Updates the Chrome OS file browser to support opening files with Web Intent handlers. Adds a basic test.
This is added to the list of 'normal' file handlers in the same way that Drive tasks are currently added. (although I feel like the whole flow needs to be changed a bit, since we don't store defaults for anything but the original file browser tasks).
BUG=138664
Review URL: https://chromiumcodereview.appspot.com/10834383
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/file_manager/js/file_tasks.js')
-rw-r--r-- | chrome/browser/resources/file_manager/js/file_tasks.js | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/resources/file_manager/js/file_tasks.js b/chrome/browser/resources/file_manager/js/file_tasks.js index cc6fe91..baefa29 100644 --- a/chrome/browser/resources/file_manager/js/file_tasks.js +++ b/chrome/browser/resources/file_manager/js/file_tasks.js @@ -86,51 +86,55 @@ FileTasks.prototype.processTasks_ = function(tasks) { // Tweak images, titles of internal tasks. var task_parts = task.taskId.split('|'); - if (task_parts[0] == id) { - if (task_parts[1] == 'play') { + if (task_parts[0] == id && task_parts[1] == 'file') { + if (task_parts[2] == 'play') { // TODO(serya): This hack needed until task.iconUrl is working // (see GetFileTasksFileBrowserFunction::RunImpl). task.iconType = 'audio'; task.title = loadTimeData.getString('ACTION_LISTEN'); - } else if (task_parts[1] == 'mount-archive') { + } else if (task_parts[2] == 'mount-archive') { task.iconType = 'archive'; task.title = loadTimeData.getString('MOUNT_ARCHIVE'); - } else if (task_parts[1] == 'gallery') { + } else if (task_parts[2] == 'gallery') { task.iconType = 'image'; task.title = loadTimeData.getString('ACTION_OPEN'); - } else if (task_parts[1] == 'watch') { + } else if (task_parts[2] == 'watch') { task.iconType = 'video'; task.title = loadTimeData.getString('ACTION_WATCH'); - } else if (task_parts[1] == 'open-hosted-generic') { + } else if (task_parts[2] == 'open-hosted-generic') { if (this.urls_.length > 1) task.iconType = 'generic'; else // Use specific icon. task.iconType = FileType.getIcon(this.urls_[0]); task.title = loadTimeData.getString('ACTION_OPEN'); - } else if (task_parts[1] == 'open-hosted-gdoc') { + } else if (task_parts[2] == 'open-hosted-gdoc') { task.iconType = 'gdoc'; task.title = loadTimeData.getString('ACTION_OPEN_GDOC'); - } else if (task_parts[1] == 'open-hosted-gsheet') { + } else if (task_parts[2] == 'open-hosted-gsheet') { task.iconType = 'gsheet'; task.title = loadTimeData.getString('ACTION_OPEN_GSHEET'); - } else if (task_parts[1] == 'open-hosted-gslides') { + } else if (task_parts[2] == 'open-hosted-gslides') { task.iconType = 'gslides'; task.title = loadTimeData.getString('ACTION_OPEN_GSLIDES'); - } else if (task_parts[1] == 'view-pdf') { + } else if (task_parts[2] == 'view-pdf') { // Do not render this task if disabled. if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED')) continue; task.iconType = 'pdf'; task.title = loadTimeData.getString('ACTION_VIEW'); - } else if (task_parts[1] == 'view-in-browser') { + } else if (task_parts[2] == 'view-in-browser') { task.iconType = 'generic'; task.title = loadTimeData.getString('ACTION_VIEW'); - } else if (task_parts[1] == 'install-crx') { + } else if (task_parts[2] == 'install-crx') { task.iconType = 'generic'; task.title = loadTimeData.getString('INSTALL_CRX'); } } + if (!task.iconType && task_parts[1] == 'web-intent') { + task.iconType = 'generic'; + } + this.tasks_.push(task); if (this.defaultTask_ == null && task.isDefault) { this.defaultTask_ = task; @@ -190,11 +194,11 @@ FileTasks.prototype.execute_ = function(taskId, opt_urls) { chrome.fileBrowserPrivate.executeTask(taskId, urls); var task_parts = taskId.split('|'); - if (task_parts[0] == util.getExtensionId()) { + if (task_parts[0] == util.getExtensionId() && task_parts[1] == 'file') { // For internal tasks we do not listen to the event to avoid // handling the same task instance from multiple tabs. // So, we manually execute the task. - this.executeInternalTask_(task_parts[1], urls); + this.executeInternalTask_(task_parts[2], urls); } }.bind(this)); }; |