Commit aa15f130 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Files.app: handle UNSUPPORTED_FILESYSTEM errors.

* Correct spelling in several places.
* Add handling of the error during onMountCompleted event so that the
  volume shows up in UI and users can format it.

BUG=396531

Review URL: https://codereview.chromium.org/409353002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285501 0039d316-1c4b-4281-b951-d872f2087c98
parent 466b8a8f
...@@ -181,7 +181,7 @@ MountErrorToMountCompletedStatus(chromeos::MountError error) { ...@@ -181,7 +181,7 @@ MountErrorToMountCompletedStatus(chromeos::MountError error) {
MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN_FILESYSTEM; MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN_FILESYSTEM;
case chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM: case chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM:
return file_browser_private:: return file_browser_private::
MOUNT_COMPLETED_STATUS_ERROR_UNSUPORTED_FILESYSTEM; MOUNT_COMPLETED_STATUS_ERROR_UNSUPPORTED_FILESYSTEM;
case chromeos::MOUNT_ERROR_INVALID_ARCHIVE: case chromeos::MOUNT_ERROR_INVALID_ARCHIVE:
return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_INVALID_ARCHIVE; return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_INVALID_ARCHIVE;
case chromeos::MOUNT_ERROR_NOT_AUTHENTICATED: case chromeos::MOUNT_ERROR_NOT_AUTHENTICATED:
......
...@@ -39,7 +39,7 @@ enum MountCompletedStatus { ...@@ -39,7 +39,7 @@ enum MountCompletedStatus {
error_mount_program_failed, error_mount_program_failed,
error_invalid_device_path, error_invalid_device_path,
error_unknown_filesystem, error_unknown_filesystem,
error_unsuported_filesystem, error_unsupported_filesystem,
error_invalid_archive, error_invalid_archive,
error_authentication, error_authentication,
error_path_unmounted error_path_unmounted
......
...@@ -166,7 +166,7 @@ function testUnsupportedDevice() { ...@@ -166,7 +166,7 @@ function testUnsupportedDevice() {
registerTypicalDevice(); registerTypicalDevice();
chrome.fileBrowserPrivate.onMountCompleted.dispatch({ chrome.fileBrowserPrivate.onMountCompleted.dispatch({
status: 'error_unsuported_filesystem', status: 'error_unsupported_filesystem',
volumeMetadata: { volumeMetadata: {
isParentDevice: false, isParentDevice: false,
deviceType: 'usb', deviceType: 'usb',
...@@ -197,7 +197,7 @@ function testUnsupportedWithUnknownParent() { ...@@ -197,7 +197,7 @@ function testUnsupportedWithUnknownParent() {
chrome.notifications.items['deviceFail:/device/path'].message); chrome.notifications.items['deviceFail:/device/path'].message);
chrome.fileBrowserPrivate.onMountCompleted.dispatch({ chrome.fileBrowserPrivate.onMountCompleted.dispatch({
status: 'error_unsuported_filesystem', status: 'error_unsupported_filesystem',
volumeMetadata: { volumeMetadata: {
isParentDevice: false, isParentDevice: false,
deviceType: 'usb', deviceType: 'usb',
...@@ -226,7 +226,7 @@ function testMountPartialSuccess() { ...@@ -226,7 +226,7 @@ function testMountPartialSuccess() {
assertEquals(0, Object.keys(chrome.notifications.items).length); assertEquals(0, Object.keys(chrome.notifications.items).length);
chrome.fileBrowserPrivate.onMountCompleted.dispatch({ chrome.fileBrowserPrivate.onMountCompleted.dispatch({
status: 'error_unsuported_filesystem', status: 'error_unsupported_filesystem',
volumeMetadata: { volumeMetadata: {
isParentDevice: false, isParentDevice: false,
deviceType: 'usb', deviceType: 'usb',
......
...@@ -402,7 +402,7 @@ DeviceHandler.prototype.onMountCompleted_ = function(event) { ...@@ -402,7 +402,7 @@ DeviceHandler.prototype.onMountCompleted_ = function(event) {
break; break;
case DeviceHandler.MountStatus.CHILD_ERROR: case DeviceHandler.MountStatus.CHILD_ERROR:
case DeviceHandler.MountStatus.ONLY_PARENT_ERROR: case DeviceHandler.MountStatus.ONLY_PARENT_ERROR:
if (event.status === 'error_unsuported_filesystem') { if (event.status === 'error_unsupported_filesystem') {
message = volume.deviceLabel ? message = volume.deviceLabel ?
strf('DEVICE_UNSUPPORTED_MESSAGE', volume.deviceLabel) : strf('DEVICE_UNSUPPORTED_MESSAGE', volume.deviceLabel) :
str('DEVICE_UNSUPPORTED_DEFAULT_MESSAGE'); str('DEVICE_UNSUPPORTED_DEFAULT_MESSAGE');
......
...@@ -579,8 +579,11 @@ VolumeManager.prototype.onMountCompleted_ = function(event) { ...@@ -579,8 +579,11 @@ VolumeManager.prototype.onMountCompleted_ = function(event) {
'mount', 'mount',
event.volumeMetadata.sourcePath); event.volumeMetadata.sourcePath);
var error = event.status === 'success' ? '' : event.status; if (event.status === 'success' ||
if (!error || event.status === 'error_unknown_filesystem') { event.status ===
VolumeManagerCommon.VolumeError.UNKNOWN_FILESYSTEM ||
event.status ===
VolumeManagerCommon.VolumeError.UNSUPPORTED_FILESYSTEM) {
volumeManagerUtil.createVolumeInfo( volumeManagerUtil.createVolumeInfo(
event.volumeMetadata, event.volumeMetadata,
function(volumeInfo) { function(volumeInfo) {
......
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