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

Unified Diff: Source/devtools/front_end/FilterBar.js

Issue 214523004: Persist filter bar state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/ConsoleView.js ('k') | Source/devtools/front_end/NetworkPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/FilterBar.js
diff --git a/Source/devtools/front_end/FilterBar.js b/Source/devtools/front_end/FilterBar.js
index 7768c3a894f1bdf86a11f3e461958d489ceb3bda..c9e7536eb680eadc98e9b1a29454561eaff4f65b 100644
--- a/Source/devtools/front_end/FilterBar.js
+++ b/Source/devtools/front_end/FilterBar.js
@@ -56,6 +56,15 @@ WebInspector.FilterBar.FilterBarState = {
WebInspector.FilterBar.prototype = {
/**
+ * @param {string} name
+ */
+ setName: function(name)
+ {
+ this._stateSetting = WebInspector.settings.createSetting("filterBar-" + name + "-toggled", false);
+ this._setState(this._stateSetting.get());
+ },
+
+ /**
* @return {!WebInspector.StatusBarButton}
*/
filterButton: function()
@@ -123,7 +132,21 @@ WebInspector.FilterBar.prototype = {
*/
_handleFilterButtonClick: function(event)
{
- this._filtersShown = !this._filtersShown;
+ this._setState(!this._filtersShown);
+ },
+
+ /**
+ * @param {boolean} filtersShown
+ */
+ _setState: function(filtersShown)
+ {
+ if (this._filtersShown === filtersShown)
+ return;
+
+ this._filtersShown = filtersShown;
+ if (this._stateSetting)
+ this._stateSetting.set(filtersShown);
+
this._updateFilterButton();
this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggled, this._filtersShown);
if (this._filtersShown) {
« no previous file with comments | « Source/devtools/front_end/ConsoleView.js ('k') | Source/devtools/front_end/NetworkPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698