OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 * Dictionary of constants (initialized by browser). | 6 * Dictionary of constants (initialized by browser). |
7 */ | 7 */ |
8 var LogEventType = null; | 8 var LogEventType = null; |
9 var LogEventPhase = null; | 9 var LogEventPhase = null; |
10 var ClientInfo = null; | 10 var ClientInfo = null; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 'dataViewDumpDataDiv', 'dataViewLoadDataDiv', | 80 'dataViewDumpDataDiv', 'dataViewLoadDataDiv', |
81 'dataViewLoadLogFile', | 81 'dataViewLoadLogFile', |
82 'dataViewCapturingTextSpan', | 82 'dataViewCapturingTextSpan', |
83 'dataViewLoggingTextSpan'); | 83 'dataViewLoggingTextSpan'); |
84 | 84 |
85 // Create a view which will display the results and controls for connection | 85 // Create a view which will display the results and controls for connection |
86 // tests. | 86 // tests. |
87 var testView = new TestView('testTabContent', 'testUrlInput', | 87 var testView = new TestView('testTabContent', 'testUrlInput', |
88 'connectionTestsForm', 'testSummary'); | 88 'connectionTestsForm', 'testSummary'); |
89 | 89 |
| 90 // Create a view which allows the user to query and alter the HSTS database. |
| 91 var hstsView = new HSTSView('hstsTabContent', |
| 92 'hstsQueryInput', 'hstsQueryForm', |
| 93 'hstsQueryOutput', |
| 94 'hstsAddInput', 'hstsAddForm', 'hstsCheckInput', |
| 95 'hstsDeleteInput', 'hstsDeleteForm'); |
| 96 |
90 var httpCacheView = new HttpCacheView('httpCacheTabContent', | 97 var httpCacheView = new HttpCacheView('httpCacheTabContent', |
91 'httpCacheStats'); | 98 'httpCacheStats'); |
92 | 99 |
93 var socketsView = new SocketsView('socketsTabContent', | 100 var socketsView = new SocketsView('socketsTabContent', |
94 'socketPoolDiv', | 101 'socketPoolDiv', |
95 'socketPoolGroupsDiv'); | 102 'socketPoolGroupsDiv'); |
96 | 103 |
97 var spdyView = new SpdyView('spdyTabContent', | 104 var spdyView = new SpdyView('spdyTabContent', |
98 'spdyEnabledSpan', | 105 'spdyEnabledSpan', |
99 'spdyUseAlternateProtocolSpan', | 106 'spdyUseAlternateProtocolSpan', |
(...skipping 21 matching lines...) Expand all Loading... |
121 categoryTabSwitcher.addTab('eventsTab', eventsView, false); | 128 categoryTabSwitcher.addTab('eventsTab', eventsView, false); |
122 categoryTabSwitcher.addTab('proxyTab', proxyView, false); | 129 categoryTabSwitcher.addTab('proxyTab', proxyView, false); |
123 categoryTabSwitcher.addTab('dnsTab', dnsView, false); | 130 categoryTabSwitcher.addTab('dnsTab', dnsView, false); |
124 categoryTabSwitcher.addTab('socketsTab', socketsView, false); | 131 categoryTabSwitcher.addTab('socketsTab', socketsView, false); |
125 categoryTabSwitcher.addTab('spdyTab', spdyView, false); | 132 categoryTabSwitcher.addTab('spdyTab', spdyView, false); |
126 categoryTabSwitcher.addTab('httpCacheTab', httpCacheView, false); | 133 categoryTabSwitcher.addTab('httpCacheTab', httpCacheView, false); |
127 categoryTabSwitcher.addTab('dataTab', dataView, false); | 134 categoryTabSwitcher.addTab('dataTab', dataView, false); |
128 if (g_browser.isPlatformWindows()) | 135 if (g_browser.isPlatformWindows()) |
129 categoryTabSwitcher.addTab('serviceProvidersTab', serviceView, false); | 136 categoryTabSwitcher.addTab('serviceProvidersTab', serviceView, false); |
130 categoryTabSwitcher.addTab('testTab', testView, false); | 137 categoryTabSwitcher.addTab('testTab', testView, false); |
| 138 categoryTabSwitcher.addTab('hstsTab', hstsView, false); |
131 | 139 |
132 // Build a map from the anchor name of each tab handle to its "tab ID". | 140 // Build a map from the anchor name of each tab handle to its "tab ID". |
133 // We will consider navigations to the #hash as a switch tab request. | 141 // We will consider navigations to the #hash as a switch tab request. |
134 var anchorMap = {}; | 142 var anchorMap = {}; |
135 var tabIds = categoryTabSwitcher.getAllTabIds(); | 143 var tabIds = categoryTabSwitcher.getAllTabIds(); |
136 for (var i = 0; i < tabIds.length; ++i) { | 144 for (var i = 0; i < tabIds.length; ++i) { |
137 var aNode = document.getElementById(tabIds[i]); | 145 var aNode = document.getElementById(tabIds[i]); |
138 anchorMap[aNode.hash] = tabIds[i]; | 146 anchorMap[aNode.hash] = tabIds[i]; |
139 } | 147 } |
140 // Default the empty hash to the data tab. | 148 // Default the empty hash to the data tab. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 this.pollableDataHelpers_.spdyAlternateProtocolMappings = | 203 this.pollableDataHelpers_.spdyAlternateProtocolMappings = |
196 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', | 204 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', |
197 this.sendGetSpdyAlternateProtocolMappings.bind( | 205 this.sendGetSpdyAlternateProtocolMappings.bind( |
198 this)); | 206 this)); |
199 if (this.isPlatformWindows()) { | 207 if (this.isPlatformWindows()) { |
200 this.pollableDataHelpers_.serviceProviders = | 208 this.pollableDataHelpers_.serviceProviders = |
201 new PollableDataHelper('onServiceProvidersChanged', | 209 new PollableDataHelper('onServiceProvidersChanged', |
202 this.sendGetServiceProviders.bind(this)); | 210 this.sendGetServiceProviders.bind(this)); |
203 } | 211 } |
204 | 212 |
| 213 this.hstsQueryCallback = null; |
| 214 |
205 // Cache of the data received. | 215 // Cache of the data received. |
206 this.numPassivelyCapturedEvents_ = 0; | 216 this.numPassivelyCapturedEvents_ = 0; |
207 this.capturedEvents_ = []; | 217 this.capturedEvents_ = []; |
208 | 218 |
209 // Next unique id to be assigned to a log entry without a source. | 219 // Next unique id to be assigned to a log entry without a source. |
210 // Needed to simplify deletion, identify associated GUI elements, etc. | 220 // Needed to simplify deletion, identify associated GUI elements, etc. |
211 this.nextSourcelessEventId_ = -1; | 221 this.nextSourcelessEventId_ = -1; |
212 | 222 |
213 // True when viewing a log file rather than actively logged events. | 223 // True when viewing a log file rather than actively logged events. |
214 // When viewing a log file, all tabs are hidden except the event view, | 224 // When viewing a log file, all tabs are hidden except the event view, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 }; | 304 }; |
295 | 305 |
296 BrowserBridge.prototype.sendClearHostResolverCache = function() { | 306 BrowserBridge.prototype.sendClearHostResolverCache = function() { |
297 chrome.send('clearHostResolverCache'); | 307 chrome.send('clearHostResolverCache'); |
298 }; | 308 }; |
299 | 309 |
300 BrowserBridge.prototype.sendStartConnectionTests = function(url) { | 310 BrowserBridge.prototype.sendStartConnectionTests = function(url) { |
301 chrome.send('startConnectionTests', [url]); | 311 chrome.send('startConnectionTests', [url]); |
302 }; | 312 }; |
303 | 313 |
| 314 BrowserBridge.prototype.sendHSTSQuery = function(domain) { |
| 315 chrome.send('hstsQuery', [domain]); |
| 316 }; |
| 317 |
| 318 BrowserBridge.prototype.sendHSTSAdd = function(domain, include_subdomains) { |
| 319 chrome.send('hstsAdd', [domain, include_subdomains]); |
| 320 }; |
| 321 |
| 322 BrowserBridge.prototype.sendHSTSDelete = function(domain) { |
| 323 chrome.send('hstsDelete', [domain]); |
| 324 }; |
| 325 |
304 BrowserBridge.prototype.sendGetHttpCacheInfo = function() { | 326 BrowserBridge.prototype.sendGetHttpCacheInfo = function() { |
305 chrome.send('getHttpCacheInfo'); | 327 chrome.send('getHttpCacheInfo'); |
306 }; | 328 }; |
307 | 329 |
308 BrowserBridge.prototype.sendGetSocketPoolInfo = function() { | 330 BrowserBridge.prototype.sendGetSocketPoolInfo = function() { |
309 chrome.send('getSocketPoolInfo'); | 331 chrome.send('getSocketPoolInfo'); |
310 }; | 332 }; |
311 | 333 |
312 BrowserBridge.prototype.sendGetSpdySessionInfo = function() { | 334 BrowserBridge.prototype.sendGetSpdySessionInfo = function() { |
313 chrome.send('getSpdySessionInfo'); | 335 chrome.send('getSpdySessionInfo'); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 this.connectionTestsObservers_[i].onCompletedConnectionTestExperiment( | 487 this.connectionTestsObservers_[i].onCompletedConnectionTestExperiment( |
466 info.experiment, info.result); | 488 info.experiment, info.result); |
467 } | 489 } |
468 }; | 490 }; |
469 | 491 |
470 BrowserBridge.prototype.receivedCompletedConnectionTestSuite = function() { | 492 BrowserBridge.prototype.receivedCompletedConnectionTestSuite = function() { |
471 for (var i = 0; i < this.connectionTestsObservers_.length; ++i) | 493 for (var i = 0; i < this.connectionTestsObservers_.length; ++i) |
472 this.connectionTestsObservers_[i].onCompletedConnectionTestSuite(); | 494 this.connectionTestsObservers_[i].onCompletedConnectionTestSuite(); |
473 }; | 495 }; |
474 | 496 |
| 497 BrowserBridge.prototype.receivedHSTSResult = function(info) { |
| 498 if (this.hstsQueryCallback) |
| 499 this.hstsQueryCallback(info); |
| 500 }; |
| 501 |
475 BrowserBridge.prototype.receivedHttpCacheInfo = function(info) { | 502 BrowserBridge.prototype.receivedHttpCacheInfo = function(info) { |
476 this.pollableDataHelpers_.httpCacheInfo.update(info); | 503 this.pollableDataHelpers_.httpCacheInfo.update(info); |
477 }; | 504 }; |
478 | 505 |
479 BrowserBridge.prototype.loadedLogFile = function(logFileContents) { | 506 BrowserBridge.prototype.loadedLogFile = function(logFileContents) { |
480 var match; | 507 var match; |
481 // Replace carriage returns with linebreaks and then split around linebreaks. | 508 // Replace carriage returns with linebreaks and then split around linebreaks. |
482 var lines = logFileContents.replace(/\r/g, '\n').split('\n'); | 509 var lines = logFileContents.replace(/\r/g, '\n').split('\n'); |
483 var entries = []; | 510 var entries = []; |
484 var numInvalidLines = 0; | 511 var numInvalidLines = 0; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 return true; | 975 return true; |
949 }; | 976 }; |
950 | 977 |
951 UpdateAllObserver.prototype.onDataReceived_ = function(helper, name, data) { | 978 UpdateAllObserver.prototype.onDataReceived_ = function(helper, name, data) { |
952 helper.removeObserver(this); | 979 helper.removeObserver(this); |
953 --this.observingCount_; | 980 --this.observingCount_; |
954 this.updatedData_[name] = data; | 981 this.updatedData_[name] = data; |
955 if (this.observingCount_ == 0) | 982 if (this.observingCount_ == 0) |
956 this.callback_(this.updatedData_); | 983 this.callback_(this.updatedData_); |
957 }; | 984 }; |
OLD | NEW |