| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (cr.isChromeOS) { | 77 if (cr.isChromeOS) { |
| 78 this.pollableDataHelpers_.systemLog = | 78 this.pollableDataHelpers_.systemLog = |
| 79 new PollableDataHelper('onSystemLogChanged', | 79 new PollableDataHelper('onSystemLogChanged', |
| 80 this.getSystemLog.bind(this, 'syslog')); | 80 this.getSystemLog.bind(this, 'syslog')); |
| 81 } | 81 } |
| 82 this.pollableDataHelpers_.dataReductionProxyInfo = |
| 83 new PollableDataHelper('onDataReductionProxyInfoChanged', |
| 84 this.sendGetDataReductionProxyInfo.bind(this)); |
| 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; |
| 87 | 90 |
| 88 // Interval id returned by window.setInterval for polling timer. | 91 // Interval id returned by window.setInterval for polling timer. |
| 89 this.pollIntervalId_ = null; | 92 this.pollIntervalId_ = null; |
| 90 } | 93 } |
| 91 | 94 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 }, | 233 }, |
| 231 | 234 |
| 232 storeDebugLogs: function() { | 235 storeDebugLogs: function() { |
| 233 this.send('storeDebugLogs'); | 236 this.send('storeDebugLogs'); |
| 234 }, | 237 }, |
| 235 | 238 |
| 236 setNetworkDebugMode: function(subsystem) { | 239 setNetworkDebugMode: function(subsystem) { |
| 237 this.send('setNetworkDebugMode', [subsystem]); | 240 this.send('setNetworkDebugMode', [subsystem]); |
| 238 }, | 241 }, |
| 239 | 242 |
| 243 sendGetDataReductionProxyInfo: function() { |
| 244 this.send('getDataReductionProxyInfo'); |
| 245 }, |
| 246 |
| 247 |
| 240 //-------------------------------------------------------------------------- | 248 //-------------------------------------------------------------------------- |
| 241 // Messages received from the browser. | 249 // Messages received from the browser. |
| 242 //-------------------------------------------------------------------------- | 250 //-------------------------------------------------------------------------- |
| 243 | 251 |
| 244 receive: function(command, params) { | 252 receive: function(command, params) { |
| 245 // Does nothing if disabled. | 253 // Does nothing if disabled. |
| 246 if (this.disabled_) | 254 if (this.disabled_) |
| 247 return; | 255 return; |
| 248 | 256 |
| 249 // If no constants have been received, and params does not contain the | 257 // If no constants have been received, and params does not contain the |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 }, | 359 }, |
| 352 | 360 |
| 353 receivedExtensionInfo: function(extensionInfo) { | 361 receivedExtensionInfo: function(extensionInfo) { |
| 354 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); | 362 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); |
| 355 }, | 363 }, |
| 356 | 364 |
| 357 getSystemLogCallback: function(systemLog) { | 365 getSystemLogCallback: function(systemLog) { |
| 358 this.pollableDataHelpers_.systemLog.update(systemLog); | 366 this.pollableDataHelpers_.systemLog.update(systemLog); |
| 359 }, | 367 }, |
| 360 | 368 |
| 369 receivedDataReductionProxyInfo: function(dataReductionProxyInfo) { |
| 370 this.pollableDataHelpers_.dataReductionProxyInfo.update( |
| 371 dataReductionProxyInfo); |
| 372 }, |
| 373 |
| 361 //-------------------------------------------------------------------------- | 374 //-------------------------------------------------------------------------- |
| 362 | 375 |
| 363 /** | 376 /** |
| 364 * Prevents receiving/sending events to/from the browser. | 377 * Prevents receiving/sending events to/from the browser. |
| 365 */ | 378 */ |
| 366 disable: function() { | 379 disable: function() { |
| 367 this.disabled_ = true; | 380 this.disabled_ = true; |
| 368 this.setPollInterval(0); | 381 this.setPollInterval(0); |
| 369 }, | 382 }, |
| 370 | 383 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 * The observer will be called back with: | 553 * The observer will be called back with: |
| 541 * | 554 * |
| 542 * observer.onHttpCacheInfoChanged(info); | 555 * observer.onHttpCacheInfoChanged(info); |
| 543 */ | 556 */ |
| 544 addHttpCacheInfoObserver: function(observer, ignoreWhenUnchanged) { | 557 addHttpCacheInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 545 this.pollableDataHelpers_.httpCacheInfo.addObserver( | 558 this.pollableDataHelpers_.httpCacheInfo.addObserver( |
| 546 observer, ignoreWhenUnchanged); | 559 observer, ignoreWhenUnchanged); |
| 547 }, | 560 }, |
| 548 | 561 |
| 549 /** | 562 /** |
| 563 * Adds a listener of the data reduction proxy info. |observer| will be |
| 564 * called back when data is received, through: |
| 565 * |
| 566 * observer.onDataReductionProxyInfoChanged(dataReductionProxyInfo) |
| 567 */ |
| 568 addDataReductionProxyInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 569 this.pollableDataHelpers_.dataReductionProxyInfo.addObserver( |
| 570 observer, ignoreWhenUnchanged); |
| 571 }, |
| 572 |
| 573 /** |
| 550 * Adds a listener for the results of HSTS (HTTPS Strict Transport Security) | 574 * Adds a listener for the results of HSTS (HTTPS Strict Transport Security) |
| 551 * queries. The observer will be called back with: | 575 * queries. The observer will be called back with: |
| 552 * | 576 * |
| 553 * observer.onHSTSQueryResult(result); | 577 * observer.onHSTSQueryResult(result); |
| 554 */ | 578 */ |
| 555 addHSTSObserver: function(observer) { | 579 addHSTSObserver: function(observer) { |
| 556 this.hstsObservers_.push(observer); | 580 this.hstsObservers_.push(observer); |
| 557 }, | 581 }, |
| 558 | 582 |
| 559 /** | 583 /** |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 helper.removeObserver(this); | 827 helper.removeObserver(this); |
| 804 --this.observingCount_; | 828 --this.observingCount_; |
| 805 this.updatedData_[name] = data; | 829 this.updatedData_[name] = data; |
| 806 if (this.observingCount_ == 0) | 830 if (this.observingCount_ == 0) |
| 807 this.callback_(this.updatedData_); | 831 this.callback_(this.updatedData_); |
| 808 } | 832 } |
| 809 }; | 833 }; |
| 810 | 834 |
| 811 return BrowserBridge; | 835 return BrowserBridge; |
| 812 })(); | 836 })(); |
| OLD | NEW |