| 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 /** | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 this.pollableDataHelpers_.spdySessionInfo = | 57 this.pollableDataHelpers_.spdySessionInfo = |
| 58 new PollableDataHelper('onSpdySessionInfoChanged', | 58 new PollableDataHelper('onSpdySessionInfoChanged', |
| 59 this.sendGetSpdySessionInfo.bind(this)); | 59 this.sendGetSpdySessionInfo.bind(this)); |
| 60 this.pollableDataHelpers_.spdyStatus = | 60 this.pollableDataHelpers_.spdyStatus = |
| 61 new PollableDataHelper('onSpdyStatusChanged', | 61 new PollableDataHelper('onSpdyStatusChanged', |
| 62 this.sendGetSpdyStatus.bind(this)); | 62 this.sendGetSpdyStatus.bind(this)); |
| 63 this.pollableDataHelpers_.spdyAlternateProtocolMappings = | 63 this.pollableDataHelpers_.spdyAlternateProtocolMappings = |
| 64 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', | 64 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', |
| 65 this.sendGetSpdyAlternateProtocolMappings.bind( | 65 this.sendGetSpdyAlternateProtocolMappings.bind( |
| 66 this)); | 66 this)); |
| 67 this.pollableDataHelpers_.mobileNetLogInfo = |
| 68 new PollableDataHelper('onMobileNetLogInfoChanged', |
| 69 this.sendGetMobileNetLogInfo.bind(this)); |
| 67 if (cr.isWindows) { | 70 if (cr.isWindows) { |
| 68 this.pollableDataHelpers_.serviceProviders = | 71 this.pollableDataHelpers_.serviceProviders = |
| 69 new PollableDataHelper('onServiceProvidersChanged', | 72 new PollableDataHelper('onServiceProvidersChanged', |
| 70 this.sendGetServiceProviders.bind(this)); | 73 this.sendGetServiceProviders.bind(this)); |
| 71 } | 74 } |
| 72 this.pollableDataHelpers_.prerenderInfo = | 75 this.pollableDataHelpers_.prerenderInfo = |
| 73 new PollableDataHelper('onPrerenderInfoChanged', | 76 new PollableDataHelper('onPrerenderInfoChanged', |
| 74 this.sendGetPrerenderInfo.bind(this)); | 77 this.sendGetPrerenderInfo.bind(this)); |
| 75 this.pollableDataHelpers_.httpPipeliningStatus = | 78 this.pollableDataHelpers_.httpPipeliningStatus = |
| 76 new PollableDataHelper('onHttpPipeliningStatusChanged', | 79 new PollableDataHelper('onHttpPipeliningStatusChanged', |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 }, | 200 }, |
| 198 | 201 |
| 199 sendGetSessionNetworkStats: function() { | 202 sendGetSessionNetworkStats: function() { |
| 200 this.send('getSessionNetworkStats'); | 203 this.send('getSessionNetworkStats'); |
| 201 }, | 204 }, |
| 202 | 205 |
| 203 sendGetHistoricNetworkStats: function() { | 206 sendGetHistoricNetworkStats: function() { |
| 204 this.send('getHistoricNetworkStats'); | 207 this.send('getHistoricNetworkStats'); |
| 205 }, | 208 }, |
| 206 | 209 |
| 210 sendStartNetLog: function() { |
| 211 this.send('startNetLog'); |
| 212 }, |
| 213 |
| 214 sendStopNetLog: function() { |
| 215 this.send('stopNetLog'); |
| 216 }, |
| 217 |
| 218 sendSendNetLog: function() { |
| 219 this.send('sendNetLog'); |
| 220 }, |
| 221 |
| 207 sendCloseIdleSockets: function() { | 222 sendCloseIdleSockets: function() { |
| 208 this.send('closeIdleSockets'); | 223 this.send('closeIdleSockets'); |
| 209 }, | 224 }, |
| 210 | 225 |
| 211 sendFlushSocketPools: function() { | 226 sendFlushSocketPools: function() { |
| 212 this.send('flushSocketPools'); | 227 this.send('flushSocketPools'); |
| 213 }, | 228 }, |
| 214 | 229 |
| 215 sendGetSpdySessionInfo: function() { | 230 sendGetSpdySessionInfo: function() { |
| 216 this.send('getSpdySessionInfo'); | 231 this.send('getSpdySessionInfo'); |
| 217 }, | 232 }, |
| 218 | 233 |
| 219 sendGetSpdyStatus: function() { | 234 sendGetSpdyStatus: function() { |
| 220 this.send('getSpdyStatus'); | 235 this.send('getSpdyStatus'); |
| 221 }, | 236 }, |
| 222 | 237 |
| 223 sendGetSpdyAlternateProtocolMappings: function() { | 238 sendGetSpdyAlternateProtocolMappings: function() { |
| 224 this.send('getSpdyAlternateProtocolMappings'); | 239 this.send('getSpdyAlternateProtocolMappings'); |
| 225 }, | 240 }, |
| 226 | 241 |
| 242 sendGetMobileNetLogInfo: function() { |
| 243 this.send('getMobileNetLogInfo'); |
| 244 }, |
| 245 |
| 227 sendGetServiceProviders: function() { | 246 sendGetServiceProviders: function() { |
| 228 this.send('getServiceProviders'); | 247 this.send('getServiceProviders'); |
| 229 }, | 248 }, |
| 230 | 249 |
| 231 sendGetPrerenderInfo: function() { | 250 sendGetPrerenderInfo: function() { |
| 232 this.send('getPrerenderInfo'); | 251 this.send('getPrerenderInfo'); |
| 233 }, | 252 }, |
| 234 | 253 |
| 235 enableIPv6: function() { | 254 enableIPv6: function() { |
| 236 this.send('enableIPv6'); | 255 this.send('enableIPv6'); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 receivedSpdyStatus: function(spdyStatus) { | 353 receivedSpdyStatus: function(spdyStatus) { |
| 335 this.pollableDataHelpers_.spdyStatus.update(spdyStatus); | 354 this.pollableDataHelpers_.spdyStatus.update(spdyStatus); |
| 336 }, | 355 }, |
| 337 | 356 |
| 338 receivedSpdyAlternateProtocolMappings: | 357 receivedSpdyAlternateProtocolMappings: |
| 339 function(spdyAlternateProtocolMappings) { | 358 function(spdyAlternateProtocolMappings) { |
| 340 this.pollableDataHelpers_.spdyAlternateProtocolMappings.update( | 359 this.pollableDataHelpers_.spdyAlternateProtocolMappings.update( |
| 341 spdyAlternateProtocolMappings); | 360 spdyAlternateProtocolMappings); |
| 342 }, | 361 }, |
| 343 | 362 |
| 363 receivedMobileNetLogInfo: function(mobileNetLogInfo) { |
| 364 this.pollableDataHelpers_.mobileNetLogInfo.update(mobileNetLogInfo); |
| 365 }, |
| 366 |
| 344 receivedServiceProviders: function(serviceProviders) { | 367 receivedServiceProviders: function(serviceProviders) { |
| 345 this.pollableDataHelpers_.serviceProviders.update(serviceProviders); | 368 this.pollableDataHelpers_.serviceProviders.update(serviceProviders); |
| 346 }, | 369 }, |
| 347 | 370 |
| 348 receivedStartConnectionTestSuite: function() { | 371 receivedStartConnectionTestSuite: function() { |
| 349 for (var i = 0; i < this.connectionTestsObservers_.length; i++) | 372 for (var i = 0; i < this.connectionTestsObservers_.length; i++) |
| 350 this.connectionTestsObservers_[i].onStartedConnectionTestSuite(); | 373 this.connectionTestsObservers_[i].onStartedConnectionTestSuite(); |
| 351 }, | 374 }, |
| 352 | 375 |
| 353 receivedStartConnectionTestExperiment: function(experiment) { | 376 receivedStartConnectionTestExperiment: function(experiment) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 * observer.onSpdyAlternateProtocolMappingsChanged( | 556 * observer.onSpdyAlternateProtocolMappingsChanged( |
| 534 * spdyAlternateProtocolMappings) | 557 * spdyAlternateProtocolMappings) |
| 535 */ | 558 */ |
| 536 addSpdyAlternateProtocolMappingsObserver: function(observer, | 559 addSpdyAlternateProtocolMappingsObserver: function(observer, |
| 537 ignoreWhenUnchanged) { | 560 ignoreWhenUnchanged) { |
| 538 this.pollableDataHelpers_.spdyAlternateProtocolMappings.addObserver( | 561 this.pollableDataHelpers_.spdyAlternateProtocolMappings.addObserver( |
| 539 observer, ignoreWhenUnchanged); | 562 observer, ignoreWhenUnchanged); |
| 540 }, | 563 }, |
| 541 | 564 |
| 542 /** | 565 /** |
| 566 * Adds a listener of the NetLogTempFile state. |observer| will be called |
| 567 * back when data is received, through: |
| 568 * |
| 569 * observer.onMobileNetLogInfoChanged(mobileNetLogInfo) |
| 570 */ |
| 571 addMobileNetLogInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 572 this.pollableDataHelpers_.mobileNetLogInfo.addObserver( |
| 573 observer, ignoreWhenUnchanged); |
| 574 }, |
| 575 |
| 576 /** |
| 543 * Adds a listener of the service providers info. |observer| will be called | 577 * Adds a listener of the service providers info. |observer| will be called |
| 544 * back when data is received, through: | 578 * back when data is received, through: |
| 545 * | 579 * |
| 546 * observer.onServiceProvidersChanged(serviceProviders) | 580 * observer.onServiceProvidersChanged(serviceProviders) |
| 547 * | 581 * |
| 548 * Will do nothing if on a platform other than Windows, as service providers | 582 * Will do nothing if on a platform other than Windows, as service providers |
| 549 * are only present on Windows. | 583 * are only present on Windows. |
| 550 */ | 584 */ |
| 551 addServiceProvidersObserver: function(observer, ignoreWhenUnchanged) { | 585 addServiceProvidersObserver: function(observer, ignoreWhenUnchanged) { |
| 552 if (this.pollableDataHelpers_.serviceProviders) { | 586 if (this.pollableDataHelpers_.serviceProviders) { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 helper.removeObserver(this); | 838 helper.removeObserver(this); |
| 805 --this.observingCount_; | 839 --this.observingCount_; |
| 806 this.updatedData_[name] = data; | 840 this.updatedData_[name] = data; |
| 807 if (this.observingCount_ == 0) | 841 if (this.observingCount_ == 0) |
| 808 this.callback_(this.updatedData_); | 842 this.callback_(this.updatedData_); |
| 809 } | 843 } |
| 810 }; | 844 }; |
| 811 | 845 |
| 812 return BrowserBridge; | 846 return BrowserBridge; |
| 813 })(); | 847 })(); |
| OLD | NEW |