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

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

Issue 2266303002: [MD Extensions] Add the source type on the details page for an extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 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 6f043c66de6fe2602428fda266b7777977b535f4..144fe3bb11677b67e555f8fa4bd6b7747b2ea0dc 100644
--- a/chrome/browser/resources/md_extensions/item.js
+++ b/chrome/browser/resources/md_extensions/item.js
@@ -2,15 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Closure compiler won't let this be declared inside cr.define().
-/** @enum {string} */
-var SourceType = {
- WEBSTORE: 'webstore',
- POLICY: 'policy',
- SIDELOADED: 'sideloaded',
- UNPACKED: 'unpacked',
-};
-
cr.define('extensions', function() {
/** @interface */
var ItemDelegate = function() {};
@@ -158,30 +149,11 @@ cr.define('extensions', function() {
},
/**
- * @return {SourceType}
- * @private
- */
- computeSource_: function() {
- if (this.data.controlledInfo &&
- this.data.controlledInfo.type ==
- chrome.developerPrivate.ControllerType.POLICY) {
- return SourceType.POLICY;
- } else if (this.data.location ==
- chrome.developerPrivate.Location.THIRD_PARTY) {
- return SourceType.SIDELOADED;
- } else if (this.data.location ==
- chrome.developerPrivate.Location.UNPACKED) {
- return SourceType.UNPACKED;
- }
- return SourceType.WEBSTORE;
- },
-
- /**
* @return {string}
* @private
*/
computeSourceIndicatorIcon_: function() {
- switch (this.computeSource_()) {
+ switch (extensions.getItemSource(this.data)) {
case SourceType.POLICY:
return 'communication:business';
case SourceType.SIDELOADED:
@@ -199,17 +171,9 @@ cr.define('extensions', function() {
* @private
*/
computeSourceIndicatorText_: function() {
- switch (this.computeSource_()) {
- case SourceType.POLICY:
- return loadTimeData.getString('itemSourcePolicy');
- case SourceType.SIDELOADED:
- return loadTimeData.getString('itemSourceSideloaded');
- case SourceType.UNPACKED:
- return loadTimeData.getString('itemSourceUnpacked');
- case SourceType.WEBSTORE:
- return '';
- }
- assertNotReached();
+ var sourceType = extensions.getItemSource(this.data);
+ return sourceType == SourceType.WEBSTORE ? '' :
+ extensions.getItemSourceString(sourceType);
},
/**

Powered by Google App Engine
This is Rietveld 408576698