diff options
-rw-r--r-- | chrome/browser/extensions/extension_file_browser_private_api.cc | 2 | ||||
-rw-r--r-- | chrome/browser/resources/component_extension_resources.grd | 1 | ||||
-rw-r--r-- | chrome/browser/resources/file_manager/css/file_manager.css | 29 | ||||
-rw-r--r-- | chrome/browser/resources/file_manager/images/warning_icon_square_26x26.png | bin | 0 -> 3634 bytes | |||
-rw-r--r-- | chrome/browser/resources/file_manager/js/file_manager.js | 53 | ||||
-rw-r--r-- | chrome/browser/resources/file_manager/js/util.js | 10 | ||||
-rw-r--r-- | chrome/browser/resources/file_manager/main.html | 13 |
7 files changed, 96 insertions, 12 deletions
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index 54d6d9a..eafd113 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -1358,6 +1358,8 @@ bool FileDialogStringsFunction::RunImpl() { SET_STRING(IDS_FILE_BROWSER, DATE_COLUMN_LABEL); SET_STRING(IDS_FILE_BROWSER, PREVIEW_COLUMN_LABEL); + SET_STRING(IDS_FILE_BROWSER, DOWNLOADS_DIRECTORY_WARNING); + SET_STRING(IDS_FILE_BROWSER, ERROR_CREATING_FOLDER); SET_STRING(IDS_FILE_BROWSER, ERROR_INVALID_CHARACTER); SET_STRING(IDS_FILE_BROWSER, ERROR_RESERVED_NAME); diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index e6d6c13..48a5cd0 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd @@ -63,6 +63,7 @@ <include name="IDR_FILE_MANAGER_ICON_DETAIL_VIEW" file="file_manager/images/icon-detail-view.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ICON_THUMB_VIEW" file="file_manager/images/icon-thumb-view.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_WARNING_ICON" file="file_manager/images/warning_icon_square_26x26.png" type="BINDATA"/> <include name="IDR_FILE_MANAGER_BUTTON_ICON_COPY" file="file_manager/images/button-icon-copy.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_BUTTON_ICON_PASTE" file="file_manager/images/button-icon-paste.png" type="BINDATA" /> diff --git a/chrome/browser/resources/file_manager/css/file_manager.css b/chrome/browser/resources/file_manager/css/file_manager.css index d917703..16316e3 100644 --- a/chrome/browser/resources/file_manager/css/file_manager.css +++ b/chrome/browser/resources/file_manager/css/file_manager.css @@ -125,13 +125,40 @@ button.thumbnail-view > img { top: 1px; } -.list-container { +.left-column { + display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-flex: 1; +} + +.list-container { display: -webkit-box; + -webkit-box-flex: 1; position: relative; } +.downloads-warning { + display: -webkit-box; + -webkit-box-orient: horizontal; + height: 0; + -webkit-transition: height 0.07s linear; + background-color: #f0f0f0; + font-size: 13px; + color: #666; + -webkit-box-align: center; + overflow: hidden; +} + +.downloads-warning img { + display: -webkit-box; + padding: 15px; +} + +.downloads-warning div { + display: -webkit-box; + -webkit-box-flex: 1; +} + /* The cr.ui.Grid representing the detailed file list. */ .thumbnail-grid { position: absolute; diff --git a/chrome/browser/resources/file_manager/images/warning_icon_square_26x26.png b/chrome/browser/resources/file_manager/images/warning_icon_square_26x26.png Binary files differnew file mode 100644 index 0000000..c55817b --- /dev/null +++ b/chrome/browser/resources/file_manager/images/warning_icon_square_26x26.png diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js index f3f490c..e0bc1f2 100644 --- a/chrome/browser/resources/file_manager/js/file_manager.js +++ b/chrome/browser/resources/file_manager/js/file_manager.js @@ -167,11 +167,6 @@ FileManager.prototype = { const RIGHT_TRIANGLE = '\u25b8'; /** - * The DirectoryEntry.fullPath value of the Downloads directory. - */ - const DOWNLOADS_DIRECTORY = '/Downloads'; - - /** * The DirectoryEntry.fullPath value of the directory containing externally * mounted removable storage volumes. */ @@ -184,6 +179,22 @@ FileManager.prototype = { const ARCHIVE_DIRECTORY = '/archive'; /** + * The DirectoryEntry.fullPath value of the downloads directory. + */ + const DOWNLOADS_DIRECTORY = '/Downloads'; + + /** + * Height of the downloads folder warning, in px. + */ + const DOWNLOADS_WARNING_HEIGHT = '57px'; + + /** + * Location of the FAQ about the downloads directory. + */ + const DOWNLOADS_FAQ_URL = 'http://www.google.com/support/chromeos/bin/' + + 'answer.py?hl=en&answer=1061547'; + + /** * Mnemonics for the second parameter of the changeDirectory method. */ const CD_WITH_HISTORY = true; @@ -566,6 +577,15 @@ FileManager.prototype = { this.copyButton_ = this.dialogDom_.querySelector('.clipboard-copy'); this.pasteButton_ = this.dialogDom_.querySelector('.clipboard-paste'); + this.downloadsWarning_ = + this.dialogDom_.querySelector('.downloads-warning'); + var html = util.htmlUnescape(strf('DOWNLOADS_DIRECTORY_WARNING', + DOWNLOADS_FAQ_URL)); + // TODO(rginda): Fix this string in the grd file to include the target + // attribute, post R14. + html = html.replace('<a href=', '<a target=new_ href='); + this.downloadsWarning_.lastElementChild.innerHTML = html; + this.document_.addEventListener('keydown', this.onKeyDown_.bind(this)); this.descriptionTable_ = @@ -1006,6 +1026,11 @@ FileManager.prototype = { this.changeDirectory(event.state, CD_NO_HISTORY); }; + FileManager.prototype.requestResize_ = function(timeout) { + var self = this; + setTimeout(function() { self.onResize_() }, timeout || 0); + }; + /** * Resize details and thumb views to fit the new window size. */ @@ -2347,6 +2372,20 @@ FileManager.prototype = { location.href); } + if (this.currentDirEntry_.fullPath.substr(0, DOWNLOADS_DIRECTORY.length) == + DOWNLOADS_DIRECTORY) { + if (this.downloadsWarning_.style.height != DOWNLOADS_WARNING_HEIGHT) { + // Current path starts with DOWNLOADS_DIRECTORY, show the warning. + this.downloadsWarning_.style.height = DOWNLOADS_WARNING_HEIGHT; + this.requestResize_(100); + } + } else { + if (this.downloadsWarning_.style.height != '0') { + this.downloadsWarning_.style.height = '0'; + this.requestResize_(100); + } + } + this.updateCommands_(); this.updateOkButton_(); @@ -2408,8 +2447,8 @@ FileManager.prototype = { // commonly hidden patterns might be nice too. if (self.filterFiles_) { spliceArgs = spliceArgs.filter(function(e) { - return e.name.substr(0, 1) != '.'; - }); + return e.name.substr(0, 1) != '.'; + }); } spliceArgs.unshift(0, 0); // index, deleteCount diff --git a/chrome/browser/resources/file_manager/js/util.js b/chrome/browser/resources/file_manager/js/util.js index 0f2adef..2217aab 100644 --- a/chrome/browser/resources/file_manager/js/util.js +++ b/chrome/browser/resources/file_manager/js/util.js @@ -57,6 +57,16 @@ var util = { return code; }, + htmlUnescape: function(str) { + return str.replace(/&(lt|gt|amp);/g, function(entity) { + switch (entity) { + case '<': return '<'; + case '>': return '>'; + case '&': return '&'; + } + }); + }, + /** * Given a list of Entries, recurse any DirectoryEntries, and call back * with a list of all file and directory entries encountered (including the diff --git a/chrome/browser/resources/file_manager/main.html b/chrome/browser/resources/file_manager/main.html index adb9932..9daec9f 100644 --- a/chrome/browser/resources/file_manager/main.html +++ b/chrome/browser/resources/file_manager/main.html @@ -110,7 +110,6 @@ >[TITLE]</div> <div class=dialog-header> <div class=breadcrumbs></div> - <!-- TODO(rginda): Add icons instead of unicode glyphs --> <button class=detail-view tabindex=4 ><img src='images/icon-detail-view.png'></button ><button class=thumbnail-view tabindex=5 @@ -122,9 +121,15 @@ ></button> </div> <div class=dialog-body> - <div class=list-container> - <div class=detail-table tabindex=0></div> - <grid class=thumbnail-grid tabindex=0></grid> + <div class=left-column> + <div class=list-container> + <div class=detail-table tabindex=0></div> + <grid class=thumbnail-grid tabindex=0></grid> + </div> + <div class=downloads-warning> + <img src=images/warning_icon_square_26x26.png> + <div></div> + </div> </div> <div class=preview-container> <div class=table-header style='width:100%'> |