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

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

Issue 8271025: Moved mobile activation into its own modal dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 this.currentButter_ = null; 51 this.currentButter_ = null;
52 52
53 // True if we should filter out files that start with a dot. 53 // True if we should filter out files that start with a dot.
54 this.filterFiles_ = true; 54 this.filterFiles_ = true;
55 55
56 this.commands_ = {}; 56 this.commands_ = {};
57 57
58 this.document_ = dialogDom.ownerDocument; 58 this.document_ = dialogDom.ownerDocument;
59 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; 59 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE;
60 60
61 this.alert = new cr.ui.dialogs.AlertDialog(this.dialogDom_); 61 this.initDialogs_();
62 this.confirm = new cr.ui.dialogs.ConfirmDialog(this.dialogDom_);
63 this.prompt = new cr.ui.dialogs.PromptDialog(this.dialogDom_);
64 62
65 // TODO(dgozman): This will be changed to LocaleInfo. 63 // TODO(dgozman): This will be changed to LocaleInfo.
66 this.locale_ = new v8Locale(navigator.language); 64 this.locale_ = new v8Locale(navigator.language);
67 65
68 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is 66 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is
69 // available in all chrome trunk builds. 67 // available in all chrome trunk builds.
70 if ('createDateTimeFormat' in this.locale_) { 68 if ('createDateTimeFormat' in this.locale_) {
71 this.shortDateFormatter_ = 69 this.shortDateFormatter_ =
72 this.locale_.createDateTimeFormat({'dateType': 'medium'}); 70 this.locale_.createDateTimeFormat({'dateType': 'medium'});
73 } else { 71 } else {
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 535
538 this.fileContextMenu_ = this.dialogDom_.querySelector('.file-context-menu'); 536 this.fileContextMenu_ = this.dialogDom_.querySelector('.file-context-menu');
539 cr.ui.Menu.decorate(this.fileContextMenu_); 537 cr.ui.Menu.decorate(this.fileContextMenu_);
540 538
541 this.document_.addEventListener('canExecute', 539 this.document_.addEventListener('canExecute',
542 this.onCanExecute_.bind(this)); 540 this.onCanExecute_.bind(this));
543 this.document_.addEventListener('command', this.onCommand_.bind(this)); 541 this.document_.addEventListener('command', this.onCommand_.bind(this));
544 } 542 }
545 543
546 /** 544 /**
545 * One-time initialization of dialogs.
546 */
547 FileManager.prototype.initDialogs_ = function() {
548 cr.ui.dialogs.BaseDialog.OK_LABEL = str('OK_LABEL');
549 cr.ui.dialogs.BaseDialog.CANCEL_LABEL = str('CANCEL_LABEL');
550 this.alert = new cr.ui.dialogs.AlertDialog(this.dialogDom_);
551 this.confirm = new cr.ui.dialogs.ConfirmDialog(this.dialogDom_);
552 this.prompt = new cr.ui.dialogs.PromptDialog(this.dialogDom_);
553 };
554
555 /**
547 * One-time initialization of various DOM nodes. 556 * One-time initialization of various DOM nodes.
548 */ 557 */
549 FileManager.prototype.initDom_ = function() { 558 FileManager.prototype.initDom_ = function() {
550 // Cache nodes we'll be manipulating. 559 // Cache nodes we'll be manipulating.
551 this.previewImage_ = this.dialogDom_.querySelector('.preview-img'); 560 this.previewImage_ = this.dialogDom_.querySelector('.preview-img');
552 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); 561 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename');
553 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); 562 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary');
554 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata'); 563 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata');
555 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); 564 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input');
556 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons'); 565 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons');
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 * Get the icon type for a given Entry. 662 * Get the icon type for a given Entry.
654 * 663 *
655 * @param {Entry} entry An Entry subclass (FileEntry or DirectoryEntry). 664 * @param {Entry} entry An Entry subclass (FileEntry or DirectoryEntry).
656 * @return {string} One of the keys from FileManager.iconTypes, or 665 * @return {string} One of the keys from FileManager.iconTypes, or
657 * 'unknown'. 666 * 'unknown'.
658 */ 667 */
659 FileManager.prototype.getIconType = function(entry) { 668 FileManager.prototype.getIconType = function(entry) {
660 if (!('cachedIconType_' in entry)) 669 if (!('cachedIconType_' in entry))
661 entry.cachedIconType_ = this.computeIconType_(entry); 670 entry.cachedIconType_ = this.computeIconType_(entry);
662 return entry.cachedIconType_; 671 return entry.cachedIconType_;
663 } 672 };
664 673
665 /** 674 /**
666 * Extract extension from the file name and cat it to to lower case. 675 * Extract extension from the file name and cat it to to lower case.
667 * 676 *
668 * @param {string} name. 677 * @param {string} name.
669 * @return {strin} 678 * @return {strin}
670 */ 679 */
671 function getFileExtension(name) { 680 function getFileExtension(name) {
672 var extIndex = name.lastIndexOf('.'); 681 var extIndex = name.lastIndexOf('.');
673 if (extIndex < 0) 682 if (extIndex < 0)
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 3620
3612 if (msg) { 3621 if (msg) {
3613 console.log('no no no'); 3622 console.log('no no no');
3614 this.alert.show(msg, onAccept); 3623 this.alert.show(msg, onAccept);
3615 return false; 3624 return false;
3616 } 3625 }
3617 3626
3618 return true; 3627 return true;
3619 }; 3628 };
3620 })(); 3629 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698