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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 this.pollableDataHelpers_.serviceProviders = | 67 this.pollableDataHelpers_.serviceProviders = |
68 new PollableDataHelper('onServiceProvidersChanged', | 68 new PollableDataHelper('onServiceProvidersChanged', |
69 this.sendGetServiceProviders.bind(this)); | 69 this.sendGetServiceProviders.bind(this)); |
70 } | 70 } |
71 this.pollableDataHelpers_.prerenderInfo = | 71 this.pollableDataHelpers_.prerenderInfo = |
72 new PollableDataHelper('onPrerenderInfoChanged', | 72 new PollableDataHelper('onPrerenderInfoChanged', |
73 this.sendGetPrerenderInfo.bind(this)); | 73 this.sendGetPrerenderInfo.bind(this)); |
74 this.pollableDataHelpers_.extensionInfo = | 74 this.pollableDataHelpers_.extensionInfo = |
75 new PollableDataHelper('onExtensionInfoChanged', | 75 new PollableDataHelper('onExtensionInfoChanged', |
76 this.sendGetExtensionInfo.bind(this)); | 76 this.sendGetExtensionInfo.bind(this)); |
| 77 this.pollableDataHelpers_.dataReductionProxyInfo = |
| 78 new PollableDataHelper('onDataReductionProxyInfoChanged', |
| 79 this.sendGetDataReductionProxyInfo.bind(this)); |
77 if (cr.isChromeOS) { | 80 if (cr.isChromeOS) { |
78 this.pollableDataHelpers_.systemLog = | 81 this.pollableDataHelpers_.systemLog = |
79 new PollableDataHelper('onSystemLogChanged', | 82 new PollableDataHelper('onSystemLogChanged', |
80 this.getSystemLog.bind(this, 'syslog')); | 83 this.getSystemLog.bind(this, 'syslog')); |
81 } | 84 } |
82 | 85 |
83 // Setting this to true will cause messages from the browser to be ignored, | 86 // Setting this to true will cause messages from the browser to be ignored, |
84 // and no messages will be sent to the browser, either. Intended for use | 87 // and no messages will be sent to the browser, either. Intended for use |
85 // when viewing log files. | 88 // when viewing log files. |
86 this.disabled_ = false; | 89 this.disabled_ = false; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 }, | 205 }, |
203 | 206 |
204 sendGetPrerenderInfo: function() { | 207 sendGetPrerenderInfo: function() { |
205 this.send('getPrerenderInfo'); | 208 this.send('getPrerenderInfo'); |
206 }, | 209 }, |
207 | 210 |
208 sendGetExtensionInfo: function() { | 211 sendGetExtensionInfo: function() { |
209 this.send('getExtensionInfo'); | 212 this.send('getExtensionInfo'); |
210 }, | 213 }, |
211 | 214 |
| 215 sendGetDataReductionProxyInfo: function() { |
| 216 this.send('getDataReductionProxyInfo'); |
| 217 }, |
| 218 |
212 enableIPv6: function() { | 219 enableIPv6: function() { |
213 this.send('enableIPv6'); | 220 this.send('enableIPv6'); |
214 }, | 221 }, |
215 | 222 |
216 setLogLevel: function(logLevel) { | 223 setLogLevel: function(logLevel) { |
217 this.send('setLogLevel', ['' + logLevel]); | 224 this.send('setLogLevel', ['' + logLevel]); |
218 }, | 225 }, |
219 | 226 |
220 refreshSystemLogs: function() { | 227 refreshSystemLogs: function() { |
221 this.send('refreshSystemLogs'); | 228 this.send('refreshSystemLogs'); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 }, | 354 }, |
348 | 355 |
349 receivedPrerenderInfo: function(prerenderInfo) { | 356 receivedPrerenderInfo: function(prerenderInfo) { |
350 this.pollableDataHelpers_.prerenderInfo.update(prerenderInfo); | 357 this.pollableDataHelpers_.prerenderInfo.update(prerenderInfo); |
351 }, | 358 }, |
352 | 359 |
353 receivedExtensionInfo: function(extensionInfo) { | 360 receivedExtensionInfo: function(extensionInfo) { |
354 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); | 361 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); |
355 }, | 362 }, |
356 | 363 |
| 364 receivedDataReductionProxyInfo: function(dataReductionProxyInfo) { |
| 365 this.pollableDataHelpers_.dataReductionProxyInfo.update( |
| 366 dataReductionProxyInfo); |
| 367 }, |
| 368 |
357 getSystemLogCallback: function(systemLog) { | 369 getSystemLogCallback: function(systemLog) { |
358 this.pollableDataHelpers_.systemLog.update(systemLog); | 370 this.pollableDataHelpers_.systemLog.update(systemLog); |
359 }, | 371 }, |
360 | 372 |
361 //-------------------------------------------------------------------------- | 373 //-------------------------------------------------------------------------- |
362 | 374 |
363 /** | 375 /** |
364 * Prevents receiving/sending events to/from the browser. | 376 * Prevents receiving/sending events to/from the browser. |
365 */ | 377 */ |
366 disable: function() { | 378 disable: function() { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 * back when data is received, through: | 624 * back when data is received, through: |
613 * | 625 * |
614 * observer.onExtensionInfoChanged(extensionInfo) | 626 * observer.onExtensionInfoChanged(extensionInfo) |
615 */ | 627 */ |
616 addExtensionInfoObserver: function(observer, ignoreWhenUnchanged) { | 628 addExtensionInfoObserver: function(observer, ignoreWhenUnchanged) { |
617 this.pollableDataHelpers_.extensionInfo.addObserver( | 629 this.pollableDataHelpers_.extensionInfo.addObserver( |
618 observer, ignoreWhenUnchanged); | 630 observer, ignoreWhenUnchanged); |
619 }, | 631 }, |
620 | 632 |
621 /** | 633 /** |
| 634 * Adds a listener of the data reduction proxy info. |observer| will be |
| 635 * called back when data is received, through: |
| 636 * |
| 637 * observer.onDataReductionProxyInfoChanged(dataReductionProxyInfo) |
| 638 */ |
| 639 addDataReductionProxyInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 640 this.pollableDataHelpers_.dataReductionProxyInfo.addObserver( |
| 641 observer, ignoreWhenUnchanged); |
| 642 }, |
| 643 |
| 644 /** |
622 * Adds a listener of system log information. |observer| will be called | 645 * Adds a listener of system log information. |observer| will be called |
623 * back when data is received, through: | 646 * back when data is received, through: |
624 * | 647 * |
625 * observer.onSystemLogChanged(systemLogInfo) | 648 * observer.onSystemLogChanged(systemLogInfo) |
626 */ | 649 */ |
627 addSystemLogObserver: function(observer, ignoreWhenUnchanged) { | 650 addSystemLogObserver: function(observer, ignoreWhenUnchanged) { |
628 if (this.pollableDataHelpers_.systemLog) { | 651 if (this.pollableDataHelpers_.systemLog) { |
629 this.pollableDataHelpers_.systemLog.addObserver( | 652 this.pollableDataHelpers_.systemLog.addObserver( |
630 observer, ignoreWhenUnchanged); | 653 observer, ignoreWhenUnchanged); |
631 } | 654 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 helper.removeObserver(this); | 826 helper.removeObserver(this); |
804 --this.observingCount_; | 827 --this.observingCount_; |
805 this.updatedData_[name] = data; | 828 this.updatedData_[name] = data; |
806 if (this.observingCount_ == 0) | 829 if (this.observingCount_ == 0) |
807 this.callback_(this.updatedData_); | 830 this.callback_(this.updatedData_); |
808 } | 831 } |
809 }; | 832 }; |
810 | 833 |
811 return BrowserBridge; | 834 return BrowserBridge; |
812 })(); | 835 })(); |
OLD | NEW |