| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
| 8 */ | 8 */ |
| 9 WebInspector.Console = function() | 9 WebInspector.Console = function() |
| 10 { | 10 { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 * @param {boolean} show | 36 * @param {boolean} show |
| 37 */ | 37 */ |
| 38 WebInspector.Console.Message = function(text, level, timestamp, show) | 38 WebInspector.Console.Message = function(text, level, timestamp, show) |
| 39 { | 39 { |
| 40 this.text = text; | 40 this.text = text; |
| 41 this.level = level; | 41 this.level = level; |
| 42 this.timestamp = (typeof timestamp === "number") ? timestamp : Date.now(); | 42 this.timestamp = (typeof timestamp === "number") ? timestamp : Date.now(); |
| 43 this.show = show; | 43 this.show = show; |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | |
| 47 * @interface | |
| 48 */ | |
| 49 WebInspector.Console.UIDelegate = function() | |
| 50 { | |
| 51 } | |
| 52 | |
| 53 WebInspector.Console.UIDelegate.prototype = { | |
| 54 /** | |
| 55 * @return {!Promise.<undefined>} | |
| 56 */ | |
| 57 showConsole: function() { } | |
| 58 } | |
| 59 | |
| 60 WebInspector.Console.prototype = { | 46 WebInspector.Console.prototype = { |
| 61 /** | 47 /** |
| 62 * @param {!WebInspector.Console.UIDelegate} uiDelegate | |
| 63 */ | |
| 64 setUIDelegate: function(uiDelegate) | |
| 65 { | |
| 66 this._uiDelegate = uiDelegate; | |
| 67 }, | |
| 68 | |
| 69 /** | |
| 70 * @param {string} text | 48 * @param {string} text |
| 71 * @param {!WebInspector.Console.MessageLevel} level | 49 * @param {!WebInspector.Console.MessageLevel} level |
| 72 * @param {boolean=} show | 50 * @param {boolean=} show |
| 73 */ | 51 */ |
| 74 addMessage: function(text, level, show) | 52 addMessage: function(text, level, show) |
| 75 { | 53 { |
| 76 var message = new WebInspector.Console.Message(text, level || WebInspect
or.Console.MessageLevel.Log, Date.now(), show || false); | 54 var message = new WebInspector.Console.Message(text, level || WebInspect
or.Console.MessageLevel.Log, Date.now(), show || false); |
| 77 this._messages.push(message); | 55 this._messages.push(message); |
| 78 this.dispatchEventToListeners(WebInspector.Console.Events.MessageAdded,
message); | 56 this.dispatchEventToListeners(WebInspector.Console.Events.MessageAdded,
message); |
| 79 }, | 57 }, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 show: function() | 91 show: function() |
| 114 { | 92 { |
| 115 this.showPromise(); | 93 this.showPromise(); |
| 116 }, | 94 }, |
| 117 | 95 |
| 118 /** | 96 /** |
| 119 * @return {!Promise.<undefined>} | 97 * @return {!Promise.<undefined>} |
| 120 */ | 98 */ |
| 121 showPromise: function() | 99 showPromise: function() |
| 122 { | 100 { |
| 123 if (this._uiDelegate) | 101 return WebInspector.Revealer.revealPromise(this); |
| 124 return this._uiDelegate.showConsole(); | |
| 125 return Promise.reject(); | |
| 126 }, | 102 }, |
| 127 | 103 |
| 128 __proto__: WebInspector.Object.prototype | 104 __proto__: WebInspector.Object.prototype |
| 129 } | 105 } |
| 130 | 106 |
| 131 WebInspector.console = new WebInspector.Console(); | 107 WebInspector.console = new WebInspector.Console(); |
| OLD | NEW |