| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @param {!cr.ui.MenuButton} gearButton | 6 * @param {!cr.ui.MenuButton} gearButton |
| 7 * @param {!FilesToggleRipple} toggleRipple | 7 * @param {!FilesToggleRipple} toggleRipple |
| 8 * @param {!GearMenu} gearMenu | 8 * @param {!GearMenu} gearMenu |
| 9 * @param {!DirectoryModel} directoryModel | 9 * @param {!DirectoryModel} directoryModel |
| 10 * @param {!CommandHandler} commandHandler | 10 * @param {!CommandHandler} commandHandler |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 * @private | 84 * @private |
| 85 */ | 85 */ |
| 86 GearMenuController.prototype.refreshRemainingSpace_ = | 86 GearMenuController.prototype.refreshRemainingSpace_ = |
| 87 function(showLoadingCaption) { | 87 function(showLoadingCaption) { |
| 88 var currentVolumeInfo = this.directoryModel_.getCurrentVolumeInfo(); | 88 var currentVolumeInfo = this.directoryModel_.getCurrentVolumeInfo(); |
| 89 if (!currentVolumeInfo) | 89 if (!currentVolumeInfo) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 // TODO(mtomasz): Add support for remaining space indication for provided | 92 // TODO(mtomasz): Add support for remaining space indication for provided |
| 93 // file systems. | 93 // file systems. |
| 94 if (currentVolumeInfo.volumeType == VolumeManagerCommon.VolumeType.PROVIDED) { | 94 if (currentVolumeInfo.volumeType == VolumeManagerCommon.VolumeType.PROVIDED || |
| 95 currentVolumeInfo.volumeType == |
| 96 VolumeManagerCommon.VolumeType.MEDIA_VIEW) { |
| 95 this.gearMenu_.setSpaceInfo(null, false); | 97 this.gearMenu_.setSpaceInfo(null, false); |
| 96 return; | 98 return; |
| 97 } | 99 } |
| 98 | 100 |
| 99 this.gearMenu_.setSpaceInfo(new Promise(function(fulfill) { | 101 this.gearMenu_.setSpaceInfo(new Promise(function(fulfill) { |
| 100 chrome.fileManagerPrivate.getSizeStats(currentVolumeInfo.volumeId, fulfill); | 102 chrome.fileManagerPrivate.getSizeStats(currentVolumeInfo.volumeId, fulfill); |
| 101 }), true); | 103 }), true); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 /** | 106 /** |
| 105 * Handles preferences change and updates menu. | 107 * Handles preferences change and updates menu. |
| 106 * @private | 108 * @private |
| 107 */ | 109 */ |
| 108 GearMenuController.prototype.onPreferencesChanged_ = function() { | 110 GearMenuController.prototype.onPreferencesChanged_ = function() { |
| 109 chrome.fileManagerPrivate.getPreferences(function(prefs) { | 111 chrome.fileManagerPrivate.getPreferences(function(prefs) { |
| 110 if (chrome.runtime.lastError) | 112 if (chrome.runtime.lastError) |
| 111 return; | 113 return; |
| 112 | 114 |
| 113 if (prefs.cellularDisabled) | 115 if (prefs.cellularDisabled) |
| 114 this.gearMenu_.syncButton.setAttribute('checked', ''); | 116 this.gearMenu_.syncButton.setAttribute('checked', ''); |
| 115 else | 117 else |
| 116 this.gearMenu_.syncButton.removeAttribute('checked'); | 118 this.gearMenu_.syncButton.removeAttribute('checked'); |
| 117 | 119 |
| 118 if (!prefs.hostedFilesDisabled) | 120 if (!prefs.hostedFilesDisabled) |
| 119 this.gearMenu_.hostedButton.setAttribute('checked', ''); | 121 this.gearMenu_.hostedButton.setAttribute('checked', ''); |
| 120 else | 122 else |
| 121 this.gearMenu_.hostedButton.removeAttribute('checked'); | 123 this.gearMenu_.hostedButton.removeAttribute('checked'); |
| 122 }.bind(this)); | 124 }.bind(this)); |
| 123 }; | 125 }; |
| OLD | NEW |