| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 this.syncButton.checkable = true; | 615 this.syncButton.checkable = true; |
| 616 this.hostedButton.checkable = true; | 616 this.hostedButton.checkable = true; |
| 617 if (util.platform.newUI()) { | 617 if (util.platform.newUI()) { |
| 618 this.detailViewButton_.checkable = true; | 618 this.detailViewButton_.checkable = true; |
| 619 this.thumbnailViewButton_.checkable = true; | 619 this.thumbnailViewButton_.checkable = true; |
| 620 } | 620 } |
| 621 }; | 621 }; |
| 622 | 622 |
| 623 FileManager.prototype.onMaximize = function() { | 623 FileManager.prototype.onMaximize = function() { |
| 624 // Do not maximize when running via chrome://files in a browser. |
| 625 if (!chrome.app.window.contentWindow) |
| 626 return; |
| 627 |
| 624 var appWindow = chrome.app.window.current(); | 628 var appWindow = chrome.app.window.current(); |
| 625 if (appWindow.isMaximized()) | 629 if (appWindow.isMaximized()) |
| 626 appWindow.restore(); | 630 appWindow.restore(); |
| 627 else | 631 else |
| 628 appWindow.maximize(); | 632 appWindow.maximize(); |
| 629 }; | 633 }; |
| 630 | 634 |
| 631 FileManager.prototype.onClose = function() { | 635 FileManager.prototype.onClose = function() { |
| 636 // Do not close when running via chrome://files in a browser. |
| 637 if (!chrome.app.window.contentWindow) |
| 638 return; |
| 639 |
| 632 window.close(); | 640 window.close(); |
| 633 }; | 641 }; |
| 634 | 642 |
| 635 /** | 643 /** |
| 636 * One-time initialization of commands. | 644 * One-time initialization of commands. |
| 637 * @private | 645 * @private |
| 638 */ | 646 */ |
| 639 FileManager.prototype.initCommands_ = function() { | 647 FileManager.prototype.initCommands_ = function() { |
| 640 var commandButtons = this.dialogDom_.querySelectorAll('button[command]'); | 648 var commandButtons = this.dialogDom_.querySelectorAll('button[command]'); |
| 641 for (var j = 0; j < commandButtons.length; j++) | 649 for (var j = 0; j < commandButtons.length; j++) |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 | 879 |
| 872 // Initialize the new header. | 880 // Initialize the new header. |
| 873 if (util.platform.newUI()) { | 881 if (util.platform.newUI()) { |
| 874 this.dialogDom_.querySelector('#app-name').innerText = | 882 this.dialogDom_.querySelector('#app-name').innerText = |
| 875 chrome.runtime.getManifest().name; | 883 chrome.runtime.getManifest().name; |
| 876 } | 884 } |
| 877 | 885 |
| 878 this.initDialogType_(); | 886 this.initDialogType_(); |
| 879 | 887 |
| 880 // Show the window as soon as the UI pre-initialization is done. | 888 // Show the window as soon as the UI pre-initialization is done. |
| 881 // Do not call show() when running via chrome://files in a browser. | |
| 882 if (this.dialogType == DialogType.FULL_PAGE && util.platform.v2()) { | 889 if (this.dialogType == DialogType.FULL_PAGE && util.platform.v2()) { |
| 883 chrome.app.window.current().show(); | 890 // Do not call show() when running via chrome://files in a browser. |
| 884 setTimeout(callback, 100); // Wait until the animation is finished. | 891 if (chrome.app.window.contentWindow) { |
| 892 chrome.app.window.current().show(); |
| 893 setTimeout(callback, 100); // Wait until the animation is finished. |
| 894 } else { |
| 895 console.info('Files.app window is not created yet. Maybe launched ' + |
| 896 'via chrome://files in a browser?'); |
| 897 callback(); |
| 898 } |
| 885 } else { | 899 } else { |
| 886 callback(); | 900 callback(); |
| 887 } | 901 } |
| 888 }; | 902 }; |
| 889 | 903 |
| 890 /** | 904 /** |
| 891 * One-time initialization of dialogs. | 905 * One-time initialization of dialogs. |
| 892 * @private | 906 * @private |
| 893 */ | 907 */ |
| 894 FileManager.prototype.initDialogs_ = function() { | 908 FileManager.prototype.initDialogs_ = function() { |
| (...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3896 * Set the flag expressing whether the ctrl key is pressed or not. | 3910 * Set the flag expressing whether the ctrl key is pressed or not. |
| 3897 * @param {boolean} flag New value of the flag | 3911 * @param {boolean} flag New value of the flag |
| 3898 * @private | 3912 * @private |
| 3899 */ | 3913 */ |
| 3900 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3914 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
| 3901 this.ctrlKeyPressed_ = flag; | 3915 this.ctrlKeyPressed_ = flag; |
| 3902 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3916 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
| 3903 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3917 this.document_.querySelector('#drive-reload').canExecuteChange(); |
| 3904 }; | 3918 }; |
| 3905 })(); | 3919 })(); |
| OLD | NEW |