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

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

Issue 2691103007: DevTools: more console setting checkboxes in toolbar (Closed)
Patch Set: Created 3 years, 10 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/consoleView.css » ('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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 toolbar.appendText(''); 79 toolbar.appendText('');
80 toolbar.appendSeparator(); 80 toolbar.appendSeparator();
81 toolbar.appendToolbarItem(this._showSettingsPaneButton); 81 toolbar.appendToolbarItem(this._showSettingsPaneButton);
82 82
83 this._preserveLogCheckbox = new UI.ToolbarSettingCheckbox( 83 this._preserveLogCheckbox = new UI.ToolbarSettingCheckbox(
84 Common.moduleSetting('preserveConsoleLog'), Common.UIString('Do not clea r log on page reload / navigation'), 84 Common.moduleSetting('preserveConsoleLog'), Common.UIString('Do not clea r log on page reload / navigation'),
85 Common.UIString('Preserve log')); 85 Common.UIString('Preserve log'));
86 this._hideNetworkMessagesCheckbox = new UI.ToolbarSettingCheckbox( 86 this._hideNetworkMessagesCheckbox = new UI.ToolbarSettingCheckbox(
87 this._filter._hideNetworkMessagesSetting, this._filter._hideNetworkMessa gesSetting.title(), 87 this._filter._hideNetworkMessagesSetting, this._filter._hideNetworkMessa gesSetting.title(),
88 Common.UIString('Hide network')); 88 Common.UIString('Hide network'));
89 var monitoringXHREnabledSetting = Common.moduleSetting('monitoringXHREnabled ');
90 this._timestampsSetting = Common.moduleSetting('consoleTimestampsEnabled');
91 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete');
89 92
90 var settingsToolbar = new UI.Toolbar('', this._contentsElement); 93 var settingsPane = new UI.HBox();
91 settingsToolbar.appendToolbarItem(this._hideNetworkMessagesCheckbox); 94 settingsPane.show(this._contentsElement);
92 settingsToolbar.appendToolbarItem(this._preserveLogCheckbox); 95 settingsPane.element.classList.add('console-settings-pane');
93 settingsToolbar.appendToolbarItem(this._filter._showTargetMessagesCheckbox); 96
97 var settingsToolbarLeft = new UI.Toolbar('', settingsPane.element);
98 settingsToolbarLeft.makeVertical();
99 settingsToolbarLeft.appendToolbarItem(this._hideNetworkMessagesCheckbox);
100 settingsToolbarLeft.appendToolbarItem(this._preserveLogCheckbox);
101 settingsToolbarLeft.appendToolbarItem(this._filter._showTargetMessagesCheckb ox);
102
103 var settingsToolbarRight = new UI.Toolbar('', settingsPane.element);
104 settingsToolbarRight.makeVertical();
105 settingsToolbarRight.appendToolbarItem(new UI.ToolbarSettingCheckbox(monitor ingXHREnabledSetting));
106 settingsToolbarRight.appendToolbarItem(new UI.ToolbarSettingCheckbox(this._t imestampsSetting));
107 settingsToolbarRight.appendToolbarItem(new UI.ToolbarSettingCheckbox(this._c onsoleHistoryAutocompleteSetting));
94 if (!this._showSettingsPaneSetting.get()) 108 if (!this._showSettingsPaneSetting.get())
95 settingsToolbar.element.classList.add('hidden'); 109 settingsPane.element.classList.add('hidden');
96 this._showSettingsPaneSetting.addChangeListener( 110 this._showSettingsPaneSetting.addChangeListener(
97 () => settingsToolbar.element.classList.toggle('hidden', !this._showSett ingsPaneSetting.get())); 111 () => settingsPane.element.classList.toggle('hidden', !this._showSetting sPaneSetting.get()));
98 112
99 this._viewport = new Console.ConsoleViewport(this); 113 this._viewport = new Console.ConsoleViewport(this);
100 this._viewport.setStickToBottom(true); 114 this._viewport.setStickToBottom(true);
101 this._viewport.contentElement().classList.add('console-group', 'console-grou p-messages'); 115 this._viewport.contentElement().classList.add('console-group', 'console-grou p-messages');
102 this._contentsElement.appendChild(this._viewport.element); 116 this._contentsElement.appendChild(this._viewport.element);
103 this._messagesElement = this._viewport.element; 117 this._messagesElement = this._viewport.element;
104 this._messagesElement.id = 'console-messages'; 118 this._messagesElement.id = 'console-messages';
105 this._messagesElement.classList.add('monospace'); 119 this._messagesElement.classList.add('monospace');
106 this._messagesElement.addEventListener('click', this._messagesClicked.bind(t his), true); 120 this._messagesElement.addEventListener('click', this._messagesClicked.bind(t his), true);
107 121
(...skipping 13 matching lines...) Expand all
121 this._promptElement.id = 'console-prompt'; 135 this._promptElement.id = 'console-prompt';
122 this._promptElement.addEventListener('input', this._promptInput.bind(this), false); 136 this._promptElement.addEventListener('input', this._promptInput.bind(this), false);
123 137
124 // FIXME: This is a workaround for the selection machinery bug. See crbug.co m/410899 138 // FIXME: This is a workaround for the selection machinery bug. See crbug.co m/410899
125 var selectAllFixer = this._messagesElement.createChild('div', 'console-view- fix-select-all'); 139 var selectAllFixer = this._messagesElement.createChild('div', 'console-view- fix-select-all');
126 selectAllFixer.textContent = '.'; 140 selectAllFixer.textContent = '.';
127 141
128 this._registerShortcuts(); 142 this._registerShortcuts();
129 143
130 this._messagesElement.addEventListener('contextmenu', this._handleContextMen uEvent.bind(this), false); 144 this._messagesElement.addEventListener('contextmenu', this._handleContextMen uEvent.bind(this), false);
131 Common.moduleSetting('monitoringXHREnabled').addChangeListener(this._monitor ingXHREnabledSettingChanged, this); 145 monitoringXHREnabledSetting.addChangeListener(this._monitoringXHREnabledSett ingChanged, this);
132 146
133 this._linkifier = new Components.Linkifier(); 147 this._linkifier = new Components.Linkifier();
134 148
135 /** @type {!Array.<!Console.ConsoleViewMessage>} */ 149 /** @type {!Array.<!Console.ConsoleViewMessage>} */
136 this._consoleMessages = []; 150 this._consoleMessages = [];
137 this._viewMessageSymbol = Symbol('viewMessage'); 151 this._viewMessageSymbol = Symbol('viewMessage');
138 152
139 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis tory', []); 153 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis tory', []);
140 154
141 this._prompt = new Console.ConsolePrompt(); 155 this._prompt = new Console.ConsolePrompt();
142 this._prompt.show(this._promptElement); 156 this._prompt.show(this._promptElement);
143 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true); 157 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th is), true);
144 158
145 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto ryAutocomplete');
146 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this); 159 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this);
147 160
148 var historyData = this._consoleHistorySetting.get(); 161 var historyData = this._consoleHistorySetting.get();
149 this._prompt.history().setHistoryData(historyData); 162 this._prompt.history().setHistoryData(historyData);
150 this._consoleHistoryAutocompleteChanged(); 163 this._consoleHistoryAutocompleteChanged();
151 164
152 this._updateFilterStatus(); 165 this._updateFilterStatus();
153 Common.moduleSetting('consoleTimestampsEnabled').addChangeListener(this._con soleTimestampsSettingChanged, this); 166 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan ged, this);
154 167
155 this._registerWithMessageSink(); 168 this._registerWithMessageSink();
156 SDK.targetManager.observeTargets(this); 169 SDK.targetManager.observeTargets(this);
157 170
158 this._initConsoleMessages(); 171 this._initConsoleMessages();
159 172
160 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this); 173 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this);
161 174
162 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false); 175 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false);
163 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false); 176 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false);
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 progressIndicator.setWorked(messageIndex); 682 progressIndicator.setWorked(messageIndex);
670 } 683 }
671 } 684 }
672 685
673 /** 686 /**
674 * @param {!Console.ConsoleViewMessage} lastMessage 687 * @param {!Console.ConsoleViewMessage} lastMessage
675 * @param {?Console.ConsoleViewMessage=} viewMessage 688 * @param {?Console.ConsoleViewMessage=} viewMessage
676 * @return {boolean} 689 * @return {boolean}
677 */ 690 */
678 _tryToCollapseMessages(lastMessage, viewMessage) { 691 _tryToCollapseMessages(lastMessage, viewMessage) {
679 var timestampsShown = Common.moduleSetting('consoleTimestampsEnabled').get() ; 692 var timestampsShown = this._timestampsSetting.get();
680 if (!timestampsShown && viewMessage && !lastMessage.consoleMessage().isGroup Message() && 693 if (!timestampsShown && viewMessage && !lastMessage.consoleMessage().isGroup Message() &&
681 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) { 694 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) {
682 viewMessage.incrementRepeatCount(); 695 viewMessage.incrementRepeatCount();
683 return true; 696 return true;
684 } 697 }
685 698
686 return false; 699 return false;
687 } 700 }
688 701
689 _updateMessageList() { 702 _updateMessageList() {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 Console.ConsoleView.persistedHistorySize = 300; 1044 Console.ConsoleView.persistedHistorySize = 300;
1032 1045
1033 /** 1046 /**
1034 * @unrestricted 1047 * @unrestricted
1035 */ 1048 */
1036 Console.ConsoleViewFilter = class { 1049 Console.ConsoleViewFilter = class {
1037 /** 1050 /**
1038 * @param {function()} filterChangedCallback 1051 * @param {function()} filterChangedCallback
1039 */ 1052 */
1040 constructor(filterChangedCallback) { 1053 constructor(filterChangedCallback) {
1041 this._showTargetMessagesCheckbox = 1054 this._showTargetMessagesCheckbox = new UI.ToolbarCheckbox(
1042 new UI.ToolbarCheckbox(Common.UIString('Selected context only'), undefin ed, filterChangedCallback); 1055 Common.UIString('Selected context only'),
1056 Common.UIString('Only show messages from the current context (top, ifram e, worker, extension)'),
1057 filterChangedCallback);
1043 this._filterChanged = filterChangedCallback; 1058 this._filterChanged = filterChangedCallback;
1044 1059
1045 this._messageURLFiltersSetting = Common.settings.createSetting('messageURLFi lters', {}); 1060 this._messageURLFiltersSetting = Common.settings.createSetting('messageURLFi lters', {});
1046 this._messageLevelFiltersSetting = 1061 this._messageLevelFiltersSetting =
1047 Common.settings.createSetting('messageLevelFilters2', SDK.ConsoleMessage .MessageLevel.Info); 1062 Common.settings.createSetting('messageLevelFilters2', SDK.ConsoleMessage .MessageLevel.Info);
1048 this._hideNetworkMessagesSetting = Common.moduleSetting('hideNetworkMessages '); 1063 this._hideNetworkMessagesSetting = Common.moduleSetting('hideNetworkMessages ');
1049 1064
1050 this._messageURLFiltersSetting.addChangeListener(this._filterChanged); 1065 this._messageURLFiltersSetting.addChangeListener(this._filterChanged);
1051 this._messageLevelFiltersSetting.addChangeListener(this._filterChanged); 1066 this._messageLevelFiltersSetting.addChangeListener(this._filterChanged);
1052 this._hideNetworkMessagesSetting.addChangeListener(this._filterChanged); 1067 this._hideNetworkMessagesSetting.addChangeListener(this._filterChanged);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 return true; 1329 return true;
1315 } 1330 }
1316 return false; 1331 return false;
1317 } 1332 }
1318 }; 1333 };
1319 1334
1320 /** 1335 /**
1321 * @typedef {{messageIndex: number, matchIndex: number}} 1336 * @typedef {{messageIndex: number, matchIndex: number}}
1322 */ 1337 */
1323 Console.ConsoleView.RegexMatchRange; 1338 Console.ConsoleView.RegexMatchRange;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/consoleView.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698