Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 super(Common.UIString('DOM Storage')); | 32 super(Common.UIString('DOM Storage')); |
| 33 | 33 |
| 34 this.domStorage = domStorage; | 34 this.domStorage = domStorage; |
| 35 | 35 |
| 36 this.element.classList.add('storage-view', 'table'); | 36 this.element.classList.add('storage-view', 'table'); |
| 37 | 37 |
| 38 this.deleteButton = new UI.ToolbarButton(Common.UIString('Delete'), 'largeic on-delete'); | 38 this.deleteButton = new UI.ToolbarButton(Common.UIString('Delete'), 'largeic on-delete'); |
| 39 this.deleteButton.setVisible(false); | 39 this.deleteButton.setVisible(false); |
| 40 this.deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._dele teButtonClicked, this); | 40 this.deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._dele teButtonClicked, this); |
| 41 | 41 |
| 42 this.clearButton = new UI.ToolbarButton(Common.UIString('Clear All'), 'large icon-clear'); | |
|
pfeldman
2017/01/13 18:51:25
this._clearButton - it should be private. While yo
eostroukhov
2017/01/19 00:42:10
Done.
| |
| 43 this.clearButton.addEventListener(UI.ToolbarButton.Events.Click, this.clear, this); | |
| 44 | |
| 42 this.refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'large icon-refresh'); | 45 this.refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'large icon-refresh'); |
| 43 this.refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._ref reshButtonClicked, this); | 46 this.refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._ref reshButtonClicked, this); |
| 44 | 47 |
| 45 this.domStorage.addEventListener( | 48 this.domStorage.addEventListener( |
| 46 Resources.DOMStorage.Events.DOMStorageItemsCleared, this._domStorageItem sCleared, this); | 49 Resources.DOMStorage.Events.DOMStorageItemsCleared, this._domStorageItem sCleared, this); |
| 47 this.domStorage.addEventListener( | 50 this.domStorage.addEventListener( |
| 48 Resources.DOMStorage.Events.DOMStorageItemRemoved, this._domStorageItemR emoved, this); | 51 Resources.DOMStorage.Events.DOMStorageItemRemoved, this._domStorageItemR emoved, this); |
| 49 this.domStorage.addEventListener(Resources.DOMStorage.Events.DOMStorageItemA dded, this._domStorageItemAdded, this); | 52 this.domStorage.addEventListener(Resources.DOMStorage.Events.DOMStorageItemA dded, this._domStorageItemAdded, this); |
| 50 this.domStorage.addEventListener( | 53 this.domStorage.addEventListener( |
| 51 Resources.DOMStorage.Events.DOMStorageItemUpdated, this._domStorageItemU pdated, this); | 54 Resources.DOMStorage.Events.DOMStorageItemUpdated, this._domStorageItemU pdated, this); |
| 52 } | 55 } |
| 53 | 56 |
| 54 /** | 57 /** |
| 55 * @override | 58 * @override |
| 56 * @return {!Array.<!UI.ToolbarItem>} | 59 * @return {!Array.<!UI.ToolbarItem>} |
| 57 */ | 60 */ |
| 58 syncToolbarItems() { | 61 syncToolbarItems() { |
| 59 return [this.refreshButton, this.deleteButton]; | 62 if (this.domStorage.isLocalStorage) |
| 63 return [this.refreshButton, this.clearButton, this.deleteButton]; | |
|
pfeldman
2017/01/13 18:51:25
We are consistently using delete button to close t
eostroukhov
2017/01/19 00:42:10
Acknowledged (no change for now, pending new icons
| |
| 64 else | |
| 65 return [this.refreshButton, this.deleteButton]; | |
| 60 } | 66 } |
| 61 | 67 |
| 62 /** | 68 /** |
| 63 * @override | 69 * @override |
| 64 */ | 70 */ |
| 65 wasShown() { | 71 wasShown() { |
| 66 this._update(); | 72 this._update(); |
| 67 } | 73 } |
| 68 | 74 |
| 69 /** | 75 /** |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 } | 251 } |
| 246 } | 252 } |
| 247 | 253 |
| 248 _deleteCallback(node) { | 254 _deleteCallback(node) { |
| 249 if (!node || node.isCreationNode) | 255 if (!node || node.isCreationNode) |
| 250 return; | 256 return; |
| 251 | 257 |
| 252 if (this.domStorage) | 258 if (this.domStorage) |
| 253 this.domStorage.removeItem(node.data.key); | 259 this.domStorage.removeItem(node.data.key); |
| 254 } | 260 } |
| 261 | |
| 262 clear() { | |
|
pfeldman
2017/01/13 18:51:25
inline this.
eostroukhov
2017/01/19 00:42:10
Done.
| |
| 263 this.domStorage.clear(); | |
| 264 } | |
| 255 }; | 265 }; |
| OLD | NEW |