| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 6 /** |
| 7 * An item in the model. Represents a single providing extension. | 7 * An item in the model. Represents a single providing extension. |
| 8 * | 8 * |
| 9 * @param {string} extensionId | 9 * @param {string} extensionId |
| 10 * @param {string} extensionName | 10 * @param {string} extensionName |
| 11 * @param {boolean} configurable | 11 * @param {boolean} configurable |
| 12 * @param {boolean} watchable |
| 12 * @param {boolean} multipleMounts | 13 * @param {boolean} multipleMounts |
| 13 * @param {string} source | 14 * @param {string} source |
| 14 * @constructor | 15 * @constructor |
| 15 * @struct | 16 * @struct |
| 16 */ | 17 */ |
| 17 function ProvidersModelItem( | 18 function ProvidersModelItem( |
| 18 extensionId, extensionName, configurable, multipleMounts, source) { | 19 extensionId, extensionName, configurable, watchable, multipleMounts, |
| 20 source) { |
| 19 /** | 21 /** |
| 20 * @private {string} | 22 * @private {string} |
| 21 * @const | 23 * @const |
| 22 */ | 24 */ |
| 23 this.extensionId_ = extensionId; | 25 this.extensionId_ = extensionId; |
| 24 | 26 |
| 25 /** | 27 /** |
| 26 * @private {string} | 28 * @private {string} |
| 27 * @const | 29 * @const |
| 28 */ | 30 */ |
| 29 this.extensionName_ = extensionName; | 31 this.extensionName_ = extensionName; |
| 30 | 32 |
| 31 /** | 33 /** |
| 32 * @private {boolean} | 34 * @private {boolean} |
| 33 * @const | 35 * @const |
| 34 */ | 36 */ |
| 35 this.configurable_ = configurable; | 37 this.configurable_ = configurable; |
| 36 | 38 |
| 37 /** | 39 /** |
| 38 * @private {boolean} | 40 * @private {boolean} |
| 39 * @const | 41 * @const |
| 40 */ | 42 */ |
| 43 this.watchable_ = watchable; |
| 44 |
| 45 /** |
| 46 * @private {boolean} |
| 47 * @const |
| 48 */ |
| 41 this.multipleMounts_ = multipleMounts; | 49 this.multipleMounts_ = multipleMounts; |
| 42 | 50 |
| 43 /** | 51 /** |
| 44 * @private {string} | 52 * @private {string} |
| 45 * @const | 53 * @const |
| 46 */ | 54 */ |
| 47 this.source_ = source; | 55 this.source_ = source; |
| 48 } | 56 } |
| 49 | 57 |
| 50 ProvidersModelItem.prototype = { | 58 ProvidersModelItem.prototype = { |
| 51 /** | 59 /** |
| 52 * @return {string} | 60 * @return {string} |
| 53 */ | 61 */ |
| 54 get extensionId() { return this.extensionId_; }, | 62 get extensionId() { return this.extensionId_; }, |
| 55 | 63 |
| 56 /** | 64 /** |
| 57 * @return {string} | 65 * @return {string} |
| 58 */ | 66 */ |
| 59 get extensionName() { return this.extensionName_; }, | 67 get extensionName() { return this.extensionName_; }, |
| 60 | 68 |
| 61 /** | 69 /** |
| 62 * @return {boolean} | 70 * @return {boolean} |
| 63 */ | 71 */ |
| 64 get configurable() { return this.configurable_; }, | 72 get configurable() { return this.configurable_; }, |
| 65 | 73 |
| 66 /** | 74 /** |
| 67 * @return {boolean} | 75 * @return {boolean} |
| 68 */ | 76 */ |
| 77 get watchable() { return this.watchable_; }, |
| 78 |
| 79 /** |
| 80 * @return {boolean} |
| 81 */ |
| 69 get multipleMounts() { return this.multipleMounts_; }, | 82 get multipleMounts() { return this.multipleMounts_; }, |
| 70 | 83 |
| 71 /** | 84 /** |
| 72 * @return {string} | 85 * @return {string} |
| 73 */ | 86 */ |
| 74 get source() { return this.source_; } | 87 get source() { return this.source_; } |
| 75 }; | 88 }; |
| 76 | 89 |
| 77 /** | 90 /** |
| 78 * Model for providing extensions. Providers methods for fetching lists of | 91 * Model for providing extensions. Providers methods for fetching lists of |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 if (chrome.runtime.lastError) { | 114 if (chrome.runtime.lastError) { |
| 102 reject(chrome.runtime.lastError.message); | 115 reject(chrome.runtime.lastError.message); |
| 103 return; | 116 return; |
| 104 } | 117 } |
| 105 var results = []; | 118 var results = []; |
| 106 extensions.forEach(function(extension) { | 119 extensions.forEach(function(extension) { |
| 107 results.push(new ProvidersModelItem( | 120 results.push(new ProvidersModelItem( |
| 108 extension.extensionId, | 121 extension.extensionId, |
| 109 extension.name, | 122 extension.name, |
| 110 extension.configurable, | 123 extension.configurable, |
| 124 extension.watchable, |
| 111 extension.multipleMounts, | 125 extension.multipleMounts, |
| 112 extension.source)); | 126 extension.source)); |
| 113 }); | 127 }); |
| 114 fulfill(results); | 128 fulfill(results); |
| 115 }); | 129 }); |
| 116 }); | 130 }); |
| 117 }; | 131 }; |
| 118 | 132 |
| 119 /** | 133 /** |
| 120 * @return {!Promise<Array<ProvidersModelItem>>} | 134 * @return {!Promise<Array<ProvidersModelItem>>} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 141 * @param {string} extensionId | 155 * @param {string} extensionId |
| 142 */ | 156 */ |
| 143 ProvidersModel.prototype.requestMount = function(extensionId) { | 157 ProvidersModel.prototype.requestMount = function(extensionId) { |
| 144 chrome.fileManagerPrivate.addProvidedFileSystem( | 158 chrome.fileManagerPrivate.addProvidedFileSystem( |
| 145 assert(extensionId), | 159 assert(extensionId), |
| 146 function() { | 160 function() { |
| 147 if (chrome.runtime.lastError) | 161 if (chrome.runtime.lastError) |
| 148 console.error(chrome.runtime.lastError.message); | 162 console.error(chrome.runtime.lastError.message); |
| 149 }); | 163 }); |
| 150 }; | 164 }; |
| OLD | NEW |