Commit ae7e36e9 authored by luoe's avatar luoe Committed by Commit bot

DevTools: setting to auto-reveal in navigator

BUG=556508

Review-Url: https://codereview.chromium.org/2254683003
Cr-Commit-Position: refs/heads/master@{#414893}
parent 6a205ea3
......@@ -355,22 +355,28 @@ WebInspector.SourcesPanel.prototype = {
/**
* @param {!WebInspector.UISourceCode} uiSourceCode
* @param {boolean=} skipReveal
*/
_revealInNavigator: function(uiSourceCode)
_revealInNavigator: function(uiSourceCode, skipReveal)
{
var extensions = self.runtime.extensions(WebInspector.NavigatorView);
Promise.all(extensions.map(extension => extension.instance())).then(filterNavigators);
Promise.all(extensions.map(extension => extension.instance())).then(filterNavigators.bind(this));
/**
* @this {WebInspector.SourcesPanel}
* @param {!Array.<!Object>} objects
*/
function filterNavigators(objects)
{
for (var i = 0; i < objects.length; ++i) {
var navigatorView = /** @type {!WebInspector.NavigatorView} */ (objects[i]);
var viewId = extensions[i].descriptor()["viewId"];
if (navigatorView.accept(uiSourceCode)) {
navigatorView.revealUISourceCode(uiSourceCode, true);
WebInspector.viewManager.showView(extensions[i].descriptor()["viewId"]);
if (skipReveal)
this._navigatorTabbedLocation.tabbedPane().selectTab(viewId);
else
WebInspector.viewManager.showView(viewId);
}
}
}
......@@ -527,6 +533,8 @@ WebInspector.SourcesPanel.prototype = {
{
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
this._editorChanged(uiSourceCode);
if (this.editorView.mainWidget() && WebInspector.moduleSetting("autoRevealInNavigator").get())
this._revealInNavigator(uiSourceCode, true);
},
/**
......
......@@ -296,6 +296,14 @@
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Sources",
"title": "Automatically reveal files in navigator",
"settingName": "autoRevealInNavigator",
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Sources",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment