OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * Dictionary of constants (initialized by browser). |
| 7 */ |
| 8 var LogEntryType = null; |
| 9 var LogEventType = null; |
| 10 var LogEventPhase = null; |
| 11 var LogSourceType = null; |
| 12 |
| 13 /** |
| 14 * Main entry point. called once the page has loaded. |
| 15 */ |
| 16 function onLoaded() { |
| 17 // Layout the various DIVs in a vertically split fashion. |
| 18 new LayoutManager("filterBox", |
| 19 "requestsBox", |
| 20 "actionBox", |
| 21 "splitterBox", |
| 22 "detailsBox"); |
| 23 |
| 24 // Create the view which displays information on the current selection. |
| 25 var detailsView = new DetailsView("detailsLogTabHandle", |
| 26 "detailsTimelineTabHandle", |
| 27 "detailsTabArea"); |
| 28 |
| 29 // Create the view which displays requests lists, and lets you select, filter |
| 30 // and delete them. |
| 31 new RequestsView('requestsListTableBody', |
| 32 'filterInput', |
| 33 'filterCount', |
| 34 'deleteSelected', |
| 35 'selectAll', |
| 36 detailsView); |
| 37 |
| 38 // Tell the browser that we are ready to start receiving log events. |
| 39 notifyApplicationReady(); |
| 40 } |
| 41 |
| 42 //------------------------------------------------------------------------------ |
| 43 // Messages sent to the browser |
| 44 //------------------------------------------------------------------------------ |
| 45 |
| 46 function notifyApplicationReady() { |
| 47 chrome.send('notifyReady'); |
| 48 } |
| 49 |
| 50 //------------------------------------------------------------------------------ |
| 51 // Messages received from the browser |
| 52 //------------------------------------------------------------------------------ |
| 53 |
| 54 function onLogEntryAdded(logEntry) { |
| 55 LogDataProvider.broadcast(logEntry); |
| 56 } |
| 57 |
| 58 function setLogEventTypeConstants(constantsMap) { |
| 59 LogEventType = constantsMap; |
| 60 } |
| 61 |
| 62 function setLogEventPhaseConstants(constantsMap) { |
| 63 LogEventPhase = constantsMap; |
| 64 } |
| 65 |
| 66 function setLogSourceTypeConstants(constantsMap) { |
| 67 LogSourceType = constantsMap; |
| 68 } |
| 69 |
| 70 function setLogEntryTypeConstants(constantsMap) { |
| 71 LogEntryType = constantsMap; |
| 72 } |
| 73 |
| 74 //------------------------------------------------------------------------------ |
| 75 // LogDataProvider |
| 76 //------------------------------------------------------------------------------ |
| 77 |
| 78 var LogDataProvider = {} |
| 79 |
| 80 LogDataProvider.observers_ = []; |
| 81 |
| 82 LogDataProvider.broadcast = function(logEntry) { |
| 83 for (var i = 0; i < this.observers_.length; ++i) { |
| 84 this.observers_[i].onLogEntryAdded(logEntry); |
| 85 } |
| 86 }; |
| 87 |
| 88 LogDataProvider.addObserver = function(observer) { |
| 89 this.observers_.push(observer); |
| 90 }; |
OLD | NEW |