Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2156)

Unified Diff: chrome/browser/resources/md_extensions/item.js

Issue 2723613004: [MD Extensions] Update Detail View UI (Closed)
Patch Set: nit Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_extensions/item.js
diff --git a/chrome/browser/resources/md_extensions/item.js b/chrome/browser/resources/md_extensions/item.js
index cd03c28475eade675800bdb1e288072d90358a55..8e93b370cf192e749724e44f1aef908515a4b0cd 100644
--- a/chrome/browser/resources/md_extensions/item.js
+++ b/chrome/browser/resources/md_extensions/item.js
@@ -157,20 +157,17 @@ cr.define('extensions', function() {
},
/**
- * Returns true if the extension is enabled, including terminated
- * extensions.
* @return {boolean}
* @private
*/
- isEnabled_: function() {
- switch (this.data.state) {
- case chrome.developerPrivate.ExtensionState.ENABLED:
- case chrome.developerPrivate.ExtensionState.TERMINATED:
- return true;
- case chrome.developerPrivate.ExtensionState.DISABLED:
- return false;
- }
- assertNotReached(); // FileNotFound.
+ isEnabled_: function() { return extensions.isEnabled(this.data.state); },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ isEnableToggleEnabled_: function() {
+ return extensions.userCanChangeEnablement(this.data);
},
/**
@@ -244,22 +241,15 @@ cr.define('extensions', function() {
* @private
*/
computeFirstInspectLabel_: function() {
- var view = this.data.views[0];
- // Trim the "chrome-extension://<id>/".
- var url = new URL(view.url);
- var label = view.url;
- if (url.protocol == 'chrome-extension:')
- label = url.pathname.substring(1);
- if (label == '_generated_background_page.html')
- label = this.i18n('viewBackgroundPage');
- // Add any qualifiers.
- label += (view.incognito ? ' ' + this.i18n('viewIncognito') : '') +
- (view.renderProcessId == -1 ?
- ' ' + this.i18n('viewInactive') : '') +
- (view.isIframe ? ' ' + this.i18n('viewIframe') : '');
- var index = this.data.views.indexOf(view);
- assert(index >= 0);
- if (index < this.data.views.length - 1)
+ // Note: theoretically, this wouldn't be called without any inspectable
+ // views (because it's in a dom-if="!computeInspectViewsHidden_()").
+ // However, due to the recycling behavior of iron list, it seems that
+ // sometimes it can. Even when it is, the UI behaves properly, but we
+ // need to handle the case gracefully.
+ if (this.data.views.length == 0)
+ return '';
+ var label = extensions.computeInspectableViewLabel(this.data.views[0]);
+ if (this.data.views.length > 1)
label += ',';
return label;
},
« no previous file with comments | « chrome/browser/resources/md_extensions/item.html ('k') | chrome/browser/resources/md_extensions/item_source.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698