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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 8585027: Moving checkboxes to a separate column. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fix Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Setting the src of an img to an empty string can crash the browser, so we 5 // Setting the src of an img to an empty string can crash the browser, so we
6 // use an empty 1x1 gif instead. 6 // use an empty 1x1 gif instead.
7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,'
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D';
9 9
10 var g_slideshow_data = null; 10 var g_slideshow_data = null;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 470
471 /** 471 /**
472 * Request file system and get root entries asynchronously. Invokes init_ 472 * Request file system and get root entries asynchronously. Invokes init_
473 * when have finished. 473 * when have finished.
474 */ 474 */
475 FileManager.prototype.resolveRoots_ = function(callback) { 475 FileManager.prototype.resolveRoots_ = function(callback) {
476 var rootPaths = ['Downloads', 'removable', 'archive']; 476 var rootPaths = ['Downloads', 'removable', 'archive'];
477 477
478 metrics.startInterval('RequestLocalFileSystem'); 478 metrics.startInterval('RequestLocalFileSystem');
479 var self = this; 479 var self = this;
480
481 // The list of active mount points to distinct them from other directories.
482 chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) {
483 self.mountPoints_ = mountPoints;
484 onDone();
485 });
486
487 function onDone() {
488 if (self.mountPoints_ && self.rootEntries_)
489 self.init_();
490 }
491
480 chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) { 492 chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) {
481 self.filesystem_ = filesystem; 493 self.filesystem_ = filesystem;
482 util.installFileErrorToString(); 494 util.installFileErrorToString();
483 495
484 metrics.recordTime('RequestLocalFileSystem'); 496 metrics.recordTime('RequestLocalFileSystem');
485 console.log('Found filesystem: ' + filesystem.name, filesystem); 497 console.log('Found filesystem: ' + filesystem.name, filesystem);
486 498
487 var rootEntries = []; 499 var rootEntries = [];
488 500
489 function onAllRootsFound() { 501 function onAllRootsFound() {
490 self.rootEntries_ = rootEntries; 502 self.rootEntries_ = rootEntries;
491 self.init_(); 503 onDone();
492 } 504 }
493 505
494 function onPathError(path, err) { 506 function onPathError(path, err) {
495 console.error('Error locating root path: ' + path + ': ' + err); 507 console.error('Error locating root path: ' + path + ': ' + err);
496 } 508 }
497 509
498 function onEntryFound(entry) { 510 function onEntryFound(entry) {
499 if (entry) { 511 if (entry) {
500 rootEntries.push(entry); 512 rootEntries.push(entry);
501 } else { 513 } else {
(...skipping 11 matching lines...) Expand all
513 util.forEachDirEntry(filesystem.root, onEntryFound); 525 util.forEachDirEntry(filesystem.root, onEntryFound);
514 } 526 }
515 }); 527 });
516 }; 528 };
517 529
518 /** 530 /**
519 * Continue initializing the file manager after resolving roots. 531 * Continue initializing the file manager after resolving roots.
520 */ 532 */
521 FileManager.prototype.init_ = function() { 533 FileManager.prototype.init_ = function() {
522 metrics.startInterval('InitFileManager'); 534 metrics.startInterval('InitFileManager');
523 this.initFileList_();
524 this.initDialogs_();
525 535
526 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is 536 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is
527 // available in all chrome trunk builds. 537 // available in all chrome trunk builds.
528 if ('createDateTimeFormat' in this.locale_) { 538 if ('createDateTimeFormat' in this.locale_) {
529 this.shortDateFormatter_ = 539 this.shortDateFormatter_ =
530 this.locale_.createDateTimeFormat({'dateType': 'medium'}); 540 this.locale_.createDateTimeFormat({'dateType': 'medium'});
531 } else { 541 } else {
532 this.shortDateFormatter_ = { 542 this.shortDateFormatter_ = {
533 format: function(d) { 543 format: function(d) {
534 return (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear(); 544 return (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
(...skipping 16 matching lines...) Expand all
551 }; 561 };
552 } 562 }
553 563
554 // Optional list of file types. 564 // Optional list of file types.
555 this.fileTypes_ = this.params_.typeList; 565 this.fileTypes_ = this.params_.typeList;
556 566
557 this.showCheckboxes_ = 567 this.showCheckboxes_ =
558 (this.dialogType_ == FileManager.DialogType.FULL_PAGE || 568 (this.dialogType_ == FileManager.DialogType.FULL_PAGE ||
559 this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); 569 this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE);
560 570
571 this.initFileList_();
572 this.initDialogs_();
573
561 // DirectoryEntry representing the current directory of the dialog. 574 // DirectoryEntry representing the current directory of the dialog.
562 this.currentDirEntry_ = null; 575 this.currentDirEntry_ = null;
563 576
564 this.copyManager_ = new FileCopyManager(); 577 this.copyManager_ = new FileCopyManager();
565 this.copyManager_.addEventListener('copy-progress', 578 this.copyManager_.addEventListener('copy-progress',
566 this.onCopyProgress_.bind(this)); 579 this.onCopyProgress_.bind(this));
567 580
568 window.addEventListener('popstate', this.onPopState_.bind(this)); 581 window.addEventListener('popstate', this.onPopState_.bind(this));
569 window.addEventListener('unload', this.onUnload_.bind(this)); 582 window.addEventListener('unload', this.onUnload_.bind(this));
570 583
(...skipping 10 matching lines...) Expand all
581 594
582 chrome.fileBrowserPrivate.onFileChanged.addListener( 595 chrome.fileBrowserPrivate.onFileChanged.addListener(
583 this.onFileChanged_.bind(this)); 596 this.onFileChanged_.bind(this));
584 597
585 var self = this; 598 var self = this;
586 599
587 // The list of callbacks to be invoked during the directory rescan after 600 // The list of callbacks to be invoked during the directory rescan after
588 // all paste tasks are complete. 601 // all paste tasks are complete.
589 this.pasteSuccessCallbacks_ = []; 602 this.pasteSuccessCallbacks_ = [];
590 603
591 // The list of active mount points to distinct them from other directories.
592 chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) {
593 self.mountPoints_ = mountPoints;
594 });
595
596 this.initCommands_(); 604 this.initCommands_();
597 605
598 this.setupCurrentDirectory_(); 606 this.setupCurrentDirectory_();
599 607
600 this.summarizeSelection_(); 608 this.summarizeSelection_();
601 609
602 this.dataModel_.sort('cachedMtime_', 'desc'); 610 this.dataModel_.sort('cachedMtime_', 'desc');
603 611
604 this.refocus(); 612 this.refocus();
605 613
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 /** 649 /**
642 * One-time initialization of various DOM nodes. 650 * One-time initialization of various DOM nodes.
643 */ 651 */
644 FileManager.prototype.initDom_ = function() { 652 FileManager.prototype.initDom_ = function() {
645 // Cache nodes we'll be manipulating. 653 // Cache nodes we'll be manipulating.
646 this.previewThumbnails_ = 654 this.previewThumbnails_ =
647 this.dialogDom_.querySelector('.preview-thumbnails'); 655 this.dialogDom_.querySelector('.preview-thumbnails');
648 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); 656 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel');
649 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); 657 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename');
650 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); 658 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary');
651 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata');
652 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); 659 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input');
653 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons'); 660 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons');
654 this.okButton_ = this.dialogDom_.querySelector('.ok'); 661 this.okButton_ = this.dialogDom_.querySelector('.ok');
655 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); 662 this.cancelButton_ = this.dialogDom_.querySelector('.cancel');
656 this.newFolderButton_ = this.dialogDom_.querySelector('.new-folder'); 663 this.newFolderButton_ = this.dialogDom_.querySelector('.new-folder');
657 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button'); 664 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button');
658 665
659 this.downloadsWarning_ = 666 this.downloadsWarning_ =
660 this.dialogDom_.querySelector('.downloads-warning'); 667 this.dialogDom_.querySelector('.downloads-warning');
661 var html = util.htmlUnescape(str('DOWNLOADS_DIRECTORY_WARNING')); 668 var html = util.htmlUnescape(str('DOWNLOADS_DIRECTORY_WARNING'));
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 cr.ui.contextMenuHandler.addContextMenuProperty(this.grid_); 1133 cr.ui.contextMenuHandler.addContextMenuProperty(this.grid_);
1127 this.grid_.contextMenu = this.fileContextMenu_; 1134 this.grid_.contextMenu = this.fileContextMenu_;
1128 this.grid_.addEventListener('mousedown', 1135 this.grid_.addEventListener('mousedown',
1129 this.onGridMouseDown_.bind(this)); 1136 this.onGridMouseDown_.bind(this));
1130 }; 1137 };
1131 1138
1132 /** 1139 /**
1133 * Initialize the file list table. 1140 * Initialize the file list table.
1134 */ 1141 */
1135 FileManager.prototype.initTable_ = function() { 1142 FileManager.prototype.initTable_ = function() {
1136 var checkWidth = this.showCheckboxes_ ? 5 : 0;
1137
1138 var columns = [ 1143 var columns = [
1139 new cr.ui.table.TableColumn('cachedIconType_', '',
1140 5.4 + checkWidth),
1141 new cr.ui.table.TableColumn('name', str('NAME_COLUMN_LABEL'), 1144 new cr.ui.table.TableColumn('name', str('NAME_COLUMN_LABEL'),
1142 64 - checkWidth), 1145 64),
1143 new cr.ui.table.TableColumn('cachedSize_', 1146 new cr.ui.table.TableColumn('cachedSize_',
1144 str('SIZE_COLUMN_LABEL'), 15.5), 1147 str('SIZE_COLUMN_LABEL'), 15.5),
1145 new cr.ui.table.TableColumn('type', 1148 new cr.ui.table.TableColumn('type',
1146 str('TYPE_COLUMN_LABEL'), 15.5), 1149 str('TYPE_COLUMN_LABEL'), 15.5),
1147 new cr.ui.table.TableColumn('cachedMtime_', 1150 new cr.ui.table.TableColumn('cachedMtime_',
1148 str('DATE_COLUMN_LABEL'), 21) 1151 str('DATE_COLUMN_LABEL'), 21)
1149 ]; 1152 ];
1150 1153
1151 columns[0].renderFunction = this.renderIconType_.bind(this); 1154 columns[0].renderFunction = this.renderName_.bind(this);
1152 columns[1].renderFunction = this.renderName_.bind(this); 1155 columns[1].renderFunction = this.renderSize_.bind(this);
1153 columns[2].renderFunction = this.renderSize_.bind(this); 1156 columns[2].renderFunction = this.renderType_.bind(this);
1154 columns[3].renderFunction = this.renderType_.bind(this); 1157 columns[3].renderFunction = this.renderDate_.bind(this);
1155 columns[4].renderFunction = this.renderDate_.bind(this); 1158
1159 if (this.showCheckboxes_) {
1160 columns.unshift(new cr.ui.table.TableColumn('checkbox_', '', 3));
1161 columns[0].renderFunction = this.renderCheckbox_.bind(this);
1162 }
1156 1163
1157 this.table_ = this.dialogDom_.querySelector('.detail-table'); 1164 this.table_ = this.dialogDom_.querySelector('.detail-table');
1158 cr.ui.Table.decorate(this.table_); 1165 cr.ui.Table.decorate(this.table_);
1159 1166
1160 this.table_.selectionModel = new this.selectionModelClass_(); 1167 this.table_.selectionModel = new this.selectionModelClass_();
1161 this.table_.columnModel = new cr.ui.table.TableColumnModel(columns); 1168 this.table_.columnModel = new cr.ui.table.TableColumnModel(columns);
1162 1169
1163 this.table_.addEventListener( 1170 this.table_.addEventListener(
1164 'dblclick', this.onDetailDoubleClick_.bind(this)); 1171 'dblclick', this.onDetailDoubleClick_.bind(this));
1165 this.table_.selectionModel.addEventListener( 1172 this.table_.selectionModel.addEventListener(
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 * Invoked by cr.ui.Table when a file needs to be rendered. 1635 * Invoked by cr.ui.Table when a file needs to be rendered.
1629 * 1636 *
1630 * @param {Entry} entry The Entry object to render. 1637 * @param {Entry} entry The Entry object to render.
1631 * @param {string} columnId The id of the column to be rendered. 1638 * @param {string} columnId The id of the column to be rendered.
1632 * @param {cr.ui.Table} table The table doing the rendering. 1639 * @param {cr.ui.Table} table The table doing the rendering.
1633 */ 1640 */
1634 FileManager.prototype.renderIconType_ = function(entry, columnId, table) { 1641 FileManager.prototype.renderIconType_ = function(entry, columnId, table) {
1635 var div = this.document_.createElement('div'); 1642 var div = this.document_.createElement('div');
1636 div.className = 'detail-icon-container'; 1643 div.className = 'detail-icon-container';
1637 1644
1638 if (this.showCheckboxes_)
1639 div.appendChild(this.renderCheckbox_(entry));
1640
1641 var icon = this.document_.createElement('div'); 1645 var icon = this.document_.createElement('div');
1642 icon.className = 'detail-icon'; 1646 icon.className = 'detail-icon';
1643 this.getIconType(entry); 1647 this.getIconType(entry);
1644 icon.setAttribute('iconType', entry.cachedIconType_); 1648 icon.setAttribute('iconType', entry.cachedIconType_);
1645 div.appendChild(icon); 1649 div.appendChild(icon);
1646 1650
1647 return div; 1651 return div;
1648 }; 1652 };
1649 1653
1650 FileManager.prototype.getLabelForRootPath_ = function(path) { 1654 FileManager.prototype.getLabelForRootPath_ = function(path) {
(...skipping 14 matching lines...) Expand all
1665 * Render the Name column of the detail table. 1669 * Render the Name column of the detail table.
1666 * 1670 *
1667 * Invoked by cr.ui.Table when a file needs to be rendered. 1671 * Invoked by cr.ui.Table when a file needs to be rendered.
1668 * 1672 *
1669 * @param {Entry} entry The Entry object to render. 1673 * @param {Entry} entry The Entry object to render.
1670 * @param {string} columnId The id of the column to be rendered. 1674 * @param {string} columnId The id of the column to be rendered.
1671 * @param {cr.ui.Table} table The table doing the rendering. 1675 * @param {cr.ui.Table} table The table doing the rendering.
1672 */ 1676 */
1673 FileManager.prototype.renderName_ = function(entry, columnId, table) { 1677 FileManager.prototype.renderName_ = function(entry, columnId, table) {
1674 var label = this.document_.createElement('div'); 1678 var label = this.document_.createElement('div');
1679 label.appendChild(this.renderIconType_(entry, columnId, table));
1675 label.entry = entry; 1680 label.entry = entry;
1676 label.className = 'detail-name filename-label'; 1681 label.className = 'detail-name filename-label';
1677 if (this.currentDirEntry_.name == '') { 1682 if (this.currentDirEntry_.name == '') {
1678 label.textContent = this.getLabelForRootPath_(entry.name); 1683 label.appendChild(this.document_.createTextNode(
1684 this.getLabelForRootPath_(entry.name)));
1679 } else { 1685 } else {
1680 label.textContent = entry.name; 1686 label.appendChild(this.document_.createTextNode(entry.name));
1681 } 1687 }
1682 1688
1683 return label; 1689 return label;
1684 }; 1690 };
1685 1691
1686 /** 1692 /**
1687 * Render the Size column of the detail table. 1693 * Render the Size column of the detail table.
1688 * 1694 *
1689 * @param {Entry} entry The Entry object to render. 1695 * @param {Entry} entry The Entry object to render.
1690 * @param {string} columnId The id of the column to be rendered. 1696 * @param {string} columnId The id of the column to be rendered.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 } else { 1876 } else {
1871 // There may be internal tasks for directories. 1877 // There may be internal tasks for directories.
1872 this.onTasksFound_(selection, []); 1878 this.onTasksFound_(selection, []);
1873 } 1879 }
1874 } 1880 }
1875 1881
1876 cacheNextFile(); 1882 cacheNextFile();
1877 }; 1883 };
1878 1884
1879 FileManager.prototype.updatePreviewPanelVisibility_ = function() { 1885 FileManager.prototype.updatePreviewPanelVisibility_ = function() {
1880 var wasHidden = this.previewPanel_.hasAttribute('hidden'); 1886 var panel = this.previewPanel_;
1881 var hide = (this.selection.totalCount == 0); 1887 var state = panel.getAttribute('visibility');
1888 var mustBeVisible = (this.selection.totalCount > 0);
1889 var self = this;
1882 1890
1883 if (hide == wasHidden) 1891 switch (state) {
1884 return; 1892 case 'visible':
1893 if (!mustBeVisible)
1894 startHiding();
1895 break;
1885 1896
1886 if (this.hidingTimeout_) { 1897 case 'hiding':
1887 // Hiding is not complete. display == block. 1898 if (mustBeVisible)
1888 clearTimeout(this.hidingTimeout_); 1899 stopHidingAndShow();
1889 this.hidingTimeout_ = 0; 1900 break;
1890 } else if (wasHidden) { 1901
1891 // Hiding complete. display == none. 1902 case 'hidden':
1892 this.previewPanel_.style.display = ''; 1903 if (mustBeVisible)
1893 this.onResize_(); 1904 show();
1894 } 1905 }
1895 1906
1896 var self = this; 1907 function stopHidingAndShow() {
1897 if (hide) { 1908 clearTimeout(self.hidingTimeout_);
1898 this.previewPanel_.setAttribute('hidden', ''); 1909 self.hidingTimeout_ = 0;
1899 this.hidingTimeout_ = setTimeout(function() { 1910 setVisibility('visible');
1911 }
1912
1913 function startHiding() {
1914 setVisibility('hiding');
1915 self.hidingTimeout_ = setTimeout(function() {
1900 self.hidingTimeout_ = 0; 1916 self.hidingTimeout_ = 0;
1901 self.previewPanel_.style.display = 'none'; 1917 setVisibility('hidden');
1902 self.onResize_(); 1918 self.onResize_();
1903 }, 250); 1919 }, 250);
1904 } else { 1920 }
1905 this.previewPanel_.removeAttribute('hidden'); 1921
1922 function show() {
1923 setVisibility('visible');
1924 self.onResize_();
1925 }
1926
1927 function setVisibility(visibility) {
1928 panel.setAttribute('visibility', visibility);
1906 } 1929 }
1907 }; 1930 };
1908 1931
1909 1932
1910 FileManager.prototype.createMetadataProvider_ = function() { 1933 FileManager.prototype.createMetadataProvider_ = function() {
1911 // Subclass MetadataProvider to notify tests when the initialization 1934 // Subclass MetadataProvider to notify tests when the initialization
1912 // is complete. 1935 // is complete.
1913 1936
1914 var fileManager = this; 1937 var fileManager = this;
1915 1938
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 2345
2323 // Convert duration to milliseconds since time start 2346 // Convert duration to milliseconds since time start
2324 var date = new Date(parseInt(obj.value)); 2347 var date = new Date(parseInt(obj.value));
2325 2348
2326 var fmt = this.locale_.createDateTimeFormat({skeleton:fmtSkeleton}); 2349 var fmt = this.locale_.createDateTimeFormat({skeleton:fmtSkeleton});
2327 2350
2328 return fmt.format(date); 2351 return fmt.format(date);
2329 } 2352 }
2330 }; 2353 };
2331 2354
2332 FileManager.prototype.setPreviewMetadata = function(metadata) {
2333 this.previewMetadata_.textContent = '';
2334 if (!(metadata && metadata.ifd))
2335 return;
2336
2337 var self = this;
2338
2339 function addProperty(id, v) {
2340 var dom = self.document_.createElement('div');
2341 dom.className = 'metadata-item';
2342 var label = self.document_.createElement('div');
2343 label.className = 'metadata-label';
2344 label.textContent = str(id) || id;
2345 dom.appendChild(label);
2346 var value = self.document_.createElement('div');
2347 value.className = 'metadata-value';
2348 value.textContent = v;
2349 dom.appendChild(value);
2350
2351 self.previewMetadata_.appendChild(dom);
2352 }
2353
2354 // TODO(rginda): Split this function into metadata specific routines when
2355 // we add new metadata types.
2356 // TODO(rginda): Add const names for these numerics.
2357 var exifDir = metadata.ifd.exif;
2358 if (0xa002 in exifDir && 0xa003 in exifDir) {
2359 addProperty('DIMENSIONS_LABEL',
2360 strf('DIMENSIONS_FORMAT', exifDir[0xa002].value,
2361 exifDir[0xa003].value));
2362 }
2363 };
2364
2365 FileManager.prototype.getThumbnailURL = function(entry, callback) { 2355 FileManager.prototype.getThumbnailURL = function(entry, callback) {
2366 if (!entry) 2356 if (!entry)
2367 return; 2357 return;
2368 2358
2369 var iconType = this.getIconType(entry); 2359 var iconType = this.getIconType(entry);
2370 2360
2371 function returnStockIcon() { 2361 function returnStockIcon() {
2372 callback(iconType, previewArt[iconType] || previewArt['unknown']); 2362 callback(iconType, previewArt[iconType] || previewArt['unknown']);
2373 } 2363 }
2374 2364
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 }; 3184 };
3195 3185
3196 /** 3186 /**
3197 * Determine whether or not a click should initiate a rename. 3187 * Determine whether or not a click should initiate a rename.
3198 * 3188 *
3199 * Renames can happen on mouse click if the user clicks on a label twice, 3189 * Renames can happen on mouse click if the user clicks on a label twice,
3200 * at least a half second apart. 3190 * at least a half second apart.
3201 */ 3191 */
3202 FileManager.prototype.allowRenameClick_ = function(event, row) { 3192 FileManager.prototype.allowRenameClick_ = function(event, row) {
3203 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE || 3193 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE ||
3204 this.currentDirEntry_.name == '' || 3194 this.currentDirEntry_ == null || this.currentDirEntry_.name == '' ||
3205 isSystemDirEntry(this.currentDirEntry_)) { 3195 isSystemDirEntry(this.currentDirEntry_)) {
3206 // Renaming only enabled for full-page mode, outside of the root 3196 // Renaming only enabled for full-page mode, outside of the root
3207 // directory. 3197 // directory.
3208 return false; 3198 return false;
3209 } 3199 }
3210 3200
3211 // Didn't click on the label. 3201 // Didn't click on the label.
3212 if (!event.srcElement.classList.contains('filename-label')) 3202 if (!event.srcElement.classList.contains('filename-label'))
3213 return false; 3203 return false;
3214 3204
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3793 }); 3783 });
3794 }, onError); 3784 }, onError);
3795 3785
3796 function onError(err) { 3786 function onError(err) {
3797 console.log('Error while checking free space: ' + err); 3787 console.log('Error while checking free space: ' + err);
3798 setTimeout(doCheck, 1000 * 60); 3788 setTimeout(doCheck, 1000 * 60);
3799 } 3789 }
3800 } 3790 }
3801 } 3791 }
3802 })(); 3792 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698