| Index: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| index fc433ab3c6559eed4b487e099400bf424ef4ffdb..3bc1bfba3007915d9271ef819f01abb5f64a13c7 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| @@ -53,6 +53,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
|
|
| this.element.addEventListener('contextmenu', this.handleContextMenu.bind(this), false);
|
|
|
| + this._dontGroup = false;
|
| this._navigatorGroupByFolderSetting = Common.moduleSetting('navigatorGroupByFolder');
|
| this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.bind(this));
|
|
|
| @@ -77,7 +78,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
|
|
| SDK.targetManager.observeTargets(this);
|
| this._resetWorkspace(Workspace.workspace);
|
| - this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));
|
| + this._workspace.uiSourceCodes().forEach(this.refreshUISourceCode.bind(this));
|
| }
|
|
|
| /**
|
| @@ -168,7 +169,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
| */
|
| _onBindingCreated(event) {
|
| var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
|
| - this._removeUISourceCode(binding.network);
|
| + this.refreshUISourceCode(binding.network);
|
| }
|
|
|
| /**
|
| @@ -176,7 +177,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
| */
|
| _onBindingRemoved(event) {
|
| var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
|
| - this._addUISourceCode(binding.network);
|
| + this.refreshUISourceCode(binding.network);
|
| }
|
|
|
| /**
|
| @@ -263,7 +264,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
| * @param {!Workspace.UISourceCode} uiSourceCode
|
| */
|
| _addUISourceCode(uiSourceCode) {
|
| - if (!this.accept(uiSourceCode))
|
| + if (this._uiSourceCodeNodes.has(uiSourceCode))
|
| return;
|
|
|
| var binding = Persistence.persistence.binding(uiSourceCode);
|
| @@ -292,15 +293,31 @@ Sources.NavigatorView = class extends UI.VBox {
|
| /**
|
| * @param {!Workspace.UISourceCode} uiSourceCode
|
| */
|
| + refreshUISourceCode(uiSourceCode) {
|
| + if (this.accept(uiSourceCode))
|
| + this._addUISourceCode(uiSourceCode);
|
| + else
|
| + this._removeUISourceCode(uiSourceCode);
|
| + }
|
| +
|
| + /**
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| + */
|
| uiSourceCodeAdded(uiSourceCode) {
|
| }
|
|
|
| /**
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| + */
|
| + uiSourceCodeRemoved(uiSourceCode) {
|
| + }
|
| +
|
| + /**
|
| * @param {!Common.Event} event
|
| */
|
| _uiSourceCodeAdded(event) {
|
| var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
|
| - this._addUISourceCode(uiSourceCode);
|
| + this.refreshUISourceCode(uiSourceCode);
|
| }
|
|
|
| /**
|
| @@ -508,11 +525,28 @@ Sources.NavigatorView = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| + * @return {?Workspace.UISourceCode}
|
| + */
|
| + anyUISourceCode() {
|
| + if (this._uiSourceCodeNodes.has(this._lastSelectedUISourceCode))
|
| + return this._lastSelectedUISourceCode;
|
| + return this._uiSourceCodeNodes.keys().next().value || null;
|
| + }
|
| +
|
| + /**
|
| * @param {!Workspace.UISourceCode} uiSourceCode
|
| * @param {boolean} focusSource
|
| */
|
| _sourceSelected(uiSourceCode, focusSource) {
|
| this._lastSelectedUISourceCode = uiSourceCode;
|
| + this.revealSource(uiSourceCode, focusSource);
|
| + }
|
| +
|
| + /**
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| + * @param {boolean} focusSource
|
| + */
|
| + revealSource(uiSourceCode, focusSource) {
|
| Common.Revealer.reveal(uiSourceCode, !focusSource);
|
| }
|
|
|
| @@ -556,6 +590,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
| }
|
| }
|
| this._uiSourceCodeNodes.delete(uiSourceCode);
|
| + this.uiSourceCodeRemoved(uiSourceCode);
|
| }
|
|
|
| reset() {
|
| @@ -738,13 +773,24 @@ Sources.NavigatorView = class extends UI.VBox {
|
| }
|
| }
|
|
|
| + dontGroup() {
|
| + this._dontGroup = true;
|
| + this._groupingChanged();
|
| + }
|
| +
|
| _groupingChanged() {
|
| this.reset();
|
| this._initGrouping();
|
| - this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));
|
| + this._workspace.uiSourceCodes().forEach(this.refreshUISourceCode.bind(this));
|
| }
|
|
|
| _initGrouping() {
|
| + if (this._dontGroup) {
|
| + this._groupByFrame = false;
|
| + this._groupByDomain = false;
|
| + this._groupByFolder = false;
|
| + return;
|
| + }
|
| this._groupByFrame = true;
|
| this._groupByDomain = this._navigatorGroupByFolderSetting.get();
|
| this._groupByFolder = this._groupByDomain;
|
| @@ -752,7 +798,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
|
|
| _resetForTest() {
|
| this.reset();
|
| - this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));
|
| + this._workspace.uiSourceCodes().forEach(this.refreshUISourceCode.bind(this));
|
| }
|
|
|
| /**
|
|
|