OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * This variable is checked in SelectFileDialogExtensionBrowserTest. | 8 * This variable is checked in SelectFileDialogExtensionBrowserTest. |
9 * @type {number} | 9 * @type {number} |
10 */ | 10 */ |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 var commands = this.dialogDom_.querySelectorAll('command'); | 618 var commands = this.dialogDom_.querySelectorAll('command'); |
619 for (var i = 0; i < commands.length; i++) | 619 for (var i = 0; i < commands.length; i++) |
620 cr.ui.Command.decorate(commands[i]); | 620 cr.ui.Command.decorate(commands[i]); |
621 | 621 |
622 var doc = this.document_; | 622 var doc = this.document_; |
623 | 623 |
624 CommandUtil.registerCommand(doc, 'newfolder', | 624 CommandUtil.registerCommand(doc, 'newfolder', |
625 Commands.newFolderCommand, this, this.directoryModel_); | 625 Commands.newFolderCommand, this, this.directoryModel_); |
626 | 626 |
627 CommandUtil.registerCommand(doc, 'newwindow', | 627 CommandUtil.registerCommand(doc, 'newwindow', |
628 Commands.newWindowCommand, this); | 628 Commands.newWindowCommand, this, this.directoryModel_); |
629 | 629 |
630 CommandUtil.registerCommand(doc, 'change-default-app', | 630 CommandUtil.registerCommand(doc, 'change-default-app', |
631 Commands.changeDefaultAppCommand, this); | 631 Commands.changeDefaultAppCommand, this); |
632 | 632 |
633 CommandUtil.registerCommand(this.volumeList_, 'unmount', | 633 CommandUtil.registerCommand(this.volumeList_, 'unmount', |
634 Commands.unmountCommand, this.volumeList_, this); | 634 Commands.unmountCommand, this.volumeList_, this); |
635 | 635 |
636 CommandUtil.registerCommand(this.volumeList_, 'import-photos', | 636 CommandUtil.registerCommand(this.volumeList_, 'import-photos', |
637 Commands.importCommand, this.volumeList_); | 637 Commands.importCommand, this.volumeList_); |
638 | 638 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 callback(); | 783 callback(); |
784 }; | 784 }; |
785 | 785 |
786 /** | 786 /** |
787 * One time initialization of strings (mostly i18n). | 787 * One time initialization of strings (mostly i18n). |
788 * | 788 * |
789 * @param {function()} callback Completion callback. | 789 * @param {function()} callback Completion callback. |
790 * @private | 790 * @private |
791 */ | 791 */ |
792 FileManager.prototype.initStrings_ = function(callback) { | 792 FileManager.prototype.initStrings_ = function(callback) { |
793 chrome.fileBrowserPrivate.getStrings(function(strings) { | 793 // Fetch the strings via the private api if running in the browser window. |
794 loadTimeData.data = strings; | 794 // Otherwise, read cached strings from the local storage. |
795 this.loadTimeDataAvailable = true; | 795 if (util.platform.runningInBrowser()) { |
796 callback(); | 796 chrome.fileBrowserPrivate.getStrings(function(strings) { |
797 }); | 797 loadTimeData.data = strings; |
| 798 callback(); |
| 799 }); |
| 800 } else { |
| 801 chrome.storage.local.get('strings', function(items) { |
| 802 loadTimeData.data = items['strings']; |
| 803 callback(); |
| 804 }); |
| 805 } |
798 }; | 806 }; |
799 | 807 |
800 /** | 808 /** |
801 * One time initialization of the Files.app's essential UI elements. These | 809 * One time initialization of the Files.app's essential UI elements. These |
802 * elements will be shown to the user. Only visible elements should be | 810 * elements will be shown to the user. Only visible elements should be |
803 * initialized here. Any heavy operation should be avoided. Files.app's | 811 * initialized here. Any heavy operation should be avoided. Files.app's |
804 * window is shown at the end of this routine. | 812 * window is shown at the end of this routine. |
805 * | 813 * |
806 * @param {function()} callback Completion callback. | 814 * @param {function()} callback Completion callback. |
807 * @private | 815 * @private |
(...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3808 * Set the flag expressing whether the ctrl key is pressed or not. | 3816 * Set the flag expressing whether the ctrl key is pressed or not. |
3809 * @param {boolean} flag New value of the flag | 3817 * @param {boolean} flag New value of the flag |
3810 * @private | 3818 * @private |
3811 */ | 3819 */ |
3812 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3820 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
3813 this.ctrlKeyPressed_ = flag; | 3821 this.ctrlKeyPressed_ = flag; |
3814 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3822 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
3815 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3823 this.document_.querySelector('#drive-reload').canExecuteChange(); |
3816 }; | 3824 }; |
3817 })(); | 3825 })(); |
OLD | NEW |