Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 7529036: Add warning message to downloads directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing image Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index f3f490c84969ee016d510aee70dce34fd0bf2908..e0bc1f2ffb12c690c409cf389dcca9e622000d20 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

Powered by Google App Engine
This is Rietveld 408576698