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

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

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes. Lots. Created 6 years, 2 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 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';
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.pollableDataHelpers_.spdySessionInfo = 60 this.pollableDataHelpers_.spdySessionInfo =
61 new PollableDataHelper('onSpdySessionInfoChanged', 61 new PollableDataHelper('onSpdySessionInfoChanged',
62 this.sendGetSpdySessionInfo.bind(this)); 62 this.sendGetSpdySessionInfo.bind(this));
63 this.pollableDataHelpers_.spdyStatus = 63 this.pollableDataHelpers_.spdyStatus =
64 new PollableDataHelper('onSpdyStatusChanged', 64 new PollableDataHelper('onSpdyStatusChanged',
65 this.sendGetSpdyStatus.bind(this)); 65 this.sendGetSpdyStatus.bind(this));
66 this.pollableDataHelpers_.spdyAlternateProtocolMappings = 66 this.pollableDataHelpers_.spdyAlternateProtocolMappings =
67 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', 67 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged',
68 this.sendGetSpdyAlternateProtocolMappings.bind( 68 this.sendGetSpdyAlternateProtocolMappings.bind(
69 this)); 69 this));
70 this.pollableDataHelpers_.sdchInfo =
71 new PollableDataHelper('onSdchInfoChanged',
72 this.sendGetSdchInfo.bind(this));
70 if (cr.isWindows) { 73 if (cr.isWindows) {
71 this.pollableDataHelpers_.serviceProviders = 74 this.pollableDataHelpers_.serviceProviders =
72 new PollableDataHelper('onServiceProvidersChanged', 75 new PollableDataHelper('onServiceProvidersChanged',
73 this.sendGetServiceProviders.bind(this)); 76 this.sendGetServiceProviders.bind(this));
74 } 77 }
75 this.pollableDataHelpers_.prerenderInfo = 78 this.pollableDataHelpers_.prerenderInfo =
76 new PollableDataHelper('onPrerenderInfoChanged', 79 new PollableDataHelper('onPrerenderInfoChanged',
77 this.sendGetPrerenderInfo.bind(this)); 80 this.sendGetPrerenderInfo.bind(this));
78 this.pollableDataHelpers_.extensionInfo = 81 this.pollableDataHelpers_.extensionInfo =
79 new PollableDataHelper('onExtensionInfoChanged', 82 new PollableDataHelper('onExtensionInfoChanged',
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 }, 242 },
240 243
241 sendGetPrerenderInfo: function() { 244 sendGetPrerenderInfo: function() {
242 this.send('getPrerenderInfo'); 245 this.send('getPrerenderInfo');
243 }, 246 },
244 247
245 sendGetExtensionInfo: function() { 248 sendGetExtensionInfo: function() {
246 this.send('getExtensionInfo'); 249 this.send('getExtensionInfo');
247 }, 250 },
248 251
252 sendGetSdchInfo: function() {
253 this.send('getSdchInfo');
254 },
255
249 enableIPv6: function() { 256 enableIPv6: function() {
250 this.send('enableIPv6'); 257 this.send('enableIPv6');
251 }, 258 },
252 259
253 setLogLevel: function(logLevel) { 260 setLogLevel: function(logLevel) {
254 this.send('setLogLevel', ['' + logLevel]); 261 this.send('setLogLevel', ['' + logLevel]);
255 }, 262 },
256 263
257 refreshSystemLogs: function() { 264 refreshSystemLogs: function() {
258 this.send('refreshSystemLogs'); 265 this.send('refreshSystemLogs');
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 }, 419 },
413 420
414 receivedExtensionInfo: function(extensionInfo) { 421 receivedExtensionInfo: function(extensionInfo) {
415 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); 422 this.pollableDataHelpers_.extensionInfo.update(extensionInfo);
416 }, 423 },
417 424
418 getSystemLogCallback: function(systemLog) { 425 getSystemLogCallback: function(systemLog) {
419 this.pollableDataHelpers_.systemLog.update(systemLog); 426 this.pollableDataHelpers_.systemLog.update(systemLog);
420 }, 427 },
421 428
429 receivedSdchInfo: function(sdchInfo) {
430 this.pollableDataHelpers_.sdchInfo.update(sdchInfo);
431 },
432
422 //-------------------------------------------------------------------------- 433 //--------------------------------------------------------------------------
423 434
424 /** 435 /**
425 * Prevents receiving/sending events to/from the browser. 436 * Prevents receiving/sending events to/from the browser.
426 */ 437 */
427 disable: function() { 438 disable: function() {
428 this.disabled_ = true; 439 this.disabled_ = true;
429 this.setPollInterval(0); 440 this.setPollInterval(0);
430 }, 441 },
431 442
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 * observer.onSystemLogChanged(systemLogInfo) 697 * observer.onSystemLogChanged(systemLogInfo)
687 */ 698 */
688 addSystemLogObserver: function(observer, ignoreWhenUnchanged) { 699 addSystemLogObserver: function(observer, ignoreWhenUnchanged) {
689 if (this.pollableDataHelpers_.systemLog) { 700 if (this.pollableDataHelpers_.systemLog) {
690 this.pollableDataHelpers_.systemLog.addObserver( 701 this.pollableDataHelpers_.systemLog.addObserver(
691 observer, ignoreWhenUnchanged); 702 observer, ignoreWhenUnchanged);
692 } 703 }
693 }, 704 },
694 705
695 /** 706 /**
707 * Adds a listener of SDCH information. |observer| will be called
708 * back when data is received, through:
709 *
710 * observer.onSdchInfoChanged(sdchInfo)
711 */
712 addSdchInfoObserver: function(observer, ignoreWhenUnchanged) {
713 this.pollableDataHelpers_.sdchInfo.addObserver(
714 observer, ignoreWhenUnchanged);
715 },
716
717 /**
696 * If |force| is true, calls all startUpdate functions. Otherwise, just 718 * If |force| is true, calls all startUpdate functions. Otherwise, just
697 * runs updates with active observers. 719 * runs updates with active observers.
698 */ 720 */
699 checkForUpdatedInfo: function(force) { 721 checkForUpdatedInfo: function(force) {
700 for (var name in this.pollableDataHelpers_) { 722 for (var name in this.pollableDataHelpers_) {
701 var helper = this.pollableDataHelpers_[name]; 723 var helper = this.pollableDataHelpers_[name];
702 if (force || helper.hasActiveObserver()) 724 if (force || helper.hasActiveObserver())
703 helper.startUpdate(); 725 helper.startUpdate();
704 } 726 }
705 }, 727 },
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 helper.removeObserver(this); 867 helper.removeObserver(this);
846 --this.observingCount_; 868 --this.observingCount_;
847 this.updatedData_[name] = data; 869 this.updatedData_[name] = data;
848 if (this.observingCount_ == 0) 870 if (this.observingCount_ == 0)
849 this.callback_(this.updatedData_); 871 this.callback_(this.updatedData_);
850 } 872 }
851 }; 873 };
852 874
853 return BrowserBridge; 875 return BrowserBridge;
854 })(); 876 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/index.html » ('j') | chrome/browser/resources/net_internals/main.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698