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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkerCacheViews.js

Issue 2553043003: [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: rebased Created 4 years 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Resources.ServiceWorkerCacheView = class extends UI.SimpleView { 7 Resources.ServiceWorkerCacheView = class extends UI.SimpleView {
8 /** 8 /**
9 * @param {!SDK.ServiceWorkerCacheModel} model 9 * @param {!SDK.ServiceWorkerCacheModel} model
10 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache 10 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache
11 */ 11 */
12 constructor(model, cache) { 12 constructor(model, cache) {
13 super(Common.UIString('Cache')); 13 super(Common.UIString('Cache'));
14 this.registerRequiredCSS('resources/serviceWorkerCacheViews.css'); 14 this.registerRequiredCSS('resources/serviceWorkerCacheViews.css');
15 15
16 this._model = model; 16 this._model = model;
17 17
18 this.element.classList.add('service-worker-cache-data-view'); 18 this.element.classList.add('service-worker-cache-data-view');
19 this.element.classList.add('storage-view'); 19 this.element.classList.add('storage-view');
20 20
21 this._createEditorToolbar(); 21 this._createEditorToolbar();
22 22
23 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh'); 23 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh');
24 this._refreshButton.addEventListener('click', this._refreshButtonClicked, th is); 24 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._re freshButtonClicked, this);
25 25
26 this._pageSize = 50; 26 this._pageSize = 50;
27 this._skipCount = 0; 27 this._skipCount = 0;
28 28
29 this.update(cache); 29 this.update(cache);
30 this._entries = []; 30 this._entries = [];
31 } 31 }
32 32
33 /** 33 /**
34 * @return {!UI.DataGrid} 34 * @return {!UI.DataGrid}
35 */ 35 */
36 _createDataGrid() { 36 _createDataGrid() {
37 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([ 37 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([
38 {id: 'number', title: Common.UIString('#'), width: '50px'}, {id: 'request' , title: Common.UIString('Request')}, 38 {id: 'number', title: Common.UIString('#'), width: '50px'}, {id: 'request' , title: Common.UIString('Request')},
39 {id: 'response', title: Common.UIString('Response')} 39 {id: 'response', title: Common.UIString('Response')}
40 ]); 40 ]);
41 return new UI.DataGrid(columns, undefined, this._deleteButtonClicked.bind(th is), this._updateData.bind(this, true)); 41 return new UI.DataGrid(columns, undefined, this._deleteButtonClicked.bind(th is), this._updateData.bind(this, true));
42 } 42 }
43 43
44 _createEditorToolbar() { 44 _createEditorToolbar() {
45 var editorToolbar = new UI.Toolbar('data-view-toolbar', this.element); 45 var editorToolbar = new UI.Toolbar('data-view-toolbar', this.element);
46 46
47 this._pageBackButton = new UI.ToolbarButton(Common.UIString('Show previous p age'), 'largeicon-play-back'); 47 this._pageBackButton = new UI.ToolbarButton(Common.UIString('Show previous p age'), 'largeicon-play-back');
48 this._pageBackButton.addEventListener('click', this._pageBackButtonClicked, this); 48 this._pageBackButton.addEventListener(UI.ToolbarButton.Events.Click, this._p ageBackButtonClicked, this);
49 editorToolbar.appendToolbarItem(this._pageBackButton); 49 editorToolbar.appendToolbarItem(this._pageBackButton);
50 50
51 this._pageForwardButton = new UI.ToolbarButton(Common.UIString('Show next pa ge'), 'largeicon-play'); 51 this._pageForwardButton = new UI.ToolbarButton(Common.UIString('Show next pa ge'), 'largeicon-play');
52 this._pageForwardButton.setEnabled(false); 52 this._pageForwardButton.setEnabled(false);
53 this._pageForwardButton.addEventListener('click', this._pageForwardButtonCli cked, this); 53 this._pageForwardButton.addEventListener(UI.ToolbarButton.Events.Click, this ._pageForwardButtonClicked, this);
54 editorToolbar.appendToolbarItem(this._pageForwardButton); 54 editorToolbar.appendToolbarItem(this._pageForwardButton);
55 } 55 }
56 56
57 _pageBackButtonClicked() { 57 /**
58 * @param {!Common.Event} event
59 */
60 _pageBackButtonClicked(event) {
58 this._skipCount = Math.max(0, this._skipCount - this._pageSize); 61 this._skipCount = Math.max(0, this._skipCount - this._pageSize);
59 this._updateData(false); 62 this._updateData(false);
60 } 63 }
61 64
62 _pageForwardButtonClicked() { 65 /**
66 * @param {!Common.Event} event
67 */
68 _pageForwardButtonClicked(event) {
63 this._skipCount = this._skipCount + this._pageSize; 69 this._skipCount = this._skipCount + this._pageSize;
64 this._updateData(false); 70 this._updateData(false);
65 } 71 }
66 72
67 /** 73 /**
68 * @param {!UI.DataGridNode} node 74 * @param {!UI.DataGridNode} node
69 */ 75 */
70 _deleteButtonClicked(node) { 76 _deleteButtonClicked(node) {
71 this._model.deleteCacheEntry(this._cache, /** @type {string} */ (node.data[' request']), node.remove.bind(node)); 77 this._model.deleteCacheEntry(this._cache, /** @type {string} */ (node.data[' request']), node.remove.bind(node));
72 } 78 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 127
122 if (this._lastPageSize !== pageSize) { 128 if (this._lastPageSize !== pageSize) {
123 skipCount = 0; 129 skipCount = 0;
124 this._skipCount = 0; 130 this._skipCount = 0;
125 } 131 }
126 this._lastPageSize = pageSize; 132 this._lastPageSize = pageSize;
127 this._lastSkipCount = skipCount; 133 this._lastSkipCount = skipCount;
128 this._model.loadCacheData(this._cache, skipCount, pageSize, this._updateData Callback.bind(this, skipCount)); 134 this._model.loadCacheData(this._cache, skipCount, pageSize, this._updateData Callback.bind(this, skipCount));
129 } 135 }
130 136
137 /**
138 * @param {!Common.Event} event
139 */
131 _refreshButtonClicked(event) { 140 _refreshButtonClicked(event) {
132 this._updateData(true); 141 this._updateData(true);
133 } 142 }
134 143
135 /** 144 /**
136 * @override 145 * @override
137 * @return {!Array.<!UI.ToolbarItem>} 146 * @return {!Array.<!UI.ToolbarItem>}
138 */ 147 */
139 syncToolbarItems() { 148 syncToolbarItems() {
140 return [this._refreshButton]; 149 return [this._refreshButton];
141 } 150 }
142 151
143 clear() { 152 clear() {
144 this._dataGrid.rootNode().removeChildren(); 153 this._dataGrid.rootNode().removeChildren();
145 this._entries = []; 154 this._entries = [];
146 } 155 }
147 }; 156 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698