[File Manager] Better message when trying to open unsupported files

We used to show different messages when opening unsupported files from the Files app and from the Downloads page. I made them more similar, although the one displayed from C++ does not have links because the standard warning dialog does not support HTML.

BUG=139523

Review URL: https://chromiumcodereview.appspot.com/10828092

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149179 0039d316-1c4b-4281-b951-d872f2087c98
parent 2e5901f5
......@@ -11322,7 +11322,8 @@ Some features may be unavailable. Please check that the profile exists and you
Dismiss
</message>
<message name="IDS_FILE_BROWSER_NO_ACTION_FOR_FILE" desc="Message shown when user tries to open file, which we can't handle.">
To view this file, convert it to a format that's viewable on the web. <ph name="BEGIN_LINK">&lt;a target='_blank' href='$1'&gt;<ex>&lt;a target='_blank' href='$1'&gt;</ex></ph>Learn More<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>
This file type is not supported. Please visit the <ph name="BEGIN_LINK">&lt;a target='_blank' href='$1'&gt;<ex>&lt;a target='_blank' href='$1'&gt;</ex></ph>Chrome Web Store<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph> to find an app that can open this type of file.
<ph name="BEGIN_LINK">&lt;a target='_blank' href='$2'&gt;<ex>&lt;a target='_blank' href='$2'&gt;</ex></ph>Learn More<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>
</message>
<message name="IDS_FILE_BROWSER_ID3_ALBUM" desc="Album">
Album
......@@ -11471,8 +11472,8 @@ Some features may be unavailable. Please check that the profile exists and you
<message name="IDS_FILE_BROWSER_ERROR_VIEWING_FILE_TITLE" desc="Title of error message propmt when user attempts to open a non-supported file in file browser.">
<ph name="FILENAME">$1</ph>
</message>
<message name="IDS_FILE_BROWSER_ERROR_VIEWING_FILE" desc="Error message when user attempts to open a non-supported file in file browser.">
To view this file, convert it to a format that's viewable on the web. For example, you can upload it to Google Docs.
<message name="IDS_FILE_BROWSER_ERROR_VIEWING_FILE" desc="Error message when user attempts to open a non-supported file in the Files app via Downloads panel.">
This file type is not supported. Please visit the Chrome Web Store to find an app that can open this type of file.
</message>
<message name="IDS_FILE_BROWSER_ERROR_UNKNOWN_FILE_TYPE" desc="Error message when user attempts to open a file of unknown type in file browser.">
<ph name="FILENAME">$1</ph> - Unknown file type.
......
......@@ -22,6 +22,11 @@ function FileTasks(fileManager, urls) {
chrome.fileBrowserPrivate.getFileTasks(urls, this.onTasks_.bind(this));
}
/**
* Location of the Chrome Web Store.
*/
FileTasks.CHROME_WEB_STORE_URL = 'https://chrome.google.com/webstore';
/**
* Location of the FAQ about the file actions.
*/
......@@ -120,6 +125,7 @@ FileTasks.prototype.executeDefault_ = function() {
filename = filename.substr(filename.lastIndexOf('/') + 1);
var text = loadTimeData.getStringF('NO_ACTION_FOR_FILE',
FileTasks.CHROME_WEB_STORE_URL,
FileTasks.NO_ACTION_FOR_FILE_URL);
this.fileManager_.alert.showHtml(filename, text, function() {});
}
......
......@@ -67,12 +67,17 @@ chrome.fileBrowserPrivate = {
/**
* View multiple files.
*/
viewFiles: function(selectedFiles) {
console.log('viewFiles called: ' + selectedFiles.length +
' files selected');
for (var i = 0; i != selectedFiles.length; i++) {
window.open(selectedFiles[i]);
viewFiles: function(urls, actionId, callback) {
var success = true;
for (var i = 0; i != urls.length; i++) {
var url = urls[i];
if (!url.match(/\.(pdf|txt)$/i)) {
success = false;
break;
}
window.open(url);
}
callback(success);
},
/**
......@@ -588,7 +593,10 @@ chrome.fileBrowserPrivate = {
OPEN_LABEL: 'Open',
SAVE_LABEL: 'Save',
OK_LABEL: 'OK',
NO_ACTION_FOR_FILE: "To view this file, convert it to a format that's viewable on the web. <a target='_blank' href='$1'>Learn More.</a>",
NO_ACTION_FOR_FILE: 'This file type is not supported. Please visit the ' +
'<a target=\'_blank\' href=\'$1\'>Chrome Web Store</a>' +
' to find an app that can open this type of file.' +
' <a target=\'_blank\' href=\'$2\'>Learn More.</a>',
DEFAULT_NEW_FOLDER_NAME: 'New Folder',
MORE_FILES: 'Show all files',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment