diff options
author | zvorygin@chromium.org <zvorygin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-02 16:12:37 +0000 |
---|---|---|
committer | zvorygin@chromium.org <zvorygin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-02 16:12:37 +0000 |
commit | cd8310e4593a6efdc93f64410ac429e0c1911b4f (patch) | |
tree | d1bd21d93c49dfbae0ae3f69cd80f82a178838b9 | |
parent | 9abe58886ccf5c19b2a30aa4caadd48889bd8d66 (diff) | |
download | chromium_src-cd8310e4593a6efdc93f64410ac429e0c1911b4f.zip chromium_src-cd8310e4593a6efdc93f64410ac429e0c1911b4f.tar.gz chromium_src-cd8310e4593a6efdc93f64410ac429e0c1911b4f.tar.bz2 |
[FileBrowser] Prevent paste on unformatted drive. Offer to format drive instead.
BUG=137055
Review URL: https://chromiumcodereview.appspot.com/11016010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159700 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 39 insertions, 11 deletions
diff --git a/chrome/browser/resources/file_manager/css/file_manager.css b/chrome/browser/resources/file_manager/css/file_manager.css index b73639246..0f81691 100644 --- a/chrome/browser/resources/file_manager/css/file_manager.css +++ b/chrome/browser/resources/file_manager/css/file_manager.css @@ -1337,7 +1337,8 @@ div.shade[fadein] { } /* Message panel for unmounted GData */ -#unmounted-panel { +#unmounted-panel, +#format-panel { bottom: 0; color: #333; display: none; @@ -1350,28 +1351,28 @@ div.shade[fadein] { } .dialog-container[gdata='mounting'] #unmounted-panel, -.dialog-container[gdata='error'] #unmounted-panel { +.dialog-container[gdata='error'] #unmounted-panel, +.dialog-container[unformatted] #format-panel { display: block; } .dialog-container[gdata='unmounted'] .filelist-panel, .dialog-container[gdata='mounting'] .filelist-panel, -.dialog-container[gdata='error'] .filelist-panel { +.dialog-container[gdata='error'] .filelist-panel, +.dialog-container[unformatted] .filelist-panel { /* Hide file list when GData is not mounted. Use opacity to avoid manual resizing.*/ opacity: 0; } -#unmounted-panel > * { - height: 22px; - margin-bottom: 10px; -} - -#unmounted-panel > * { +#unmounted-panel > *, +#format-panel > * { -webkit-box-align: center; -webkit-box-orient: horizontal; -webkit-box-pack: start; display: none; + height: 22px; + margin-bottom: 10px; } #unmounted-panel > .loading { @@ -1386,9 +1387,11 @@ div.shade[fadein] { width: 40px; } +[unformatted] #format-panel > .error, [gdata='mounting'] #unmounted-panel > .loading, [gdata='mounting'] #unmounted-panel > .progress, [gdata='error'] #unmounted-panel > .error, +#format-panel > #format-button, #unmounted-panel.retry-enabled > .retry, #unmounted-panel.retry-enabled > .learn-more { display: -webkit-box; diff --git a/chrome/browser/resources/file_manager/js/directory_model.js b/chrome/browser/resources/file_manager/js/directory_model.js index 7091eaa..fa10c524 100644 --- a/chrome/browser/resources/file_manager/js/directory_model.js +++ b/chrome/browser/resources/file_manager/js/directory_model.js @@ -192,7 +192,8 @@ DirectoryModel.prototype.isSearching = function() { DirectoryModel.prototype.isPathReadOnly = function(path) { switch (PathUtil.getRootType(path)) { case RootType.REMOVABLE: - return !!this.volumeManager_.isReadOnly(PathUtil.getRootPath(path)); + return !!this.volumeManager_.isReadOnly(PathUtil.getRootPath(path)) || + !!this.volumeManager_.getMountError(PathUtil.getRootPath(path)); case RootType.ARCHIVE: return true; case RootType.DOWNLOADS: diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js index 21ac41c..31e3165 100644 --- a/chrome/browser/resources/file_manager/js/file_manager.js +++ b/chrome/browser/resources/file_manager/js/file_manager.js @@ -548,7 +548,7 @@ FileManager.prototype = { CommandUtil.registerCommand(this.rootsList_, 'unmount', Commands.unmountCommand, this.rootsList_, this); - CommandUtil.registerCommand(this.rootsList_, 'format', + CommandUtil.registerCommand(doc, 'format', Commands.formatCommand, this.rootsList_, this); CommandUtil.registerCommand(this.rootsList_, 'import-photos', @@ -2921,9 +2921,29 @@ FileManager.prototype = { this.closeOnUnmount_ = false; } + this.updateUnformattedDriveStatus_(); + this.updateTitle_(); }; + FileManager.prototype.updateUnformattedDriveStatus_ = function() { + var volumeInfo = this.volumeManager_.getVolumeInfo_( + this.directoryModel_.getCurrentRootPath()); + + if (volumeInfo.error) { + this.dialogContainer_.setAttribute('unformatted', ''); + + var errorNode = this.dialogDom_.querySelector('#format-panel > .error'); + if (volumeInfo.error == VolumeManager.Error.UNSUPPORTED_FILESYSTEM) { + errorNode.textContent = str('UNSUPPORTED_FILESYSTEM_WARNING'); + } else { + errorNode.textContent = str('UNKNOWN_FILESYSTEM_WARNING'); + } + } else { + this.dialogContainer_.removeAttribute('unformatted'); + } + }; + FileManager.prototype.findListItemForEvent_ = function(event) { return this.findListItemForNode_(event.touchedElement || event.srcElement); }; diff --git a/chrome/browser/resources/file_manager/main.html b/chrome/browser/resources/file_manager/main.html index a5a9b74..39ac74a 100644 --- a/chrome/browser/resources/file_manager/main.html +++ b/chrome/browser/resources/file_manager/main.html @@ -248,6 +248,10 @@ </div> </div> <div id="unmounted-panel"></div> + <div id="format-panel"> + <div class="error"></div> + <button id="format-button" command="#format"></button> + </div> </div> </div> </div> |