Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1083)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2879973003: DevTools: Show product badge in console (Closed)
Patch Set: Merge branch 'master' into badge_final Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 // FIXME: This is a workaround for the selection machinery bug. See crbug.co m/410899 130 // FIXME: This is a workaround for the selection machinery bug. See crbug.co m/410899
131 var selectAllFixer = this._messagesElement.createChild('div', 'console-view- fix-select-all'); 131 var selectAllFixer = this._messagesElement.createChild('div', 'console-view- fix-select-all');
132 selectAllFixer.textContent = '.'; 132 selectAllFixer.textContent = '.';
133 133
134 this._registerShortcuts(); 134 this._registerShortcuts();
135 135
136 this._messagesElement.addEventListener('contextmenu', this._handleContextMen uEvent.bind(this), false); 136 this._messagesElement.addEventListener('contextmenu', this._handleContextMen uEvent.bind(this), false);
137 137
138 this._linkifier = new Components.Linkifier(); 138 this._linkifier = new Components.Linkifier();
139 this._badgePool = new ProductRegistry.BadgePool();
139 140
140 /** @type {!Array.<!Console.ConsoleViewMessage>} */ 141 /** @type {!Array.<!Console.ConsoleViewMessage>} */
141 this._consoleMessages = []; 142 this._consoleMessages = [];
142 this._viewMessageSymbol = Symbol('viewMessage'); 143 this._viewMessageSymbol = Symbol('viewMessage');
143 144
144 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis tory', []); 145 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis tory', []);
145 146
146 this._prompt = new Console.ConsolePrompt(); 147 this._prompt = new Console.ConsolePrompt();
147 this._prompt.show(this._promptElement); 148 this._prompt.show(this._promptElement);
148 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true); 149 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 491 }
491 492
492 /** 493 /**
493 * @param {!ConsoleModel.ConsoleMessage} message 494 * @param {!ConsoleModel.ConsoleMessage} message
494 * @return {!Console.ConsoleViewMessage} 495 * @return {!Console.ConsoleViewMessage}
495 */ 496 */
496 _createViewMessage(message) { 497 _createViewMessage(message) {
497 var nestingLevel = this._currentGroup.nestingLevel(); 498 var nestingLevel = this._currentGroup.nestingLevel();
498 switch (message.type) { 499 switch (message.type) {
499 case ConsoleModel.ConsoleMessage.MessageType.Command: 500 case ConsoleModel.ConsoleMessage.MessageType.Command:
500 return new Console.ConsoleCommand(message, this._linkifier, nestingLevel ); 501 return new Console.ConsoleCommand(message, this._linkifier, this._badgeP ool, nestingLevel);
501 case ConsoleModel.ConsoleMessage.MessageType.Result: 502 case ConsoleModel.ConsoleMessage.MessageType.Result:
502 return new Console.ConsoleCommandResult(message, this._linkifier, nestin gLevel); 503 return new Console.ConsoleCommandResult(message, this._linkifier, this._ badgePool, nestingLevel);
503 case ConsoleModel.ConsoleMessage.MessageType.StartGroupCollapsed: 504 case ConsoleModel.ConsoleMessage.MessageType.StartGroupCollapsed:
504 case ConsoleModel.ConsoleMessage.MessageType.StartGroup: 505 case ConsoleModel.ConsoleMessage.MessageType.StartGroup:
505 return new Console.ConsoleGroupViewMessage(message, this._linkifier, nes tingLevel); 506 return new Console.ConsoleGroupViewMessage(message, this._linkifier, thi s._badgePool, nestingLevel);
506 default: 507 default:
507 return new Console.ConsoleViewMessage(message, this._linkifier, nestingL evel); 508 return new Console.ConsoleViewMessage(message, this._linkifier, this._ba dgePool, nestingLevel);
508 } 509 }
509 } 510 }
510 511
511 _consoleCleared() { 512 _consoleCleared() {
512 this._currentMatchRangeIndex = -1; 513 this._currentMatchRangeIndex = -1;
513 this._consoleMessages = []; 514 this._consoleMessages = [];
514 this._updateMessageList(); 515 this._updateMessageList();
515 this._hidePromptSuggestBox(); 516 this._hidePromptSuggestBox();
516 this._viewport.setStickToBottom(true); 517 this._viewport.setStickToBottom(true);
517 this._linkifier.reset(); 518 this._linkifier.reset();
519 this._badgePool.reset();
518 } 520 }
519 521
520 _handleContextMenuEvent(event) { 522 _handleContextMenuEvent(event) {
521 var contextMenu = new UI.ContextMenu(event); 523 var contextMenu = new UI.ContextMenu(event);
522 if (event.target.isSelfOrDescendant(this._promptElement)) { 524 if (event.target.isSelfOrDescendant(this._promptElement)) {
523 contextMenu.show(); 525 contextMenu.show();
524 return; 526 return;
525 } 527 }
526 528
527 function monitoringXHRItemAction() { 529 function monitoringXHRItemAction() {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 } 1122 }
1121 }; 1123 };
1122 1124
1123 /** 1125 /**
1124 * @unrestricted 1126 * @unrestricted
1125 */ 1127 */
1126 Console.ConsoleCommand = class extends Console.ConsoleViewMessage { 1128 Console.ConsoleCommand = class extends Console.ConsoleViewMessage {
1127 /** 1129 /**
1128 * @param {!ConsoleModel.ConsoleMessage} message 1130 * @param {!ConsoleModel.ConsoleMessage} message
1129 * @param {!Components.Linkifier} linkifier 1131 * @param {!Components.Linkifier} linkifier
1132 * @param {!ProductRegistry.BadgePool} badgePool
1130 * @param {number} nestingLevel 1133 * @param {number} nestingLevel
1131 */ 1134 */
1132 constructor(message, linkifier, nestingLevel) { 1135 constructor(message, linkifier, badgePool, nestingLevel) {
1133 super(message, linkifier, nestingLevel); 1136 super(message, linkifier, badgePool, nestingLevel);
1134 } 1137 }
1135 1138
1136 /** 1139 /**
1137 * @override 1140 * @override
1138 * @return {!Element} 1141 * @return {!Element}
1139 */ 1142 */
1140 contentElement() { 1143 contentElement() {
1141 if (!this._contentElement) { 1144 if (!this._contentElement) {
1142 this._contentElement = createElementWithClass('div', 'console-user-command '); 1145 this._contentElement = createElementWithClass('div', 'console-user-command ');
1143 var icon = UI.Icon.create('smallicon-user-command', 'command-result-icon') ; 1146 var icon = UI.Icon.create('smallicon-user-command', 'command-result-icon') ;
(...skipping 29 matching lines...) Expand all
1173 */ 1176 */
1174 Console.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000; 1177 Console.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000;
1175 1178
1176 /** 1179 /**
1177 * @unrestricted 1180 * @unrestricted
1178 */ 1181 */
1179 Console.ConsoleCommandResult = class extends Console.ConsoleViewMessage { 1182 Console.ConsoleCommandResult = class extends Console.ConsoleViewMessage {
1180 /** 1183 /**
1181 * @param {!ConsoleModel.ConsoleMessage} message 1184 * @param {!ConsoleModel.ConsoleMessage} message
1182 * @param {!Components.Linkifier} linkifier 1185 * @param {!Components.Linkifier} linkifier
1186 * @param {!ProductRegistry.BadgePool} badgePool
1183 * @param {number} nestingLevel 1187 * @param {number} nestingLevel
1184 */ 1188 */
1185 constructor(message, linkifier, nestingLevel) { 1189 constructor(message, linkifier, badgePool, nestingLevel) {
1186 super(message, linkifier, nestingLevel); 1190 super(message, linkifier, badgePool, nestingLevel);
1187 } 1191 }
1188 1192
1189 /** 1193 /**
1190 * @override 1194 * @override
1191 * @return {!Element} 1195 * @return {!Element}
1192 */ 1196 */
1193 contentElement() { 1197 contentElement() {
1194 var element = super.contentElement(); 1198 var element = super.contentElement();
1195 if (!element.classList.contains('console-user-command-result')) { 1199 if (!element.classList.contains('console-user-command-result')) {
1196 element.classList.add('console-user-command-result'); 1200 element.classList.add('console-user-command-result');
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 return true; 1276 return true;
1273 } 1277 }
1274 return false; 1278 return false;
1275 } 1279 }
1276 }; 1280 };
1277 1281
1278 /** 1282 /**
1279 * @typedef {{messageIndex: number, matchIndex: number}} 1283 * @typedef {{messageIndex: number, matchIndex: number}}
1280 */ 1284 */
1281 Console.ConsoleView.RegexMatchRange; 1285 Console.ConsoleView.RegexMatchRange;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698