| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 624 // Do not maximize when running via chrome://files in a browser. |
| 625 if (!chrome.app.window.contentWindow) | 625 if (util.platform.runningInBrowser()) |
| 626 return; | 626 return; |
| 627 | 627 |
| 628 var appWindow = chrome.app.window.current(); | 628 var appWindow = chrome.app.window.current(); |
| 629 if (appWindow.isMaximized()) | 629 if (appWindow.isMaximized()) |
| 630 appWindow.restore(); | 630 appWindow.restore(); |
| 631 else | 631 else |
| 632 appWindow.maximize(); | 632 appWindow.maximize(); |
| 633 }; | 633 }; |
| 634 | 634 |
| 635 FileManager.prototype.onClose = function() { | 635 FileManager.prototype.onClose = function() { |
| 636 // Do not close when running via chrome://files in a browser. | 636 // Do not close when running via chrome://files in a browser. |
| 637 if (!chrome.app.window.contentWindow) | 637 if (util.platform.runningInBrowser()) |
| 638 return; | 638 return; |
| 639 | 639 |
| 640 window.close(); | 640 window.close(); |
| 641 }; | 641 }; |
| 642 | 642 |
| 643 /** | 643 /** |
| 644 * One-time initialization of commands. | 644 * One-time initialization of commands. |
| 645 * @private | 645 * @private |
| 646 */ | 646 */ |
| 647 FileManager.prototype.initCommands_ = function() { | 647 FileManager.prototype.initCommands_ = function() { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 | 879 |
| 880 // Initialize the new header. | 880 // Initialize the new header. |
| 881 if (util.platform.newUI()) { | 881 if (util.platform.newUI()) { |
| 882 this.dialogDom_.querySelector('#app-name').innerText = | 882 this.dialogDom_.querySelector('#app-name').innerText = |
| 883 chrome.runtime.getManifest().name; | 883 chrome.runtime.getManifest().name; |
| 884 } | 884 } |
| 885 | 885 |
| 886 this.initDialogType_(); | 886 this.initDialogType_(); |
| 887 | 887 |
| 888 // 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. |
| 889 if (this.dialogType == DialogType.FULL_PAGE && util.platform.v2()) { | 889 if (this.dialogType == DialogType.FULL_PAGE && |
| 890 // Do not call show() when running via chrome://files in a browser. | 890 util.platform.v2() && |
| 891 if (chrome.app.window.contentWindow) { | 891 !util.platform.runningInBrowser()) { |
| 892 chrome.app.window.current().show(); | 892 chrome.app.window.current().show(); |
| 893 setTimeout(callback, 100); // Wait until the animation is finished. | 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 } | |
| 899 } else { | 894 } else { |
| 900 callback(); | 895 callback(); |
| 901 } | 896 } |
| 902 }; | 897 }; |
| 903 | 898 |
| 904 /** | 899 /** |
| 905 * One-time initialization of dialogs. | 900 * One-time initialization of dialogs. |
| 906 * @private | 901 * @private |
| 907 */ | 902 */ |
| 908 FileManager.prototype.initDialogs_ = function() { | 903 FileManager.prototype.initDialogs_ = function() { |
| (...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3910 * Set the flag expressing whether the ctrl key is pressed or not. | 3905 * Set the flag expressing whether the ctrl key is pressed or not. |
| 3911 * @param {boolean} flag New value of the flag | 3906 * @param {boolean} flag New value of the flag |
| 3912 * @private | 3907 * @private |
| 3913 */ | 3908 */ |
| 3914 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3909 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
| 3915 this.ctrlKeyPressed_ = flag; | 3910 this.ctrlKeyPressed_ = flag; |
| 3916 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3911 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
| 3917 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3912 this.document_.querySelector('#drive-reload').canExecuteChange(); |
| 3918 }; | 3913 }; |
| 3919 })(); | 3914 })(); |
| OLD | NEW |