| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 this.gearButton_ = this.dialogDom_.querySelector('#gear-button'); | 559 this.gearButton_ = this.dialogDom_.querySelector('#gear-button'); |
| 560 this.gearButton_.addEventListener('menushow', | 560 this.gearButton_.addEventListener('menushow', |
| 561 this.refreshRemainingSpace_.bind(this, | 561 this.refreshRemainingSpace_.bind(this, |
| 562 false /* Without loading caption. */)); | 562 false /* Without loading caption. */)); |
| 563 cr.ui.decorate(this.gearButton_, cr.ui.MenuButton); | 563 cr.ui.decorate(this.gearButton_, cr.ui.MenuButton); |
| 564 this.dialogDom_.querySelector('#gear-menu').menuItemSelector = | 564 this.dialogDom_.querySelector('#gear-menu').menuItemSelector = |
| 565 'menuitem, hr'; | 565 'menuitem, hr'; |
| 566 | 566 |
| 567 if (util.platform.newUI() && this.dialogType == DialogType.FULL_PAGE) { | 567 if (util.platform.newUI() && this.dialogType == DialogType.FULL_PAGE) { |
| 568 var maximizeButton = this.dialogDom_.querySelector('#maximize-button'); | 568 var maximizeButton = this.dialogDom_.querySelector('#maximize-button'); |
| 569 maximizeButton.addEventListener('click', function() { | 569 maximizeButton.addEventListener('click', this.onMaximize.bind(this)); |
| 570 var appWindow = chrome.app.window.current(); | |
| 571 if (appWindow.isMaximized()) | |
| 572 appWindow.restore(); | |
| 573 else | |
| 574 appWindow.maximize(); | |
| 575 }); | |
| 576 | 570 |
| 577 var closeButton = this.dialogDom_.querySelector('#close-button'); | 571 var closeButton = this.dialogDom_.querySelector('#close-button'); |
| 578 closeButton.addEventListener('click', function() { | 572 closeButton.addEventListener('click', this.onClose.bind(this)); |
| 579 window.close(); | |
| 580 }); | |
| 581 } | 573 } |
| 582 | 574 |
| 583 this.syncButton.checkable = true; | 575 this.syncButton.checkable = true; |
| 584 this.hostedButton.checkable = true; | 576 this.hostedButton.checkable = true; |
| 585 if (util.platform.newUI()) { | 577 if (util.platform.newUI()) { |
| 586 this.detailViewButton_.checkable = true; | 578 this.detailViewButton_.checkable = true; |
| 587 this.thumbnailViewButton_.checkable = true; | 579 this.thumbnailViewButton_.checkable = true; |
| 588 } | 580 } |
| 589 }; | 581 }; |
| 590 | 582 |
| 583 FileManager.prototype.onMaximize = function() { |
| 584 var appWindow = chrome.app.window.current(); |
| 585 if (appWindow.isMaximized()) |
| 586 appWindow.restore(); |
| 587 else |
| 588 appWindow.maximize(); |
| 589 }; |
| 590 |
| 591 FileManager.prototype.onClose = function() { |
| 592 window.close(); |
| 593 }; |
| 594 |
| 591 /** | 595 /** |
| 592 * One-time initialization of commands. | 596 * One-time initialization of commands. |
| 593 * @private | 597 * @private |
| 594 */ | 598 */ |
| 595 FileManager.prototype.initCommands_ = function() { | 599 FileManager.prototype.initCommands_ = function() { |
| 596 var commandButtons = this.dialogDom_.querySelectorAll('button[command]'); | 600 var commandButtons = this.dialogDom_.querySelectorAll('button[command]'); |
| 597 for (var j = 0; j < commandButtons.length; j++) | 601 for (var j = 0; j < commandButtons.length; j++) |
| 598 CommandButton.decorate(commandButtons[j]); | 602 CommandButton.decorate(commandButtons[j]); |
| 599 | 603 |
| 600 // TODO(dzvorygin): Here we use this hack, since 'hidden' is standard | 604 // TODO(dzvorygin): Here we use this hack, since 'hidden' is standard |
| (...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3606 * Set the flag expressing whether the ctrl key is pressed or not. | 3610 * Set the flag expressing whether the ctrl key is pressed or not. |
| 3607 * @param {boolean} flag New value of the flag | 3611 * @param {boolean} flag New value of the flag |
| 3608 * @private | 3612 * @private |
| 3609 */ | 3613 */ |
| 3610 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3614 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
| 3611 this.ctrlKeyPressed_ = flag; | 3615 this.ctrlKeyPressed_ = flag; |
| 3612 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3616 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
| 3613 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3617 this.document_.querySelector('#drive-reload').canExecuteChange(); |
| 3614 }; | 3618 }; |
| 3615 })(); | 3619 })(); |
| OLD | NEW |