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

Side by Side Diff: Source/devtools/front_end/resources/IndexedDBViews.js

Issue 720223002: DevTools: only allow status bar items in status bars. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 this._stringVersionTreeElement = new TreeElement("", null, false); 59 this._stringVersionTreeElement = new TreeElement("", null, false);
60 this._stringVersionTreeElement.selectable = false; 60 this._stringVersionTreeElement.selectable = false;
61 this._headersTreeOutline.appendChild(this._stringVersionTreeElement); 61 this._headersTreeOutline.appendChild(this._stringVersionTreeElement);
62 62
63 this.update(database); 63 this.update(database);
64 } 64 }
65 65
66 WebInspector.IDBDatabaseView.prototype = { 66 WebInspector.IDBDatabaseView.prototype = {
67 /** 67 /**
68 * @return {!Array.<!WebInspector.StatusBarItem>}
69 */
70 statusBarItems: function()
71 {
72 return [];
73 },
74
75 /**
68 * @param {string} name 76 * @param {string} name
69 * @param {string} value 77 * @param {string} value
70 */ 78 */
71 _formatHeader: function(name, value) 79 _formatHeader: function(name, value)
72 { 80 {
73 var fragment = createDocumentFragment(); 81 var fragment = createDocumentFragment();
74 fragment.createChild("div", "attribute-name").textContent = name + ":"; 82 fragment.createChild("div", "attribute-name").textContent = name + ":";
75 fragment.createChild("div", "attribute-value source-code").textContent = value; 83 fragment.createChild("div", "attribute-value source-code").textContent = value;
76 84
77 return fragment; 85 return fragment;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 208
201 /** 209 /**
202 * @return {!Element} 210 * @return {!Element}
203 */ 211 */
204 _createEditorToolbar: function() 212 _createEditorToolbar: function()
205 { 213 {
206 var editorToolbar = createElement("div"); 214 var editorToolbar = createElement("div");
207 editorToolbar.classList.add("status-bar"); 215 editorToolbar.classList.add("status-bar");
208 editorToolbar.classList.add("data-view-toolbar"); 216 editorToolbar.classList.add("data-view-toolbar");
209 217
210 this._pageBackButton = editorToolbar.createChild("button", "back-button" ); 218 this._pageBackButton = new WebInspector.StatusBarButton(WebInspector.UIS tring("Show previous page."), "indexed-db-status-bar-back-button");
211 this._pageBackButton.classList.add("status-bar-item"); 219 this._pageBackButton.addEventListener("click", this._pageBackButtonClick ed, this);
212 this._pageBackButton.title = WebInspector.UIString("Show previous page." ); 220 editorToolbar.appendChild(this._pageBackButton.element);
213 this._pageBackButton.disabled = true;
214 this._pageBackButton.appendChild(createElement("img"));
215 this._pageBackButton.addEventListener("click", this._pageBackButtonClick ed.bind(this), false);
216 editorToolbar.appendChild(this._pageBackButton);
217 221
218 this._pageForwardButton = editorToolbar.createChild("button", "forward-b utton"); 222 this._pageForwardButton = new WebInspector.StatusBarButton(WebInspector. UIString("Show next page."), "indexed-db-status-bar-forward-button");
219 this._pageForwardButton.classList.add("status-bar-item"); 223 this._pageForwardButton.setEnabled(false);
220 this._pageForwardButton.title = WebInspector.UIString("Show next page.") ; 224 this._pageForwardButton.addEventListener("click", this._pageForwardButto nClicked, this);
221 this._pageForwardButton.disabled = true; 225 editorToolbar.appendChild(this._pageForwardButton.element);
222 this._pageForwardButton.appendChild(createElement("img"));
223 this._pageForwardButton.addEventListener("click", this._pageForwardButto nClicked.bind(this), false);
224 editorToolbar.appendChild(this._pageForwardButton);
225 226
226 this._keyInputElement = editorToolbar.createChild("input", "key-input"); 227 this._keyInputElement = editorToolbar.createChild("input", "key-input");
227 this._keyInputElement.placeholder = WebInspector.UIString("Start from ke y"); 228 this._keyInputElement.placeholder = WebInspector.UIString("Start from ke y");
228 this._keyInputElement.addEventListener("paste", this._keyInputChanged.bi nd(this), false); 229 this._keyInputElement.addEventListener("paste", this._keyInputChanged.bi nd(this), false);
229 this._keyInputElement.addEventListener("cut", this._keyInputChanged.bind (this), false); 230 this._keyInputElement.addEventListener("cut", this._keyInputChanged.bind (this), false);
230 this._keyInputElement.addEventListener("keypress", this._keyInputChanged .bind(this), false); 231 this._keyInputElement.addEventListener("keypress", this._keyInputChanged .bind(this), false);
231 this._keyInputElement.addEventListener("keydown", this._keyInputChanged. bind(this), false); 232 this._keyInputElement.addEventListener("keydown", this._keyInputChanged. bind(this), false);
232 233
233 return editorToolbar; 234 return editorToolbar;
234 }, 235 },
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 data["number"] = i + skipCount; 320 data["number"] = i + skipCount;
320 data["key"] = entries[i].key; 321 data["key"] = entries[i].key;
321 data["primaryKey"] = entries[i].primaryKey; 322 data["primaryKey"] = entries[i].primaryKey;
322 data["value"] = entries[i].value; 323 data["value"] = entries[i].value;
323 324
324 var primaryKey = JSON.stringify(this._isIndex ? entries[i].prima ryKey : entries[i].key); 325 var primaryKey = JSON.stringify(this._isIndex ? entries[i].prima ryKey : entries[i].key);
325 var node = new WebInspector.IDBDataGridNode(data); 326 var node = new WebInspector.IDBDataGridNode(data);
326 this._dataGrid.rootNode().appendChild(node); 327 this._dataGrid.rootNode().appendChild(node);
327 } 328 }
328 329
329 this._pageBackButton.disabled = skipCount === 0; 330 this._pageBackButton.setEnabled(!!skipCount);
330 this._pageForwardButton.disabled = !hasMore; 331 this._pageForwardButton.setEnabled(hasMore);
331 } 332 }
332 333
333 var idbKeyRange = key ? window.IDBKeyRange.lowerBound(key) : null; 334 var idbKeyRange = key ? window.IDBKeyRange.lowerBound(key) : null;
334 if (this._isIndex) 335 if (this._isIndex)
335 this._model.loadIndexData(this._databaseId, this._objectStore.name, this._index.name, idbKeyRange, skipCount, pageSize, callback.bind(this)); 336 this._model.loadIndexData(this._databaseId, this._objectStore.name, this._index.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
336 else 337 else
337 this._model.loadObjectStoreData(this._databaseId, this._objectStore. name, idbKeyRange, skipCount, pageSize, callback.bind(this)); 338 this._model.loadObjectStoreData(this._databaseId, this._objectStore. name, idbKeyRange, skipCount, pageSize, callback.bind(this));
338 }, 339 },
339 340
340 _refreshButtonClicked: function(event) 341 _refreshButtonClicked: function(event)
341 { 342 {
342 this._updateData(true); 343 this._updateData(true);
343 }, 344 },
344 345
345 _clearButtonClicked: function(event) 346 _clearButtonClicked: function(event)
346 { 347 {
347 /** 348 /**
348 * @this {WebInspector.IDBDataView} 349 * @this {WebInspector.IDBDataView}
349 */ 350 */
350 function cleared() { 351 function cleared() {
351 this._clearButton.setEnabled(true); 352 this._clearButton.setEnabled(true);
352 this._updateData(true); 353 this._updateData(true);
353 } 354 }
354 this._clearButton.setEnabled(false); 355 this._clearButton.setEnabled(false);
355 this._model.clearObjectStore(this._databaseId, this._objectStore.name, c leared.bind(this)); 356 this._model.clearObjectStore(this._databaseId, this._objectStore.name, c leared.bind(this));
356 }, 357 },
357 358
358 get statusBarItems() 359 /**
360 * @return {!Array.<!WebInspector.StatusBarItem>}
361 */
362 statusBarItems: function()
359 { 363 {
360 return [this._refreshButton.element, this._clearButton.element]; 364 return [this._refreshButton, this._clearButton];
361 }, 365 },
362 366
363 clear: function() 367 clear: function()
364 { 368 {
365 this._dataGrid.rootNode().removeChildren(); 369 this._dataGrid.rootNode().removeChildren();
366 this._entries = []; 370 this._entries = [];
367 }, 371 },
368 372
369 __proto__: WebInspector.VBox.prototype 373 __proto__: WebInspector.VBox.prototype
370 } 374 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 contents.createTextChildren("\"", value.description, "\""); 424 contents.createTextChildren("\"", value.description, "\"");
421 break; 425 break;
422 default: 426 default:
423 contents.classList.add("primitive-value"); 427 contents.classList.add("primitive-value");
424 contents.createTextChild(value.description); 428 contents.createTextChild(value.description);
425 } 429 }
426 }, 430 },
427 431
428 __proto__: WebInspector.DataGridNode.prototype 432 __proto__: WebInspector.DataGridNode.prototype
429 } 433 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/resources/FileSystemView.js ('k') | Source/devtools/front_end/resources/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698