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

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

Issue 6500010: HSTS: add net-internals UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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
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
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 21 matching lines...) Expand all
162 /** 170 /**
163 * This class provides a "bridge" for communicating between the javascript and 171 * This class provides a "bridge" for communicating between the javascript and
164 * the browser. 172 * the browser.
165 * 173 *
166 * @constructor 174 * @constructor
167 */ 175 */
168 function BrowserBridge() { 176 function BrowserBridge() {
169 // List of observers for various bits of browser state. 177 // List of observers for various bits of browser state.
170 this.logObservers_ = []; 178 this.logObservers_ = [];
171 this.connectionTestsObservers_ = []; 179 this.connectionTestsObservers_ = [];
180 this.hstsObservers_ = [];
172 181
173 this.pollableDataHelpers_ = {}; 182 this.pollableDataHelpers_ = {};
174 this.pollableDataHelpers_.proxySettings = 183 this.pollableDataHelpers_.proxySettings =
175 new PollableDataHelper('onProxySettingsChanged', 184 new PollableDataHelper('onProxySettingsChanged',
176 this.sendGetProxySettings.bind(this)); 185 this.sendGetProxySettings.bind(this));
177 this.pollableDataHelpers_.badProxies = 186 this.pollableDataHelpers_.badProxies =
178 new PollableDataHelper('onBadProxiesChanged', 187 new PollableDataHelper('onBadProxiesChanged',
179 this.sendGetBadProxies.bind(this)); 188 this.sendGetBadProxies.bind(this));
180 this.pollableDataHelpers_.httpCacheInfo = 189 this.pollableDataHelpers_.httpCacheInfo =
181 new PollableDataHelper('onHttpCacheInfoChanged', 190 new PollableDataHelper('onHttpCacheInfoChanged',
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 }; 303 };
295 304
296 BrowserBridge.prototype.sendClearHostResolverCache = function() { 305 BrowserBridge.prototype.sendClearHostResolverCache = function() {
297 chrome.send('clearHostResolverCache'); 306 chrome.send('clearHostResolverCache');
298 }; 307 };
299 308
300 BrowserBridge.prototype.sendStartConnectionTests = function(url) { 309 BrowserBridge.prototype.sendStartConnectionTests = function(url) {
301 chrome.send('startConnectionTests', [url]); 310 chrome.send('startConnectionTests', [url]);
302 }; 311 };
303 312
313 BrowserBridge.prototype.sendHSTSQuery = function(domain) {
314 chrome.send('hstsQuery', [domain]);
315 };
316
317 BrowserBridge.prototype.sendHSTSAdd = function(domain, include_subdomains) {
318 chrome.send('hstsAdd', [domain, include_subdomains]);
319 };
320
321 BrowserBridge.prototype.sendHSTSDelete = function(domain) {
322 chrome.send('hstsDelete', [domain]);
323 };
324
304 BrowserBridge.prototype.sendGetHttpCacheInfo = function() { 325 BrowserBridge.prototype.sendGetHttpCacheInfo = function() {
305 chrome.send('getHttpCacheInfo'); 326 chrome.send('getHttpCacheInfo');
306 }; 327 };
307 328
308 BrowserBridge.prototype.sendGetSocketPoolInfo = function() { 329 BrowserBridge.prototype.sendGetSocketPoolInfo = function() {
309 chrome.send('getSocketPoolInfo'); 330 chrome.send('getSocketPoolInfo');
310 }; 331 };
311 332
312 BrowserBridge.prototype.sendGetSpdySessionInfo = function() { 333 BrowserBridge.prototype.sendGetSpdySessionInfo = function() {
313 chrome.send('getSpdySessionInfo'); 334 chrome.send('getSpdySessionInfo');
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 this.connectionTestsObservers_[i].onCompletedConnectionTestExperiment( 486 this.connectionTestsObservers_[i].onCompletedConnectionTestExperiment(
466 info.experiment, info.result); 487 info.experiment, info.result);
467 } 488 }
468 }; 489 };
469 490
470 BrowserBridge.prototype.receivedCompletedConnectionTestSuite = function() { 491 BrowserBridge.prototype.receivedCompletedConnectionTestSuite = function() {
471 for (var i = 0; i < this.connectionTestsObservers_.length; ++i) 492 for (var i = 0; i < this.connectionTestsObservers_.length; ++i)
472 this.connectionTestsObservers_[i].onCompletedConnectionTestSuite(); 493 this.connectionTestsObservers_[i].onCompletedConnectionTestSuite();
473 }; 494 };
474 495
496 BrowserBridge.prototype.receivedHSTSResult = function(info) {
497 for (var i = 0; i < this.hstsObservers_.length; ++i)
498 this.hstsObservers_[i].onHSTSQueryResult(info);
499 };
500
475 BrowserBridge.prototype.receivedHttpCacheInfo = function(info) { 501 BrowserBridge.prototype.receivedHttpCacheInfo = function(info) {
476 this.pollableDataHelpers_.httpCacheInfo.update(info); 502 this.pollableDataHelpers_.httpCacheInfo.update(info);
477 }; 503 };
478 504
479 BrowserBridge.prototype.loadedLogFile = function(logFileContents) { 505 BrowserBridge.prototype.loadedLogFile = function(logFileContents) {
480 var match; 506 var match;
481 // Replace carriage returns with linebreaks and then split around linebreaks. 507 // Replace carriage returns with linebreaks and then split around linebreaks.
482 var lines = logFileContents.replace(/\r/g, '\n').split('\n'); 508 var lines = logFileContents.replace(/\r/g, '\n').split('\n');
483 var entries = []; 509 var entries = [];
484 var numInvalidLines = 0; 510 var numInvalidLines = 0;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 * Adds a listener for the http cache info results. 713 * Adds a listener for the http cache info results.
688 * The observer will be called back with: 714 * The observer will be called back with:
689 * 715 *
690 * observer.onHttpCacheInfoChanged(info); 716 * observer.onHttpCacheInfoChanged(info);
691 */ 717 */
692 BrowserBridge.prototype.addHttpCacheInfoObserver = function(observer) { 718 BrowserBridge.prototype.addHttpCacheInfoObserver = function(observer) {
693 this.pollableDataHelpers_.httpCacheInfo.addObserver(observer); 719 this.pollableDataHelpers_.httpCacheInfo.addObserver(observer);
694 }; 720 };
695 721
696 /** 722 /**
723 * Adds a listener for the results of HSTS (HTTPS Strict Transport Security)
724 * queries. The observer will be called back with:
725 *
726 * observer.onHSTSQueryResult((result);
eroman 2011/02/17 00:48:28 nit: typo, unmatched paren.
agl 2011/02/17 17:21:30 Done.
727 */
728 BrowserBridge.prototype.addHSTSObserver = function(observer) {
729 this.hstsObservers_.push(observer);
730 };
731
732 /**
697 * The browser gives us times in terms of "time ticks" in milliseconds. 733 * The browser gives us times in terms of "time ticks" in milliseconds.
698 * This function converts the tick count to a Date() object. 734 * This function converts the tick count to a Date() object.
699 * 735 *
700 * @param {String} timeTicks. 736 * @param {String} timeTicks.
701 * @returns {Date} The time that |timeTicks| represents. 737 * @returns {Date} The time that |timeTicks| represents.
702 */ 738 */
703 BrowserBridge.prototype.convertTimeTicksToDate = function(timeTicks) { 739 BrowserBridge.prototype.convertTimeTicksToDate = function(timeTicks) {
704 // Note that the subtraction by 0 is to cast to a number (probably a float 740 // Note that the subtraction by 0 is to cast to a number (probably a float
705 // since the numbers are big). 741 // since the numbers are big).
706 var timeStampMs = (this.timeTickOffset_ - 0) + (timeTicks - 0); 742 var timeStampMs = (this.timeTickOffset_ - 0) + (timeTicks - 0);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 return true; 984 return true;
949 }; 985 };
950 986
951 UpdateAllObserver.prototype.onDataReceived_ = function(helper, name, data) { 987 UpdateAllObserver.prototype.onDataReceived_ = function(helper, name, data) {
952 helper.removeObserver(this); 988 helper.removeObserver(this);
953 --this.observingCount_; 989 --this.observingCount_;
954 this.updatedData_[name] = data; 990 this.updatedData_[name] = data;
955 if (this.observingCount_ == 0) 991 if (this.observingCount_ == 0)
956 this.callback_(this.updatedData_); 992 this.callback_(this.updatedData_);
957 }; 993 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698