[sql] Remove _HAS_EXCEPTIONS=0 from build info.
[chromium-blink-merge.git] / chrome / browser / resources / net_internals / modules_view.js
blob0bf7b52ae6eef0bdb1128f208227bf25759184a3
1 // Copyright (c) 2012 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.
5 /**
6 * This view displays information on installed Chrome extensions / apps as well
7 * as Winsock layered service providers and namespace providers.
9 * For each layered service provider, shows the name, dll, and type
10 * information. For each namespace provider, shows the name and
11 * whether or not it's active.
13 var ModulesView = (function() {
14 'use strict';
16 // We inherit from DivView.
17 var superClass = DivView;
19 /**
20 * @constructor
22 function ModulesView() {
23 assertFirstConstructorCall(ModulesView);
25 // Call superclass's constructor.
26 superClass.call(this, ModulesView.MAIN_BOX_ID);
28 this.serviceProvidersTbody_ =
29 $(ModulesView.SERVICE_PROVIDERS_TBODY_ID);
30 this.namespaceProvidersTbody_ =
31 $(ModulesView.NAMESPACE_PROVIDERS_TBODY_ID);
33 g_browser.addServiceProvidersObserver(this, false);
34 g_browser.addExtensionInfoObserver(this, true);
37 ModulesView.TAB_ID = 'tab-handle-modules';
38 ModulesView.TAB_NAME = 'Modules';
39 ModulesView.TAB_HASH = '#modules';
41 // IDs for special HTML elements in modules_view.html.
42 ModulesView.MAIN_BOX_ID = 'modules-view-tab-content';
43 ModulesView.EXTENSION_INFO_ID = 'modules-view-extension-info';
44 ModulesView.WINDOWS_SERVICE_PROVIDERS_ID =
45 'modules-view-windows-service-providers';
47 cr.addSingletonGetter(ModulesView);
49 ModulesView.prototype = {
50 // Inherit the superclass's methods.
51 __proto__: superClass.prototype,
53 onLoadLogFinish: function(data) {
54 // Show the tab if there are either service providers or extension info.
55 var hasExtensionInfo = this.onExtensionInfoChanged(data.extensionInfo);
56 var hasSpiInfo = this.onServiceProvidersChanged(data.serviceProviders);
57 return hasExtensionInfo || hasSpiInfo;
60 onExtensionInfoChanged: function(extensionInfo) {
61 var input = new JsEvalContext({extensionInfo: extensionInfo});
62 jstProcess(input, $(ModulesView.EXTENSION_INFO_ID));
63 return !!extensionInfo;
66 onServiceProvidersChanged: function(serviceProviders) {
67 var input = new JsEvalContext(serviceProviders);
68 jstProcess(input, $(ModulesView.WINDOWS_SERVICE_PROVIDERS_ID));
69 return !!serviceProviders;
73 /**
74 * Returns type of a layered service provider.
76 ModulesView.getLayeredServiceProviderType = function(serviceProvider) {
77 if (serviceProvider.chain_length == 0)
78 return 'Layer';
79 if (serviceProvider.chain_length == 1)
80 return 'Base';
81 return 'Chain';
84 var SOCKET_TYPE = {
85 '1': 'SOCK_STREAM',
86 '2': 'SOCK_DGRAM',
87 '3': 'SOCK_RAW',
88 '4': 'SOCK_RDM',
89 '5': 'SOCK_SEQPACKET'
92 /**
93 * Returns socket type of a layered service provider as a string.
95 ModulesView.getLayeredServiceProviderSocketType = function(serviceProvider) {
96 return tryGetValueWithKey(SOCKET_TYPE, serviceProvider.socket_type);
99 var PROTOCOL_TYPE = {
100 '1': 'IPPROTO_ICMP',
101 '6': 'IPPROTO_TCP',
102 '17': 'IPPROTO_UDP',
103 '58': 'IPPROTO_ICMPV6'
107 * Returns protocol type of a layered service provider as a string.
109 ModulesView.getLayeredServiceProviderProtocolType =
110 function(serviceProvider) {
111 return tryGetValueWithKey(PROTOCOL_TYPE, serviceProvider.socket_protocol);
114 var NAMESPACE_PROVIDER_PTYPE = {
115 '12': 'NS_DNS',
116 '15': 'NS_NLA',
117 '16': 'NS_BTH',
118 '32': 'NS_NTDS',
119 '37': 'NS_EMAIL',
120 '38': 'NS_PNRPNAME',
121 '39': 'NS_PNRPCLOUD'
125 * Returns the type of a namespace provider as a string.
127 ModulesView.getNamespaceProviderType = function(namespaceProvider) {
128 return tryGetValueWithKey(NAMESPACE_PROVIDER_PTYPE,
129 namespaceProvider.type);
132 return ModulesView;
133 })();