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

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

Issue 8896019: Refactor: Extract "InitProxyResolver" to "ProxyScriptDecider". (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do another sync since commitbot failed... Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 log entries for the most recent INIT_PROXY_RESOLVER source 10 * - Shows the log entries for the most recent PROXY_SCRIPT_DECIDER source
11 * - Shows the list of proxy hostnames that are cached as "bad". 11 * - Shows the list of proxy hostnames that are cached as "bad".
12 * - Has a button to clear the cached bad proxies. 12 * - Has a button to clear the cached bad proxies.
13 */ 13 */
14 var ProxyView = (function() { 14 var ProxyView = (function() {
15 'use strict'; 15 'use strict';
16 16
17 // We inherit from DivView. 17 // We inherit from DivView.
18 var superClass = DivView; 18 var superClass = DivView;
19 19
20 /** 20 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Inherit the superclass's methods. 58 // Inherit the superclass's methods.
59 __proto__: superClass.prototype, 59 __proto__: superClass.prototype,
60 60
61 onLoadLogStart: function(data) { 61 onLoadLogStart: function(data) {
62 // Need to reset this so the latest proxy source from the dump can be 62 // Need to reset this so the latest proxy source from the dump can be
63 // identified when the log entries are loaded. 63 // identified when the log entries are loaded.
64 this.latestProxySourceId_ = 0; 64 this.latestProxySourceId_ = 0;
65 }, 65 },
66 66
67 onLoadLogFinish: function(data, tabData) { 67 onLoadLogFinish: function(data, tabData) {
68 // It's possible that the last INIT_PROXY_RESOLVER source was deleted from 68 // It's possible that the last PROXY_SCRIPT_DECIDER source was deleted
69 // the log, but earlier sources remain. When that happens, clear the list 69 // from the log, but earlier sources remain. When that happens, clear the
70 // of entries here, to avoid displaying misleading information. 70 // list of entries here, to avoid displaying misleading information.
71 if (tabData != this.latestProxySourceId_) 71 if (tabData != this.latestProxySourceId_)
72 this.clearLog_(); 72 this.clearLog_();
73 return this.onProxySettingsChanged(data.proxySettings) && 73 return this.onProxySettingsChanged(data.proxySettings) &&
74 this.onBadProxiesChanged(data.badProxies); 74 this.onBadProxiesChanged(data.badProxies);
75 }, 75 },
76 76
77 /** 77 /**
78 * Save view-specific state. 78 * Save view-specific state.
79 * 79 *
80 * Save the greatest seen proxy source id, so we will not incorrectly 80 * Save the greatest seen proxy source id, so we will not incorrectly
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 var badUntilCell = addNode(tr, 'td'); 120 var badUntilCell = addNode(tr, 'td');
121 121
122 addTextNode(nameCell, entry.proxy_uri); 122 addTextNode(nameCell, entry.proxy_uri);
123 addTextNode(badUntilCell, badUntilDate.toLocaleString()); 123 addTextNode(badUntilCell, badUntilDate.toLocaleString());
124 } 124 }
125 return true; 125 return true;
126 }, 126 },
127 127
128 /** 128 /**
129 * Called whenever SourceEntries are updated with new log entries. Updates 129 * Called whenever SourceEntries are updated with new log entries. Updates
130 * |proxyResolverLogPre_| with the log entries of the INIT_PROXY_RESOLVER 130 * |proxyResolverLogPre_| with the log entries of the PROXY_SCRIPT_DECIDER
131 * SourceEntry with the greatest id. 131 * SourceEntry with the greatest id.
132 */ 132 */
133 onSourceEntriesUpdated: function(sourceEntries) { 133 onSourceEntriesUpdated: function(sourceEntries) {
134 for (var i = sourceEntries.length - 1; i >= 0; --i) { 134 for (var i = sourceEntries.length - 1; i >= 0; --i) {
135 var sourceEntry = sourceEntries[i]; 135 var sourceEntry = sourceEntries[i];
136 136
137 if (sourceEntry.getSourceType() != LogSourceType.INIT_PROXY_RESOLVER || 137 if (sourceEntry.getSourceType() != LogSourceType.PROXY_SCRIPT_DECIDER ||
138 this.latestProxySourceId_ > sourceEntry.getSourceId()) { 138 this.latestProxySourceId_ > sourceEntry.getSourceId()) {
139 continue; 139 continue;
140 } 140 }
141 141
142 this.latestProxySourceId_ = sourceEntry.getSourceId(); 142 this.latestProxySourceId_ = sourceEntry.getSourceId();
143 143
144 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerText = 144 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerText =
145 sourceEntry.printAsText(); 145 sourceEntry.printAsText();
146 } 146 }
147 }, 147 },
(...skipping 14 matching lines...) Expand all
162 this.clearLog_(); 162 this.clearLog_();
163 }, 163 },
164 164
165 onAllSourceEntriesDeleted: function() { 165 onAllSourceEntriesDeleted: function() {
166 this.clearLog_(); 166 this.clearLog_();
167 } 167 }
168 }; 168 };
169 169
170 return ProxyView; 170 return ProxyView;
171 })(); 171 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698