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

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

Issue 1875273002: [DevTools] Introduce a setting for console autocomplete from history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/module.json » ('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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 this._prompt.setSuggestBoxEnabled(true); 134 this._prompt.setSuggestBoxEnabled(true);
135 this._prompt.setAutocompletionTimeout(0); 135 this._prompt.setAutocompletionTimeout(0);
136 this._prompt.renderAsBlock(); 136 this._prompt.renderAsBlock();
137 var proxyElement = this._prompt.attach(this._promptElement); 137 var proxyElement = this._prompt.attach(this._promptElement);
138 proxyElement.addEventListener("keydown", this._promptKeyDown.bind(this), fal se); 138 proxyElement.addEventListener("keydown", this._promptKeyDown.bind(this), fal se);
139 139
140 this._consoleHistorySetting = WebInspector.settings.createLocalSetting("cons oleHistory", []); 140 this._consoleHistorySetting = WebInspector.settings.createLocalSetting("cons oleHistory", []);
141 var historyData = this._consoleHistorySetting.get(); 141 var historyData = this._consoleHistorySetting.get();
142 this._prompt.setHistoryData(historyData); 142 this._prompt.setHistoryData(historyData);
143 143
144 this._consoleHistoryAutocompleteSetting = WebInspector.moduleSetting("consol eHistoryAutocomplete");
lushnikov 2016/04/11 23:00:13 nit: no need to store this in a global war
145 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto ryAutocompleteChanged, this);
146 this._consoleHistoryAutocompleteChanged();
147
144 this._updateFilterStatus(); 148 this._updateFilterStatus();
145 WebInspector.moduleSetting("consoleTimestampsEnabled").addChangeListener(thi s._consoleTimestampsSettingChanged, this); 149 WebInspector.moduleSetting("consoleTimestampsEnabled").addChangeListener(thi s._consoleTimestampsSettingChanged, this);
146 150
147 this._registerWithMessageSink(); 151 this._registerWithMessageSink();
148 WebInspector.targetManager.observeTargets(this); 152 WebInspector.targetManager.observeTargets(this);
149 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.MainFrameNavigated, this._onMainFrameNavigated, this); 153 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.MainFrameNavigated, this._onMainFrameNavigated, this);
150 154
151 this._initConsoleMessages(); 155 this._initConsoleMessages();
152 156
153 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this._executionContextChanged, this); 157 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this._executionContextChanged, this);
154 } 158 }
155 159
156 WebInspector.ConsoleView.persistedHistorySize = 300; 160 WebInspector.ConsoleView.persistedHistorySize = 300;
157 161
158 WebInspector.ConsoleView.prototype = { 162 WebInspector.ConsoleView.prototype = {
159 /** 163 /**
160 * @return {!WebInspector.SearchableView} 164 * @return {!WebInspector.SearchableView}
161 */ 165 */
162 searchableView: function() 166 searchableView: function()
163 { 167 {
164 return this._searchableView; 168 return this._searchableView;
165 }, 169 },
166 170
167 _clearHistory: function() 171 _clearHistory: function()
168 { 172 {
169 this._consoleHistorySetting.set([]); 173 this._consoleHistorySetting.set([]);
170 this._prompt.setHistoryData([]); 174 this._prompt.setHistoryData([]);
171 }, 175 },
172 176
177 _consoleHistoryAutocompleteChanged: function()
178 {
179 this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocomple teSetting.get());
180 },
181
173 /** 182 /**
174 * @param {!WebInspector.Event} event 183 * @param {!WebInspector.Event} event
175 */ 184 */
176 _onMainFrameNavigated: function(event) 185 _onMainFrameNavigated: function(event)
177 { 186 {
178 var frame = /** @type {!WebInspector.ResourceTreeFrame} */(event.data); 187 var frame = /** @type {!WebInspector.ResourceTreeFrame} */(event.data);
179 WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame. url)); 188 WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame. url));
180 }, 189 },
181 190
182 _initConsoleMessages: function() 191 _initConsoleMessages: function()
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 return true; 1329 return true;
1321 } 1330 }
1322 return false; 1331 return false;
1323 } 1332 }
1324 } 1333 }
1325 1334
1326 /** 1335 /**
1327 * @typedef {{messageIndex: number, matchIndex: number}} 1336 * @typedef {{messageIndex: number, matchIndex: number}}
1328 */ 1337 */
1329 WebInspector.ConsoleView.RegexMatchRange; 1338 WebInspector.ConsoleView.RegexMatchRange;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698