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

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

Issue 10825182: Making file names (with icons) clickable in File Manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e05580d061f12540dba7bf0f098af53e51b1f8e9..c5a432ba078bb3f5a9072c6e0ac5d1ee6685fb76 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -1059,6 +1059,8 @@ FileManager.prototype = {
this.grid_.addEventListener(
'dblclick', this.onDetailDoubleClickOrTap_.bind(this));
this.grid_.addEventListener(
+ 'click', this.onDetailClick_.bind(this));
+ this.grid_.addEventListener(
cr.ui.TouchHandler.EventType.TAP,
this.onDetailDoubleClickOrTap_.bind(this));
cr.ui.contextMenuHandler.setContextMenu(this.grid_, this.fileContextMenu_);
@@ -1121,6 +1123,8 @@ FileManager.prototype = {
this.table_.list.addEventListener(
'dblclick', this.onDetailDoubleClickOrTap_.bind(this));
this.table_.list.addEventListener(
+ 'click', this.onDetailClick_.bind(this));
+ this.table_.list.addEventListener(
cr.ui.TouchHandler.EventType.TAP,
this.onDetailDoubleClickOrTap_.bind(this));
@@ -1826,11 +1830,13 @@ FileManager.prototype = {
FileManager.prototype.renderFileNameLabel_ = function(entry) {
// Filename need to be in a '.filename-label' container for correct
// work of inplace renaming.
- var fileName = this.document_.createElement('div');
- fileName.className = 'filename-label';
+ var box = this.document_.createElement('div');
+ box.className = 'filename-label';
+ var fileName = this.document_.createElement('span');
fileName.textContent = entry.name;
+ box.appendChild(fileName);
- return fileName;
+ return box;
};
/**
@@ -2853,6 +2859,26 @@ FileManager.prototype = {
this.dispatchSelectionAction_();
};
+ /**
+ * Handles mouse click or tap. Simulates double click if click happens
+ * on the file name or the icon.
+ * @param {Event} event The click event.
+ */
+ FileManager.prototype.onDetailClick_ = function(event) {
+ if (this.isRenamingInProgress()) {
+ // Don't pay attention to clicks during a rename.
+ return;
+ }
+
+ if (event.target.parentElement.classList.contains('filename-label') ||
Dmitry Zvorygin 2012/08/03 18:03:40 I don't like this hacky code with a lot of 'or-ed'
+ event.target.classList.contains('detail-icon') ||
+ event.target.classList.contains('img-container')) {
+ this.onDetailDoubleClickOrTap_(event);
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ };
+
FileManager.prototype.dispatchSelectionAction_ = function() {
if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) {
if (this.selection.tasks)
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698