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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 this.sendGetSpdyAlternateProtocolMappings.bind( | 68 this.sendGetSpdyAlternateProtocolMappings.bind( |
69 this)); | 69 this)); |
70 if (cr.isWindows) { | 70 if (cr.isWindows) { |
71 this.pollableDataHelpers_.serviceProviders = | 71 this.pollableDataHelpers_.serviceProviders = |
72 new PollableDataHelper('onServiceProvidersChanged', | 72 new PollableDataHelper('onServiceProvidersChanged', |
73 this.sendGetServiceProviders.bind(this)); | 73 this.sendGetServiceProviders.bind(this)); |
74 } | 74 } |
75 this.pollableDataHelpers_.prerenderInfo = | 75 this.pollableDataHelpers_.prerenderInfo = |
76 new PollableDataHelper('onPrerenderInfoChanged', | 76 new PollableDataHelper('onPrerenderInfoChanged', |
77 this.sendGetPrerenderInfo.bind(this)); | 77 this.sendGetPrerenderInfo.bind(this)); |
78 this.pollableDataHelpers_.httpPipeliningStatus = | |
79 new PollableDataHelper('onHttpPipeliningStatusChanged', | |
80 this.sendGetHttpPipeliningStatus.bind(this)); | |
81 this.pollableDataHelpers_.extensionInfo = | 78 this.pollableDataHelpers_.extensionInfo = |
82 new PollableDataHelper('onExtensionInfoChanged', | 79 new PollableDataHelper('onExtensionInfoChanged', |
83 this.sendGetExtensionInfo.bind(this)); | 80 this.sendGetExtensionInfo.bind(this)); |
84 if (cr.isChromeOS) { | 81 if (cr.isChromeOS) { |
85 this.pollableDataHelpers_.systemLog = | 82 this.pollableDataHelpers_.systemLog = |
86 new PollableDataHelper('onSystemLogChanged', | 83 new PollableDataHelper('onSystemLogChanged', |
87 this.getSystemLog.bind(this, 'syslog')); | 84 this.getSystemLog.bind(this, 'syslog')); |
88 } | 85 } |
89 | 86 |
90 // Setting this to true will cause messages from the browser to be ignored, | 87 // Setting this to true will cause messages from the browser to be ignored, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 }, | 235 }, |
239 | 236 |
240 sendGetServiceProviders: function() { | 237 sendGetServiceProviders: function() { |
241 this.send('getServiceProviders'); | 238 this.send('getServiceProviders'); |
242 }, | 239 }, |
243 | 240 |
244 sendGetPrerenderInfo: function() { | 241 sendGetPrerenderInfo: function() { |
245 this.send('getPrerenderInfo'); | 242 this.send('getPrerenderInfo'); |
246 }, | 243 }, |
247 | 244 |
248 sendGetHttpPipeliningStatus: function() { | |
249 this.send('getHttpPipeliningStatus'); | |
250 }, | |
251 | |
252 sendGetExtensionInfo: function() { | 245 sendGetExtensionInfo: function() { |
253 this.send('getExtensionInfo'); | 246 this.send('getExtensionInfo'); |
254 }, | 247 }, |
255 | 248 |
256 enableIPv6: function() { | 249 enableIPv6: function() { |
257 this.send('enableIPv6'); | 250 this.send('enableIPv6'); |
258 }, | 251 }, |
259 | 252 |
260 setLogLevel: function(logLevel) { | 253 setLogLevel: function(logLevel) { |
261 this.send('setLogLevel', ['' + logLevel]); | 254 this.send('setLogLevel', ['' + logLevel]); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 }, | 404 }, |
412 | 405 |
413 receivedHttpCacheInfo: function(info) { | 406 receivedHttpCacheInfo: function(info) { |
414 this.pollableDataHelpers_.httpCacheInfo.update(info); | 407 this.pollableDataHelpers_.httpCacheInfo.update(info); |
415 }, | 408 }, |
416 | 409 |
417 receivedPrerenderInfo: function(prerenderInfo) { | 410 receivedPrerenderInfo: function(prerenderInfo) { |
418 this.pollableDataHelpers_.prerenderInfo.update(prerenderInfo); | 411 this.pollableDataHelpers_.prerenderInfo.update(prerenderInfo); |
419 }, | 412 }, |
420 | 413 |
421 receivedHttpPipeliningStatus: function(httpPipeliningStatus) { | |
422 this.pollableDataHelpers_.httpPipeliningStatus.update( | |
423 httpPipeliningStatus); | |
424 }, | |
425 | |
426 receivedExtensionInfo: function(extensionInfo) { | 414 receivedExtensionInfo: function(extensionInfo) { |
427 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); | 415 this.pollableDataHelpers_.extensionInfo.update(extensionInfo); |
428 }, | 416 }, |
429 | 417 |
430 getSystemLogCallback: function(systemLog) { | 418 getSystemLogCallback: function(systemLog) { |
431 this.pollableDataHelpers_.systemLog.update(systemLog); | 419 this.pollableDataHelpers_.systemLog.update(systemLog); |
432 }, | 420 }, |
433 | 421 |
434 //-------------------------------------------------------------------------- | 422 //-------------------------------------------------------------------------- |
435 | 423 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 * |observer| will be called back with: | 662 * |observer| will be called back with: |
675 * | 663 * |
676 * observer.onPrerenderInfoChanged(prerenderInfo); | 664 * observer.onPrerenderInfoChanged(prerenderInfo); |
677 */ | 665 */ |
678 addPrerenderInfoObserver: function(observer, ignoreWhenUnchanged) { | 666 addPrerenderInfoObserver: function(observer, ignoreWhenUnchanged) { |
679 this.pollableDataHelpers_.prerenderInfo.addObserver( | 667 this.pollableDataHelpers_.prerenderInfo.addObserver( |
680 observer, ignoreWhenUnchanged); | 668 observer, ignoreWhenUnchanged); |
681 }, | 669 }, |
682 | 670 |
683 /** | 671 /** |
684 * Adds a listener of HTTP pipelining status. |observer| will be called | |
685 * back when data is received, through: | |
686 * | |
687 * observer.onHttpPipelineStatusChanged(httpPipeliningStatus) | |
688 */ | |
689 addHttpPipeliningStatusObserver: function(observer, ignoreWhenUnchanged) { | |
690 this.pollableDataHelpers_.httpPipeliningStatus.addObserver( | |
691 observer, ignoreWhenUnchanged); | |
692 }, | |
693 | |
694 /** | |
695 * Adds a listener of extension information. |observer| will be called | 672 * Adds a listener of extension information. |observer| will be called |
696 * back when data is received, through: | 673 * back when data is received, through: |
697 * | 674 * |
698 * observer.onExtensionInfoChanged(extensionInfo) | 675 * observer.onExtensionInfoChanged(extensionInfo) |
699 */ | 676 */ |
700 addExtensionInfoObserver: function(observer, ignoreWhenUnchanged) { | 677 addExtensionInfoObserver: function(observer, ignoreWhenUnchanged) { |
701 this.pollableDataHelpers_.extensionInfo.addObserver( | 678 this.pollableDataHelpers_.extensionInfo.addObserver( |
702 observer, ignoreWhenUnchanged); | 679 observer, ignoreWhenUnchanged); |
703 }, | 680 }, |
704 | 681 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 helper.removeObserver(this); | 845 helper.removeObserver(this); |
869 --this.observingCount_; | 846 --this.observingCount_; |
870 this.updatedData_[name] = data; | 847 this.updatedData_[name] = data; |
871 if (this.observingCount_ == 0) | 848 if (this.observingCount_ == 0) |
872 this.callback_(this.updatedData_); | 849 this.callback_(this.updatedData_); |
873 } | 850 } |
874 }; | 851 }; |
875 | 852 |
876 return BrowserBridge; | 853 return BrowserBridge; |
877 })(); | 854 })(); |
OLD | NEW |