| 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 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 /** @interface */ | 6 /** @interface */ |
| 7 var ItemDelegate = function() {}; | 7 var ItemDelegate = function() {}; |
| 8 | 8 |
| 9 ItemDelegate.prototype = { | 9 ItemDelegate.prototype = { |
| 10 /** @param {string} id */ | 10 /** @param {string} id */ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 this.fire('extension-item-size-changed', {item: this.data}); | 103 this.fire('extension-item-size-changed', {item: this.data}); |
| 104 }, | 104 }, |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * @return {boolean} | 107 * @return {boolean} |
| 108 * @private | 108 * @private |
| 109 */ | 109 */ |
| 110 computeErrorsHidden_: function() { | 110 computeErrorsHidden_: function() { |
| 111 return !this.data.manifestErrors.length && | 111 return !this.data.manifestErrors.length && |
| 112 !this.data.runtimeErrors.length; | 112 !this.data.runtimeErrors.length; |
| 113 }, | 113 }, |
| 114 | 114 |
| 115 /** @private */ | 115 /** @private */ |
| 116 onRemoveTap_: function() { | 116 onRemoveTap_: function() { |
| 117 this.delegate.deleteItem(this.data.id); | 117 this.delegate.deleteItem(this.data.id); |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 /** @private */ | 120 /** @private */ |
| 121 onEnableChange_: function() { | 121 onEnableChange_: function() { |
| 122 this.delegate.setItemEnabled(this.data.id, | 122 this.delegate.setItemEnabled( |
| 123 this.$['enable-toggle'].checked); | 123 this.data.id, this.$['enable-toggle'].checked); |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 /** @private */ | 126 /** @private */ |
| 127 onErrorsTap_: function() { | 127 onErrorsTap_: function() { |
| 128 this.fire('extension-item-show-errors', {data: this.data}); | 128 this.fire('extension-item-show-errors', {data: this.data}); |
| 129 }, | 129 }, |
| 130 | 130 |
| 131 /** @private */ | 131 /** @private */ |
| 132 onDetailsTap_: function() { | 132 onDetailsTap_: function() { |
| 133 this.fire('extension-item-show-details', {data: this.data}); | 133 this.fire('extension-item-show-details', {data: this.data}); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 /** @private */ | 154 /** @private */ |
| 155 onRepairTap_: function() { | 155 onRepairTap_: function() { |
| 156 this.delegate.repairItem(this.data.id); | 156 this.delegate.repairItem(this.data.id); |
| 157 }, | 157 }, |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * @return {boolean} | 160 * @return {boolean} |
| 161 * @private | 161 * @private |
| 162 */ | 162 */ |
| 163 isEnabled_: function() { return extensions.isEnabled(this.data.state); }, | 163 isEnabled_: function() { |
| 164 return extensions.isEnabled(this.data.state); |
| 165 }, |
| 164 | 166 |
| 165 /** | 167 /** |
| 166 * @return {boolean} | 168 * @return {boolean} |
| 167 * @private | 169 * @private |
| 168 */ | 170 */ |
| 169 isEnableToggleEnabled_: function() { | 171 isEnableToggleEnabled_: function() { |
| 170 return extensions.userCanChangeEnablement(this.data); | 172 return extensions.userCanChangeEnablement(this.data); |
| 171 }, | 173 }, |
| 172 | 174 |
| 173 /** | 175 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 219 } |
| 218 assertNotReached(); | 220 assertNotReached(); |
| 219 }, | 221 }, |
| 220 | 222 |
| 221 /** | 223 /** |
| 222 * @return {string} | 224 * @return {string} |
| 223 * @private | 225 * @private |
| 224 */ | 226 */ |
| 225 computeSourceIndicatorText_: function() { | 227 computeSourceIndicatorText_: function() { |
| 226 var sourceType = extensions.getItemSource(this.data); | 228 var sourceType = extensions.getItemSource(this.data); |
| 227 return sourceType == SourceType.WEBSTORE ? '' : | 229 return sourceType == SourceType.WEBSTORE ? |
| 228 extensions.getItemSourceString(sourceType); | 230 '' : |
| 231 extensions.getItemSourceString(sourceType); |
| 229 }, | 232 }, |
| 230 | 233 |
| 231 /** | 234 /** |
| 232 * @return {boolean} | 235 * @return {boolean} |
| 233 * @private | 236 * @private |
| 234 */ | 237 */ |
| 235 computeInspectViewsHidden_: function() { | 238 computeInspectViewsHidden_: function() { |
| 236 return !this.data.views || this.data.views.length == 0; | 239 return !this.data.views || this.data.views.length == 0; |
| 237 }, | 240 }, |
| 238 | 241 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 this.data.location == chrome.developerPrivate.Location.UNPACKED && | 277 this.data.location == chrome.developerPrivate.Location.UNPACKED && |
| 275 this.data.state != chrome.developerPrivate.ExtensionState.TERMINATED; | 278 this.data.state != chrome.developerPrivate.ExtensionState.TERMINATED; |
| 276 return !showIcon; | 279 return !showIcon; |
| 277 }, | 280 }, |
| 278 | 281 |
| 279 /** | 282 /** |
| 280 * @return {string} | 283 * @return {string} |
| 281 * @private | 284 * @private |
| 282 */ | 285 */ |
| 283 computeExtraInspectLabel_: function() { | 286 computeExtraInspectLabel_: function() { |
| 284 return loadTimeData.getStringF('itemInspectViewsExtra', | 287 return loadTimeData.getStringF( |
| 285 this.data.views.length - 1); | 288 'itemInspectViewsExtra', this.data.views.length - 1); |
| 286 }, | 289 }, |
| 287 | 290 |
| 288 /** | 291 /** |
| 289 * @return {boolean} | 292 * @return {boolean} |
| 290 * @private | 293 * @private |
| 291 */ | 294 */ |
| 292 hasWarnings_: function() { | 295 hasWarnings_: function() { |
| 293 return this.data.disableReasons.corruptInstall || | 296 return this.data.disableReasons.corruptInstall || |
| 294 this.data.disableReasons.suspiciousInstall || | 297 this.data.disableReasons.suspiciousInstall || |
| 295 !!this.data.blacklistText; | 298 !!this.data.blacklistText; |
| 296 }, | 299 }, |
| 297 | 300 |
| 298 /** | 301 /** |
| 299 * @return {string} | 302 * @return {string} |
| 300 * @private | 303 * @private |
| 301 */ | 304 */ |
| 302 computeWarningsClasses_: function() { | 305 computeWarningsClasses_: function() { |
| 303 return this.data.blacklistText ? 'severe' : 'mild'; | 306 return this.data.blacklistText ? 'severe' : 'mild'; |
| 304 }, | 307 }, |
| 305 }); | 308 }); |
| 306 | 309 |
| 307 return { | 310 return { |
| 308 Item: Item, | 311 Item: Item, |
| 309 ItemDelegate: ItemDelegate, | 312 ItemDelegate: ItemDelegate, |
| 310 }; | 313 }; |
| 311 }); | 314 }); |
| 312 | |
| OLD | NEW |