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

Side by Side Diff: chrome/browser/resources/md_extensions/item_source.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, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Closure compiler won't let this be declared inside cr.define().
6 /** @enum {string} */
7 var SourceType = {
8 WEBSTORE: 'webstore',
9 POLICY: 'policy',
10 SIDELOADED: 'sideloaded',
11 UNPACKED: 'unpacked',
12 };
13
14 cr.define('extensions', function() {
15 /**
16 * @param {chrome.developerPrivate.ExtensionInfo} item
17 * @return {SourceType}
18 */
19 function getItemSource(item) {
20 if (item.controlledInfo &&
21 item.controlledInfo.type ==
22 chrome.developerPrivate.ControllerType.POLICY) {
23 return SourceType.POLICY;
24 } else if (item.location == chrome.developerPrivate.Location.THIRD_PARTY) {
michaelpg 2016/08/26 06:40:13 nit: don't use "else" (and all the braces that ent
Devlin 2016/08/26 18:31:00 Done.
25 return SourceType.SIDELOADED;
26 } else if (item.location == chrome.developerPrivate.Location.UNPACKED) {
27 return SourceType.UNPACKED;
michaelpg 2016/08/26 06:40:13 indent off
Devlin 2016/08/26 18:31:00 Done.
28 }
29 return SourceType.WEBSTORE;
30 }
31
32 /**
33 * @param {SourceType} source
34 * @return {string}
35 */
36 function getItemSourceString(source) {
37 switch (source) {
38 case SourceType.POLICY:
39 return loadTimeData.getString('itemSourcePolicy');
40 case SourceType.SIDELOADED:
41 return loadTimeData.getString('itemSourceSideloaded');
42 case SourceType.UNPACKED:
43 return loadTimeData.getString('itemSourceUnpacked');
44 case SourceType.WEBSTORE:
45 return loadTimeData.getString('itemSourceWebstore');
46 }
47 assertNotReached();
48 }
49
50 return {getItemSource: getItemSource,
51 getItemSourceString: getItemSourceString};
52 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698