| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 this.fire('extension-item-size-changed', {item: this.data}); | 100 this.fire('extension-item-size-changed', {item: this.data}); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * @return {boolean} | 104 * @return {boolean} |
| 105 * @private | 105 * @private |
| 106 */ | 106 */ |
| 107 computeErrorsHidden_: function() { | 107 computeErrorsHidden_: function() { |
| 108 return !this.data.manifestErrors.length && | 108 return !this.data.manifestErrors.length && |
| 109 !this.data.runtimeErrors.length; | 109 !this.data.runtimeErrors.length; |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 /** @private */ | 112 /** @private */ |
| 113 onRemoveTap_: function() { | 113 onRemoveTap_: function() { |
| 114 this.delegate.deleteItem(this.data.id); | 114 this.delegate.deleteItem(this.data.id); |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 /** @private */ | 117 /** @private */ |
| 118 onEnableChange_: function() { | 118 onEnableChange_: function() { |
| 119 this.delegate.setItemEnabled(this.data.id, | 119 this.delegate.setItemEnabled( |
| 120 this.$['enable-toggle'].checked); | 120 this.data.id, this.$['enable-toggle'].checked); |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 /** @private */ | 123 /** @private */ |
| 124 onErrorsTap_: function() { | 124 onErrorsTap_: function() { |
| 125 this.fire('extension-item-show-errors', {data: this.data}); | 125 this.fire('extension-item-show-errors', {data: this.data}); |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 /** @private */ | 128 /** @private */ |
| 129 onDetailsTap_: function() { | 129 onDetailsTap_: function() { |
| 130 this.fire('extension-item-show-details', {data: this.data}); | 130 this.fire('extension-item-show-details', {data: this.data}); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 assertNotReached(); | 183 assertNotReached(); |
| 184 }, | 184 }, |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * @return {string} | 187 * @return {string} |
| 188 * @private | 188 * @private |
| 189 */ | 189 */ |
| 190 computeSourceIndicatorText_: function() { | 190 computeSourceIndicatorText_: function() { |
| 191 var sourceType = extensions.getItemSource(this.data); | 191 var sourceType = extensions.getItemSource(this.data); |
| 192 return sourceType == SourceType.WEBSTORE ? '' : | 192 return sourceType == SourceType.WEBSTORE ? |
| 193 extensions.getItemSourceString(sourceType); | 193 '' : |
| 194 extensions.getItemSourceString(sourceType); |
| 194 }, | 195 }, |
| 195 | 196 |
| 196 /** | 197 /** |
| 197 * @param {chrome.developerPrivate.ExtensionView} view | 198 * @param {chrome.developerPrivate.ExtensionView} view |
| 198 * @private | 199 * @private |
| 199 */ | 200 */ |
| 200 computeInspectLabel_: function(view) { | 201 computeInspectLabel_: function(view) { |
| 201 // Trim the "chrome-extension://<id>/". | 202 // Trim the "chrome-extension://<id>/". |
| 202 var url = new URL(view.url); | 203 var url = new URL(view.url); |
| 203 var label = view.url; | 204 var label = view.url; |
| 204 if (url.protocol == 'chrome-extension:') | 205 if (url.protocol == 'chrome-extension:') |
| 205 label = url.pathname.substring(1); | 206 label = url.pathname.substring(1); |
| 206 if (label == '_generated_background_page.html') | 207 if (label == '_generated_background_page.html') |
| 207 label = this.i18n('viewBackgroundPage'); | 208 label = this.i18n('viewBackgroundPage'); |
| 208 // Add any qualifiers. | 209 // Add any qualifiers. |
| 209 label += (view.incognito ? ' ' + this.i18n('viewIncognito') : '') + | 210 label += (view.incognito ? ' ' + this.i18n('viewIncognito') : '') + |
| 210 (view.renderProcessId == -1 ? | 211 (view.renderProcessId == -1 ? ' ' + this.i18n('viewInactive') : '') + |
| 211 ' ' + this.i18n('viewInactive') : '') + | 212 (view.isIframe ? ' ' + this.i18n('viewIframe') : ''); |
| 212 (view.isIframe ? ' ' + this.i18n('viewIframe') : ''); | |
| 213 return label; | 213 return label; |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * @return {boolean} | 217 * @return {boolean} |
| 218 * @private | 218 * @private |
| 219 */ | 219 */ |
| 220 hasWarnings_: function() { | 220 hasWarnings_: function() { |
| 221 return this.data.disableReasons.corruptInstall || | 221 return this.data.disableReasons.corruptInstall || |
| 222 this.data.disableReasons.suspiciousInstall || | 222 this.data.disableReasons.suspiciousInstall || |
| 223 !!this.data.blacklistText; | 223 !!this.data.blacklistText; |
| 224 }, | 224 }, |
| 225 | 225 |
| 226 /** | 226 /** |
| 227 * @return {string} | 227 * @return {string} |
| 228 * @private | 228 * @private |
| 229 */ | 229 */ |
| 230 computeWarningsClasses_: function() { | 230 computeWarningsClasses_: function() { |
| 231 return this.data.blacklistText ? 'severe' : 'mild'; | 231 return this.data.blacklistText ? 'severe' : 'mild'; |
| 232 }, | 232 }, |
| 233 }); | 233 }); |
| 234 | 234 |
| 235 return { | 235 return { |
| 236 Item: Item, | 236 Item: Item, |
| 237 ItemDelegate: ItemDelegate, | 237 ItemDelegate: ItemDelegate, |
| 238 }; | 238 }; |
| 239 }); | 239 }); |
| 240 | |
| OLD | NEW |