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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/JSONView.js

Issue 2712513002: DevTools: extract ObjectUI module from Components (Closed)
Patch Set: fix build.gn Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 /** 35 /**
36 * @param {!Network.ParsedJSON} parsedJSON 36 * @param {!Network.ParsedJSON} parsedJSON
37 */ 37 */
38 constructor(parsedJSON) { 38 constructor(parsedJSON) {
39 super(); 39 super();
40 this._parsedJSON = parsedJSON; 40 this._parsedJSON = parsedJSON;
41 this.element.classList.add('json-view'); 41 this.element.classList.add('json-view');
42 42
43 /** @type {?UI.SearchableView} */ 43 /** @type {?UI.SearchableView} */
44 this._searchableView; 44 this._searchableView;
45 /** @type {!Components.ObjectPropertiesSection} */ 45 /** @type {!ObjectUI.ObjectPropertiesSection} */
46 this._treeOutline; 46 this._treeOutline;
47 /** @type {number} */ 47 /** @type {number} */
48 this._currentSearchFocusIndex = 0; 48 this._currentSearchFocusIndex = 0;
49 /** @type {!Array.<!UI.TreeElement>} */ 49 /** @type {!Array.<!UI.TreeElement>} */
50 this._currentSearchTreeElements = []; 50 this._currentSearchTreeElements = [];
51 /** @type {?RegExp} */ 51 /** @type {?RegExp} */
52 this._searchRegex = null; 52 this._searchRegex = null;
53 } 53 }
54 54
55 /** 55 /**
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 this._initialize(); 139 this._initialize();
140 } 140 }
141 141
142 _initialize() { 142 _initialize() {
143 if (this._initialized) 143 if (this._initialized)
144 return; 144 return;
145 this._initialized = true; 145 this._initialized = true;
146 146
147 var obj = SDK.RemoteObject.fromLocalObject(this._parsedJSON.data); 147 var obj = SDK.RemoteObject.fromLocalObject(this._parsedJSON.data);
148 var title = this._parsedJSON.prefix + obj.description + this._parsedJSON.suf fix; 148 var title = this._parsedJSON.prefix + obj.description + this._parsedJSON.suf fix;
149 this._treeOutline = new Components.ObjectPropertiesSection(obj, title); 149 this._treeOutline = new ObjectUI.ObjectPropertiesSection(obj, title);
150 this._treeOutline.setEditable(false); 150 this._treeOutline.setEditable(false);
151 this._treeOutline.expand(); 151 this._treeOutline.expand();
152 this.element.appendChild(this._treeOutline.element); 152 this.element.appendChild(this._treeOutline.element);
153 } 153 }
154 154
155 /** 155 /**
156 * @param {number} index 156 * @param {number} index
157 */ 157 */
158 _jumpToMatch(index) { 158 _jumpToMatch(index) {
159 if (!this._searchRegex) 159 if (!this._searchRegex)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 /** 194 /**
195 * @override 195 * @override
196 */ 196 */
197 searchCanceled() { 197 searchCanceled() {
198 this._searchRegex = null; 198 this._searchRegex = null;
199 this._currentSearchTreeElements = []; 199 this._currentSearchTreeElements = [];
200 200
201 for (var element = this._treeOutline.rootElement(); element; element = eleme nt.traverseNextTreeElement(false)) { 201 for (var element = this._treeOutline.rootElement(); element; element = eleme nt.traverseNextTreeElement(false)) {
202 if (!(element instanceof Components.ObjectPropertyTreeElement)) 202 if (!(element instanceof ObjectUI.ObjectPropertyTreeElement))
203 continue; 203 continue;
204 element.revertHighlightChanges(); 204 element.revertHighlightChanges();
205 } 205 }
206 this._updateSearchCount(0); 206 this._updateSearchCount(0);
207 this._updateSearchIndex(0); 207 this._updateSearchIndex(0);
208 } 208 }
209 209
210 /** 210 /**
211 * @override 211 * @override
212 * @param {!UI.SearchableView.SearchConfig} searchConfig 212 * @param {!UI.SearchableView.SearchConfig} searchConfig
213 * @param {boolean} shouldJump 213 * @param {boolean} shouldJump
214 * @param {boolean=} jumpBackwards 214 * @param {boolean=} jumpBackwards
215 */ 215 */
216 performSearch(searchConfig, shouldJump, jumpBackwards) { 216 performSearch(searchConfig, shouldJump, jumpBackwards) {
217 var newIndex = this._currentSearchFocusIndex; 217 var newIndex = this._currentSearchFocusIndex;
218 var previousSearchFocusElement = this._currentSearchTreeElements[newIndex]; 218 var previousSearchFocusElement = this._currentSearchTreeElements[newIndex];
219 this.searchCanceled(); 219 this.searchCanceled();
220 this._searchRegex = searchConfig.toSearchRegex(true); 220 this._searchRegex = searchConfig.toSearchRegex(true);
221 221
222 for (var element = this._treeOutline.rootElement(); element; element = eleme nt.traverseNextTreeElement(false)) { 222 for (var element = this._treeOutline.rootElement(); element; element = eleme nt.traverseNextTreeElement(false)) {
223 if (!(element instanceof Components.ObjectPropertyTreeElement)) 223 if (!(element instanceof ObjectUI.ObjectPropertyTreeElement))
224 continue; 224 continue;
225 var hasMatch = element.setSearchRegex(this._searchRegex); 225 var hasMatch = element.setSearchRegex(this._searchRegex);
226 if (hasMatch) 226 if (hasMatch)
227 this._currentSearchTreeElements.push(element); 227 this._currentSearchTreeElements.push(element);
228 if (previousSearchFocusElement === element) { 228 if (previousSearchFocusElement === element) {
229 var currentIndex = this._currentSearchTreeElements.length - 1; 229 var currentIndex = this._currentSearchTreeElements.length - 1;
230 if (hasMatch || jumpBackwards) 230 if (hasMatch || jumpBackwards)
231 newIndex = currentIndex; 231 newIndex = currentIndex;
232 else 232 else
233 newIndex = currentIndex + 1; 233 newIndex = currentIndex + 1;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 * @param {*} data 290 * @param {*} data
291 * @param {string} prefix 291 * @param {string} prefix
292 * @param {string} suffix 292 * @param {string} suffix
293 */ 293 */
294 constructor(data, prefix, suffix) { 294 constructor(data, prefix, suffix) {
295 this.data = data; 295 this.data = data;
296 this.prefix = prefix; 296 this.prefix = prefix;
297 this.suffix = suffix; 297 this.suffix = suffix;
298 } 298 }
299 }; 299 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698