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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 new PollableDataHelper('onServiceProvidersChanged', | 58 new PollableDataHelper('onServiceProvidersChanged', |
59 this.sendGetServiceProviders.bind(this)); | 59 this.sendGetServiceProviders.bind(this)); |
60 } | 60 } |
61 this.pollableDataHelpers_.prerenderInfo = | 61 this.pollableDataHelpers_.prerenderInfo = |
62 new PollableDataHelper('onPrerenderInfoChanged', | 62 new PollableDataHelper('onPrerenderInfoChanged', |
63 this.sendGetPrerenderInfo.bind(this)); | 63 this.sendGetPrerenderInfo.bind(this)); |
64 this.pollableDataHelpers_.httpPipeliningStatus = | 64 this.pollableDataHelpers_.httpPipeliningStatus = |
65 new PollableDataHelper('onHttpPipeliningStatusChanged', | 65 new PollableDataHelper('onHttpPipeliningStatusChanged', |
66 this.sendGetHttpPipeliningStatus.bind(this)); | 66 this.sendGetHttpPipeliningStatus.bind(this)); |
67 | 67 |
68 // NetLog entries are all sent to the |SourceTracker|, which both tracks | |
69 // them and manages its own observer list. | |
70 this.sourceTracker = new SourceTracker(); | |
71 | |
72 // Setting this to true will cause messages from the browser to be ignored, | 68 // Setting this to true will cause messages from the browser to be ignored, |
73 // and no messages will be sent to the browser, either. Intended for use | 69 // and no messages will be sent to the browser, either. Intended for use |
74 // when viewing log files. | 70 // when viewing log files. |
75 this.disabled_ = false; | 71 this.disabled_ = false; |
76 | 72 |
77 // Interval id returned by window.setInterval for polling timer. | 73 // Interval id returned by window.setInterval for polling timer. |
78 this.pollIntervalId_ = null; | 74 this.pollIntervalId_ = null; |
79 } | 75 } |
80 | 76 |
81 cr.addSingletonGetter(BrowserBridge); | 77 cr.addSingletonGetter(BrowserBridge); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return; | 247 return; |
252 this[command](params); | 248 this[command](params); |
253 }, | 249 }, |
254 | 250 |
255 receivedConstants: function(constants) { | 251 receivedConstants: function(constants) { |
256 for (var i = 0; i < this.constantsObservers_.length; i++) | 252 for (var i = 0; i < this.constantsObservers_.length; i++) |
257 this.constantsObservers_[i].onReceivedConstants(constants); | 253 this.constantsObservers_[i].onReceivedConstants(constants); |
258 }, | 254 }, |
259 | 255 |
260 receivedLogEntries: function(logEntries) { | 256 receivedLogEntries: function(logEntries) { |
261 this.sourceTracker.onReceivedLogEntries(logEntries); | 257 EventsTracker.getInstance().addLogEntries(logEntries); |
262 }, | 258 }, |
263 | 259 |
264 receivedProxySettings: function(proxySettings) { | 260 receivedProxySettings: function(proxySettings) { |
265 this.pollableDataHelpers_.proxySettings.update(proxySettings); | 261 this.pollableDataHelpers_.proxySettings.update(proxySettings); |
266 }, | 262 }, |
267 | 263 |
268 receivedBadProxies: function(badProxies) { | 264 receivedBadProxies: function(badProxies) { |
269 this.pollableDataHelpers_.badProxies.update(badProxies); | 265 this.pollableDataHelpers_.badProxies.update(badProxies); |
270 }, | 266 }, |
271 | 267 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 helper.removeObserver(this); | 715 helper.removeObserver(this); |
720 --this.observingCount_; | 716 --this.observingCount_; |
721 this.updatedData_[name] = data; | 717 this.updatedData_[name] = data; |
722 if (this.observingCount_ == 0) | 718 if (this.observingCount_ == 0) |
723 this.callback_(this.updatedData_); | 719 this.callback_(this.updatedData_); |
724 } | 720 } |
725 }; | 721 }; |
726 | 722 |
727 return BrowserBridge; | 723 return BrowserBridge; |
728 })(); | 724 })(); |
OLD | NEW |