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

Side by Side Diff: Source/devtools/front_end/ui/SearchableView.js

Issue 722713002: DevTools: get rid of getters and setters in StatusBarButton. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/ui/FilterBar.js ('k') | Source/devtools/front_end/ui/SplitView.js » ('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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * Copyright (C) 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2011 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return WebInspector.SearchableView._findPreviousShortcuts; 198 return WebInspector.SearchableView._findPreviousShortcuts;
199 WebInspector.SearchableView._findPreviousShortcuts = []; 199 WebInspector.SearchableView._findPreviousShortcuts = [];
200 if (WebInspector.isMac()) 200 if (WebInspector.isMac())
201 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta | WebInspector.KeyboardShortcut.Modifiers.Shift)); 201 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta | WebInspector.KeyboardShortcut.Modifiers.Shift));
202 return WebInspector.SearchableView._findPreviousShortcuts; 202 return WebInspector.SearchableView._findPreviousShortcuts;
203 } 203 }
204 204
205 WebInspector.SearchableView.prototype = { 205 WebInspector.SearchableView.prototype = {
206 _toggleCaseSensitiveSearch: function() 206 _toggleCaseSensitiveSearch: function()
207 { 207 {
208 this._caseSensitiveButton.toggled = !this._caseSensitiveButton.toggled; 208 this._caseSensitiveButton.setToggled(!this._caseSensitiveButton.toggled( ));
209 this._saveSetting(); 209 this._saveSetting();
210 this._performSearch(false, true); 210 this._performSearch(false, true);
211 }, 211 },
212 212
213 _toggleRegexSearch: function() 213 _toggleRegexSearch: function()
214 { 214 {
215 this._regexButton.toggled = !this._regexButton.toggled; 215 this._regexButton.setToggled(!this._regexButton.toggled());
216 this._saveSetting(); 216 this._saveSetting();
217 this._performSearch(false, true); 217 this._performSearch(false, true);
218 }, 218 },
219 219
220 /** 220 /**
221 * @return {?WebInspector.Setting} 221 * @return {?WebInspector.Setting}
222 */ 222 */
223 _setting: function() 223 _setting: function()
224 { 224 {
225 if (!this._settingName) 225 if (!this._settingName)
226 return null; 226 return null;
227 if (!WebInspector.settings[this._settingName]) 227 if (!WebInspector.settings[this._settingName])
228 WebInspector.settings[this._settingName] = WebInspector.settings.cre ateSetting(this._settingName, {}); 228 WebInspector.settings[this._settingName] = WebInspector.settings.cre ateSetting(this._settingName, {});
229 return WebInspector.settings[this._settingName]; 229 return WebInspector.settings[this._settingName];
230 }, 230 },
231 231
232 _saveSetting: function() 232 _saveSetting: function()
233 { 233 {
234 var setting = this._setting(); 234 var setting = this._setting();
235 if (!setting) 235 if (!setting)
236 return; 236 return;
237 var settingValue = setting.get() || {}; 237 var settingValue = setting.get() || {};
238 settingValue.caseSensitive = this._caseSensitiveButton.toggled; 238 settingValue.caseSensitive = this._caseSensitiveButton.toggled();
239 settingValue.isRegex = this._regexButton.toggled; 239 settingValue.isRegex = this._regexButton.toggled();
240 setting.set(settingValue); 240 setting.set(settingValue);
241 }, 241 },
242 242
243 _loadSetting: function() 243 _loadSetting: function()
244 { 244 {
245 var settingValue = this._setting() ? (this._setting().get() || {}) : {}; 245 var settingValue = this._setting() ? (this._setting().get() || {}) : {};
246 if (this._searchProvider.supportsCaseSensitiveSearch()) 246 if (this._searchProvider.supportsCaseSensitiveSearch())
247 this._caseSensitiveButton.toggled = !!settingValue.caseSensitive; 247 this._caseSensitiveButton.setToggled(!!settingValue.caseSensitive);
248 if (this._searchProvider.supportsRegexSearch()) 248 if (this._searchProvider.supportsRegexSearch())
249 this._regexButton.toggled = !!settingValue.isRegex; 249 this._regexButton.setToggled(!!settingValue.isRegex);
250 }, 250 },
251 251
252 /** 252 /**
253 * @return {!Element} 253 * @return {!Element}
254 */ 254 */
255 defaultFocusedElement: function() 255 defaultFocusedElement: function()
256 { 256 {
257 var children = this.children(); 257 var children = this.children();
258 for (var i = 0; i < children.length; ++i) { 258 for (var i = 0; i < children.length; ++i) {
259 var element = children[i].defaultFocusedElement(); 259 var element = children[i].defaultFocusedElement();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 var searchConfig = this._currentSearchConfig(); 586 var searchConfig = this._currentSearchConfig();
587 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwar ds); 587 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwar ds);
588 }, 588 },
589 589
590 /** 590 /**
591 * @return {!WebInspector.SearchableView.SearchConfig} 591 * @return {!WebInspector.SearchableView.SearchConfig}
592 */ 592 */
593 _currentSearchConfig: function() 593 _currentSearchConfig: function()
594 { 594 {
595 var query = this._searchInputElement.value; 595 var query = this._searchInputElement.value;
596 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButto n.toggled : false; 596 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButto n.toggled() : false;
597 var isRegex = this._regexButton ? this._regexButton.toggled : false; 597 var isRegex = this._regexButton ? this._regexButton.toggled() : false;
598 return new WebInspector.SearchableView.SearchConfig(query, caseSensitive , isRegex); 598 return new WebInspector.SearchableView.SearchConfig(query, caseSensitive , isRegex);
599 }, 599 },
600 600
601 _updateSecondRowVisibility: function() 601 _updateSecondRowVisibility: function()
602 { 602 {
603 var secondRowVisible = this._replaceCheckboxElement.checked; 603 var secondRowVisible = this._replaceCheckboxElement.checked;
604 this._footerElementContainer.classList.toggle("replaceable", secondRowVi sible); 604 this._footerElementContainer.classList.toggle("replaceable", secondRowVi sible);
605 this._footerElement.classList.toggle("toolbar-search-replace", secondRow Visible); 605 this._footerElement.classList.toggle("toolbar-search-replace", secondRow Visible);
606 this._secondRowElement.classList.toggle("hidden", !secondRowVisible); 606 this._secondRowElement.classList.toggle("hidden", !secondRowVisible);
607 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible); 607 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 * @param {string} query 700 * @param {string} query
701 * @param {boolean} caseSensitive 701 * @param {boolean} caseSensitive
702 * @param {boolean} isRegex 702 * @param {boolean} isRegex
703 */ 703 */
704 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege x) 704 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege x)
705 { 705 {
706 this.query = query; 706 this.query = query;
707 this.caseSensitive = caseSensitive; 707 this.caseSensitive = caseSensitive;
708 this.isRegex = isRegex; 708 this.isRegex = isRegex;
709 } 709 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/FilterBar.js ('k') | Source/devtools/front_end/ui/SplitView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698