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

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

Issue 10024056: Added functionality to chrome://net-internals/#chromeos page that user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync. Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/chromeos_view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class provides a "bridge" for communicating between the javascript and 6 * This class provides a "bridge" for communicating between the javascript and
7 * the browser. 7 * the browser.
8 */ 8 */
9 var BrowserBridge = (function() { 9 var BrowserBridge = (function() {
10 'use strict'; 10 'use strict';
11 11
12 /** 12 /**
13 * Delay in milliseconds between updates of certain browser information. 13 * Delay in milliseconds between updates of certain browser information.
14 */ 14 */
15 var POLL_INTERVAL_MS = 5000; 15 var POLL_INTERVAL_MS = 5000;
16 16
17 /** 17 /**
18 * @constructor 18 * @constructor
19 */ 19 */
20 function BrowserBridge() { 20 function BrowserBridge() {
21 assertFirstConstructorCall(BrowserBridge); 21 assertFirstConstructorCall(BrowserBridge);
22 22
23 // List of observers for various bits of browser state. 23 // List of observers for various bits of browser state.
24 this.connectionTestsObservers_ = []; 24 this.connectionTestsObservers_ = [];
25 this.hstsObservers_ = []; 25 this.hstsObservers_ = [];
26 this.httpThrottlingObservers_ = []; 26 this.httpThrottlingObservers_ = [];
27 this.constantsObservers_ = []; 27 this.constantsObservers_ = [];
28 this.crosONCFileParseObservers_ = []; 28 this.crosONCFileParseObservers_ = [];
29 this.storeDebugLogsObservers_ = []; 29 this.storeDebugLogsObservers_ = [];
30 this.setNetworkDebugModeObservers_ = [];
30 31
31 this.pollableDataHelpers_ = {}; 32 this.pollableDataHelpers_ = {};
32 this.pollableDataHelpers_.proxySettings = 33 this.pollableDataHelpers_.proxySettings =
33 new PollableDataHelper('onProxySettingsChanged', 34 new PollableDataHelper('onProxySettingsChanged',
34 this.sendGetProxySettings.bind(this)); 35 this.sendGetProxySettings.bind(this));
35 this.pollableDataHelpers_.badProxies = 36 this.pollableDataHelpers_.badProxies =
36 new PollableDataHelper('onBadProxiesChanged', 37 new PollableDataHelper('onBadProxiesChanged',
37 this.sendGetBadProxies.bind(this)); 38 this.sendGetBadProxies.bind(this));
38 this.pollableDataHelpers_.httpCacheInfo = 39 this.pollableDataHelpers_.httpCacheInfo =
39 new PollableDataHelper('onHttpCacheInfoChanged', 40 new PollableDataHelper('onHttpCacheInfoChanged',
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 }, 232 },
232 233
233 importONCFile: function(fileContent, passcode) { 234 importONCFile: function(fileContent, passcode) {
234 this.send('importONCFile', [fileContent, passcode]); 235 this.send('importONCFile', [fileContent, passcode]);
235 }, 236 },
236 237
237 storeDebugLogs: function() { 238 storeDebugLogs: function() {
238 this.send('storeDebugLogs'); 239 this.send('storeDebugLogs');
239 }, 240 },
240 241
242 setNetworkDebugMode: function(subsystem) {
243 this.send('setNetworkDebugMode', [subsystem]);
244 },
245
241 sendGetHttpPipeliningStatus: function() { 246 sendGetHttpPipeliningStatus: function() {
242 this.send('getHttpPipeliningStatus'); 247 this.send('getHttpPipeliningStatus');
243 }, 248 },
244 249
245 //-------------------------------------------------------------------------- 250 //--------------------------------------------------------------------------
246 // Messages received from the browser. 251 // Messages received from the browser.
247 //-------------------------------------------------------------------------- 252 //--------------------------------------------------------------------------
248 253
249 receive: function(command, params) { 254 receive: function(command, params) {
250 // Does nothing if disabled. 255 // Does nothing if disabled.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 receivedONCFileParse: function(error) { 333 receivedONCFileParse: function(error) {
329 for (var i = 0; i < this.crosONCFileParseObservers_.length; i++) 334 for (var i = 0; i < this.crosONCFileParseObservers_.length; i++)
330 this.crosONCFileParseObservers_[i].onONCFileParse(error); 335 this.crosONCFileParseObservers_[i].onONCFileParse(error);
331 }, 336 },
332 337
333 receivedStoreDebugLogs: function(status) { 338 receivedStoreDebugLogs: function(status) {
334 for (var i = 0; i < this.storeDebugLogsObservers_.length; i++) 339 for (var i = 0; i < this.storeDebugLogsObservers_.length; i++)
335 this.storeDebugLogsObservers_[i].onStoreDebugLogs(status); 340 this.storeDebugLogsObservers_[i].onStoreDebugLogs(status);
336 }, 341 },
337 342
343 receivedSetNetworkDebugMode: function(status) {
344 for (var i = 0; i < this.setNetworkDebugModeObservers_.length; i++)
345 this.setNetworkDebugModeObservers_[i].onSetNetworkDebugMode(status);
346 },
347
338 receivedHttpCacheInfo: function(info) { 348 receivedHttpCacheInfo: function(info) {
339 this.pollableDataHelpers_.httpCacheInfo.update(info); 349 this.pollableDataHelpers_.httpCacheInfo.update(info);
340 }, 350 },
341 351
342 receivedHttpThrottlingEnabledPrefChanged: function(enabled) { 352 receivedHttpThrottlingEnabledPrefChanged: function(enabled) {
343 for (var i = 0; i < this.httpThrottlingObservers_.length; i++) { 353 for (var i = 0; i < this.httpThrottlingObservers_.length; i++) {
344 this.httpThrottlingObservers_[i].onHttpThrottlingEnabledPrefChanged( 354 this.httpThrottlingObservers_[i].onHttpThrottlingEnabledPrefChanged(
345 enabled); 355 enabled);
346 } 356 }
347 }, 357 },
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 * Adds a listener for storing log file status. The observer will be called 544 * Adds a listener for storing log file status. The observer will be called
535 * back with: 545 * back with:
536 * 546 *
537 * observer.onStoreDebugLogs(status); 547 * observer.onStoreDebugLogs(status);
538 */ 548 */
539 addStoreDebugLogsObserver: function(observer) { 549 addStoreDebugLogsObserver: function(observer) {
540 this.storeDebugLogsObservers_.push(observer); 550 this.storeDebugLogsObservers_.push(observer);
541 }, 551 },
542 552
543 /** 553 /**
554 * Adds a listener for network debugging mode status. The observer
555 * will be called back with:
556 *
557 * observer.onSetNetworkDebugMode(status);
558 */
559 addSetNetworkDebugModeObserver: function(observer) {
560 this.setNetworkDebugModeObservers_.push(observer);
561 },
562
563 /**
544 * Adds a listener for HTTP throttling-related events. |observer| will be 564 * Adds a listener for HTTP throttling-related events. |observer| will be
545 * called back when HTTP throttling is enabled/disabled, through: 565 * called back when HTTP throttling is enabled/disabled, through:
546 * 566 *
547 * observer.onHttpThrottlingEnabledPrefChanged(enabled); 567 * observer.onHttpThrottlingEnabledPrefChanged(enabled);
548 */ 568 */
549 addHttpThrottlingObserver: function(observer) { 569 addHttpThrottlingObserver: function(observer) {
550 this.httpThrottlingObservers_.push(observer); 570 this.httpThrottlingObservers_.push(observer);
551 }, 571 },
552 572
553 /** 573 /**
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 helper.removeObserver(this); 755 helper.removeObserver(this);
736 --this.observingCount_; 756 --this.observingCount_;
737 this.updatedData_[name] = data; 757 this.updatedData_[name] = data;
738 if (this.observingCount_ == 0) 758 if (this.observingCount_ == 0)
739 this.callback_(this.updatedData_); 759 this.callback_(this.updatedData_);
740 } 760 }
741 }; 761 };
742 762
743 return BrowserBridge; 763 return BrowserBridge;
744 })(); 764 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/chromeos_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698