OLD | NEW |
---|---|
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 // Populated by constants from the browser. Used only by this file. | 5 // Populated by constants from the browser. Used only by this file. |
6 var NetInfoSources = null; | 6 var NetInfoSources = null; |
7 | 7 |
8 /** | 8 /** |
9 * This class provides a "bridge" for communicating between the javascript and | 9 * This class provides a "bridge" for communicating between the javascript and |
10 * the browser. | 10 * the browser. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 this.addNetInfoPollableDataHelper('hostResolverInfo', | 45 this.addNetInfoPollableDataHelper('hostResolverInfo', |
46 'onHostResolverInfoChanged'); | 46 'onHostResolverInfoChanged'); |
47 this.addNetInfoPollableDataHelper('socketPoolInfo', | 47 this.addNetInfoPollableDataHelper('socketPoolInfo', |
48 'onSocketPoolInfoChanged'); | 48 'onSocketPoolInfoChanged'); |
49 this.addNetInfoPollableDataHelper('spdySessionInfo', | 49 this.addNetInfoPollableDataHelper('spdySessionInfo', |
50 'onSpdySessionInfoChanged'); | 50 'onSpdySessionInfoChanged'); |
51 this.addNetInfoPollableDataHelper('spdyStatus', 'onSpdyStatusChanged'); | 51 this.addNetInfoPollableDataHelper('spdyStatus', 'onSpdyStatusChanged'); |
52 this.addNetInfoPollableDataHelper('spdyAlternateProtocolMappings', | 52 this.addNetInfoPollableDataHelper('spdyAlternateProtocolMappings', |
53 'onSpdyAlternateProtocolMappingsChanged'); | 53 'onSpdyAlternateProtocolMappingsChanged'); |
54 this.addNetInfoPollableDataHelper('quicInfo', 'onQuicInfoChanged'); | 54 this.addNetInfoPollableDataHelper('quicInfo', 'onQuicInfoChanged'); |
55 this.addNetInfoPollableDataHelper('sdchInfo', 'onSdchInfoChanged'); | |
55 this.addNetInfoPollableDataHelper('httpCacheInfo', | 56 this.addNetInfoPollableDataHelper('httpCacheInfo', |
56 'onHttpCacheInfoChanged'); | 57 'onHttpCacheInfoChanged'); |
57 | 58 |
58 // Add other PollableDataHelpers. | 59 // Add other PollableDataHelpers. |
59 this.pollableDataHelpers_.sessionNetworkStats = | 60 this.pollableDataHelpers_.sessionNetworkStats = |
60 new PollableDataHelper('onSessionNetworkStatsChanged', | 61 new PollableDataHelper('onSessionNetworkStatsChanged', |
61 this.sendGetSessionNetworkStats.bind(this)); | 62 this.sendGetSessionNetworkStats.bind(this)); |
62 this.pollableDataHelpers_.historicNetworkStats = | 63 this.pollableDataHelpers_.historicNetworkStats = |
63 new PollableDataHelper('onHistoricNetworkStatsChanged', | 64 new PollableDataHelper('onHistoricNetworkStatsChanged', |
64 this.sendGetHistoricNetworkStats.bind(this)); | 65 this.sendGetHistoricNetworkStats.bind(this)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 }, | 202 }, |
202 | 203 |
203 sendGetPrerenderInfo: function() { | 204 sendGetPrerenderInfo: function() { |
204 this.send('getPrerenderInfo'); | 205 this.send('getPrerenderInfo'); |
205 }, | 206 }, |
206 | 207 |
207 sendGetExtensionInfo: function() { | 208 sendGetExtensionInfo: function() { |
208 this.send('getExtensionInfo'); | 209 this.send('getExtensionInfo'); |
209 }, | 210 }, |
210 | 211 |
212 sendGetSdchInfo: function() { | |
213 this.send('getSdchInfo'); | |
214 }, | |
mmenke
2014/10/30 21:18:52
No longer needed.
baranovich
2014/10/31 19:55:32
Done.
| |
215 | |
211 enableIPv6: function() { | 216 enableIPv6: function() { |
212 this.send('enableIPv6'); | 217 this.send('enableIPv6'); |
213 }, | 218 }, |
214 | 219 |
215 setLogLevel: function(logLevel) { | 220 setLogLevel: function(logLevel) { |
216 this.send('setLogLevel', ['' + logLevel]); | 221 this.send('setLogLevel', ['' + logLevel]); |
217 }, | 222 }, |
218 | 223 |
219 refreshSystemLogs: function() { | 224 refreshSystemLogs: function() { |
220 this.send('refreshSystemLogs'); | 225 this.send('refreshSystemLogs'); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 }, | 355 }, |
351 | 356 |
352 receivedExtensionInfo: function(extensionInfo) { | 357 receivedExtensionInfo: function(extensionInfo) { |
353 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); | 358 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); |
354 }, | 359 }, |
355 | 360 |
356 getSystemLogCallback: function(systemLog) { | 361 getSystemLogCallback: function(systemLog) { |
357 this.pollableDataHelpers_.systemLog.update(systemLog); | 362 this.pollableDataHelpers_.systemLog.update(systemLog); |
358 }, | 363 }, |
359 | 364 |
365 receivedSdchInfo: function(sdchInfo) { | |
mmenke
2014/10/30 21:18:52
No longer needed.
baranovich
2014/10/31 19:55:32
Done.
| |
366 this.pollableDataHelpers_.sdchInfo.update(sdchInfo); | |
367 }, | |
368 | |
360 //-------------------------------------------------------------------------- | 369 //-------------------------------------------------------------------------- |
361 | 370 |
362 /** | 371 /** |
363 * Prevents receiving/sending events to/from the browser. | 372 * Prevents receiving/sending events to/from the browser. |
364 */ | 373 */ |
365 disable: function() { | 374 disable: function() { |
366 this.disabled_ = true; | 375 this.disabled_ = true; |
367 this.setPollInterval(0); | 376 this.setPollInterval(0); |
368 }, | 377 }, |
369 | 378 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 * observer.onSystemLogChanged(systemLogInfo) | 633 * observer.onSystemLogChanged(systemLogInfo) |
625 */ | 634 */ |
626 addSystemLogObserver: function(observer, ignoreWhenUnchanged) { | 635 addSystemLogObserver: function(observer, ignoreWhenUnchanged) { |
627 if (this.pollableDataHelpers_.systemLog) { | 636 if (this.pollableDataHelpers_.systemLog) { |
628 this.pollableDataHelpers_.systemLog.addObserver( | 637 this.pollableDataHelpers_.systemLog.addObserver( |
629 observer, ignoreWhenUnchanged); | 638 observer, ignoreWhenUnchanged); |
630 } | 639 } |
631 }, | 640 }, |
632 | 641 |
633 /** | 642 /** |
643 * Adds a listener of SDCH information. |observer| will be called | |
644 * back when data is received, through: | |
645 * | |
646 * observer.onSdchInfoChanged(sdchInfo) | |
647 */ | |
648 addSdchInfoObserver: function(observer, ignoreWhenUnchanged) { | |
649 this.pollableDataHelpers_.sdchInfo.addObserver( | |
650 observer, ignoreWhenUnchanged); | |
651 }, | |
652 | |
653 /** | |
634 * If |force| is true, calls all startUpdate functions. Otherwise, just | 654 * If |force| is true, calls all startUpdate functions. Otherwise, just |
635 * runs updates with active observers. | 655 * runs updates with active observers. |
636 */ | 656 */ |
637 checkForUpdatedInfo: function(force) { | 657 checkForUpdatedInfo: function(force) { |
638 for (var name in this.pollableDataHelpers_) { | 658 for (var name in this.pollableDataHelpers_) { |
639 var helper = this.pollableDataHelpers_[name]; | 659 var helper = this.pollableDataHelpers_[name]; |
640 if (force || helper.hasActiveObserver()) | 660 if (force || helper.hasActiveObserver()) |
641 helper.startUpdate(); | 661 helper.startUpdate(); |
642 } | 662 } |
643 }, | 663 }, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
791 helper.removeObserver(this); | 811 helper.removeObserver(this); |
792 --this.observingCount_; | 812 --this.observingCount_; |
793 this.updatedData_[name] = data; | 813 this.updatedData_[name] = data; |
794 if (this.observingCount_ == 0) | 814 if (this.observingCount_ == 0) |
795 this.callback_(this.updatedData_); | 815 this.callback_(this.updatedData_); |
796 } | 816 } |
797 }; | 817 }; |
798 | 818 |
799 return BrowserBridge; | 819 return BrowserBridge; |
800 })(); | 820 })(); |
OLD | NEW |