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

Side by Side Diff: chrome/browser/resources/net_internals/proxy_view.js

Issue 2602473003: Run tools/clang-format-js on chrome/browser/resources/net_internals (Closed)
Patch Set: drop dep Created 3 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 /** 5 /**
6 * This view displays information on the proxy setup: 6 * This view displays information on the proxy setup:
7 * 7 *
8 * - Shows the current proxy settings. 8 * - Shows the current proxy settings.
9 * - Has a button to reload these settings. 9 * - Has a button to reload these settings.
10 * - Shows the list of proxy hostnames that are cached as "bad". 10 * - Shows the list of proxy hostnames that are cached as "bad".
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ProxyView.SOCKS_HINTS_FLAG_DIV_ID = 'proxy-view-socks-hints-flag'; 54 ProxyView.SOCKS_HINTS_FLAG_DIV_ID = 'proxy-view-socks-hints-flag';
55 55
56 cr.addSingletonGetter(ProxyView); 56 cr.addSingletonGetter(ProxyView);
57 57
58 ProxyView.prototype = { 58 ProxyView.prototype = {
59 // Inherit the superclass's methods. 59 // Inherit the superclass's methods.
60 __proto__: superClass.prototype, 60 __proto__: superClass.prototype,
61 61
62 onLoadLogFinish: function(data) { 62 onLoadLogFinish: function(data) {
63 return this.onProxySettingsChanged(data.proxySettings) && 63 return this.onProxySettingsChanged(data.proxySettings) &&
64 this.onBadProxiesChanged(data.badProxies); 64 this.onBadProxiesChanged(data.badProxies);
65 }, 65 },
66 66
67 onProxySettingsChanged: function(proxySettings) { 67 onProxySettingsChanged: function(proxySettings) {
68 $(ProxyView.ORIGINAL_SETTINGS_DIV_ID).innerHTML = ''; 68 $(ProxyView.ORIGINAL_SETTINGS_DIV_ID).innerHTML = '';
69 $(ProxyView.EFFECTIVE_SETTINGS_DIV_ID).innerHTML = ''; 69 $(ProxyView.EFFECTIVE_SETTINGS_DIV_ID).innerHTML = '';
70 this.updateSocksHints_(null); 70 this.updateSocksHints_(null);
71 71
72 if (!proxySettings) 72 if (!proxySettings)
73 return false; 73 return false;
74 74
75 // Both |original| and |effective| are dictionaries describing the 75 // Both |original| and |effective| are dictionaries describing the
76 // settings. 76 // settings.
77 var original = proxySettings.original; 77 var original = proxySettings.original;
78 var effective = proxySettings.effective; 78 var effective = proxySettings.effective;
79 79
80 var originalStr = proxySettingsToString(original); 80 var originalStr = proxySettingsToString(original);
81 var effectiveStr = proxySettingsToString(effective); 81 var effectiveStr = proxySettingsToString(effective);
82 82
83 setNodeDisplay($(ProxyView.ORIGINAL_CONTENT_DIV_ID), 83 setNodeDisplay(
84 originalStr != effectiveStr); 84 $(ProxyView.ORIGINAL_CONTENT_DIV_ID), originalStr != effectiveStr);
85 85
86 $(ProxyView.ORIGINAL_SETTINGS_DIV_ID).innerText = originalStr; 86 $(ProxyView.ORIGINAL_SETTINGS_DIV_ID).innerText = originalStr;
87 $(ProxyView.EFFECTIVE_SETTINGS_DIV_ID).innerText = effectiveStr; 87 $(ProxyView.EFFECTIVE_SETTINGS_DIV_ID).innerText = effectiveStr;
88 88
89 this.updateSocksHints_(effective); 89 this.updateSocksHints_(effective);
90 90
91 return true; 91 return true;
92 }, 92 },
93 93
94 onBadProxiesChanged: function(badProxies) { 94 onBadProxiesChanged: function(badProxies) {
95 $(ProxyView.BAD_PROXIES_TBODY_ID).innerHTML = ''; 95 $(ProxyView.BAD_PROXIES_TBODY_ID).innerHTML = '';
96 setNodeDisplay($(ProxyView.BAD_PROXIES_DIV_ID), 96 setNodeDisplay(
97 badProxies && badProxies.length > 0); 97 $(ProxyView.BAD_PROXIES_DIV_ID), badProxies && badProxies.length > 0);
98 98
99 if (!badProxies) 99 if (!badProxies)
100 return false; 100 return false;
101 101
102 // Add a table row for each bad proxy entry. 102 // Add a table row for each bad proxy entry.
103 for (var i = 0; i < badProxies.length; ++i) { 103 for (var i = 0; i < badProxies.length; ++i) {
104 var entry = badProxies[i]; 104 var entry = badProxies[i];
105 var badUntilDate = timeutil.convertTimeTicksToDate(entry.bad_until); 105 var badUntilDate = timeutil.convertTimeTicksToDate(entry.bad_until);
106 106
107 var tr = addNode($(ProxyView.BAD_PROXIES_TBODY_ID), 'tr'); 107 var tr = addNode($(ProxyView.BAD_PROXIES_TBODY_ID), 'tr');
(...skipping 15 matching lines...) Expand all
123 123
124 var socksProxy = getSingleSocks5Proxy_(proxySettings.single_proxy); 124 var socksProxy = getSingleSocks5Proxy_(proxySettings.single_proxy);
125 if (!socksProxy) 125 if (!socksProxy)
126 return; 126 return;
127 127
128 // Suggest a recommended --host-resolver-rules. 128 // Suggest a recommended --host-resolver-rules.
129 // NOTE: This does not compensate for any proxy bypass rules. If the 129 // NOTE: This does not compensate for any proxy bypass rules. If the
130 // proxy settings include proxy bypasses the user may need to expand the 130 // proxy settings include proxy bypasses the user may need to expand the
131 // exclusions for host resolving. 131 // exclusions for host resolving.
132 var hostResolverRules = 'MAP * ~NOTFOUND , EXCLUDE ' + socksProxy.host; 132 var hostResolverRules = 'MAP * ~NOTFOUND , EXCLUDE ' + socksProxy.host;
133 var hostResolverRulesFlag = '--host-resolver-rules="' + 133 var hostResolverRulesFlag =
134 hostResolverRules + '"'; 134 '--host-resolver-rules="' + hostResolverRules + '"';
135 135
136 // TODO(eroman): On Linux the ClientInfo.command_line is wrong in that it 136 // TODO(eroman): On Linux the ClientInfo.command_line is wrong in that it
137 // doesn't include any quotes around the parameters. This means the 137 // doesn't include any quotes around the parameters. This means the
138 // string search above is going to fail :( 138 // string search above is going to fail :(
139 if (ClientInfo.command_line && 139 if (ClientInfo.command_line &&
140 ClientInfo.command_line.indexOf(hostResolverRulesFlag) != -1) { 140 ClientInfo.command_line.indexOf(hostResolverRulesFlag) != -1) {
141 // Chrome is already using the suggested resolver rules. 141 // Chrome is already using the suggested resolver rules.
142 return; 142 return;
143 } 143 }
144 144
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Strip brackets off of IPv6 literals. 177 // Strip brackets off of IPv6 literals.
178 matches = /^\[(.*)\]$/.exec(result.host); 178 matches = /^\[(.*)\]$/.exec(result.host);
179 if (matches) 179 if (matches)
180 result.host = matches[1]; 180 result.host = matches[1];
181 181
182 return result; 182 return result;
183 } 183 }
184 184
185 return ProxyView; 185 return ProxyView;
186 })(); 186 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698