OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 * @unrestricted | 31 * @unrestricted |
32 */ | 32 */ |
33 Resources.CookieItemsView = class extends UI.SimpleView { | 33 Resources.CookieItemsView = class extends UI.SimpleView { |
34 constructor(treeElement, cookieDomain) { | 34 constructor(treeElement, cookieDomain) { |
35 super(Common.UIString('Cookies')); | 35 super(Common.UIString('Cookies')); |
36 | 36 |
37 this.element.classList.add('storage-view'); | 37 this.element.classList.add('storage-view'); |
38 | 38 |
39 this._deleteButton = new UI.ToolbarButton(Common.UIString('Delete'), 'largei
con-delete'); | 39 this._deleteButton = new UI.ToolbarButton(Common.UIString('Delete'), 'largei
con-delete'); |
40 this._deleteButton.setVisible(false); | 40 this._deleteButton.setVisible(false); |
41 this._deleteButton.addEventListener('click', this._deleteButtonClicked, this
); | 41 this._deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._del
eteButtonClicked, this); |
42 | 42 |
43 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeico
n-clear'); | 43 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeico
n-clear'); |
44 this._clearButton.setVisible(false); | 44 this._clearButton.setVisible(false); |
45 this._clearButton.addEventListener('click', this._clearButtonClicked, this); | 45 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clea
rButtonClicked, this); |
46 | 46 |
47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); | 47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); |
48 this._refreshButton.addEventListener('click', this._refreshButtonClicked, th
is); | 48 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._re
freshButtonClicked, this); |
49 | 49 |
50 this._treeElement = treeElement; | 50 this._treeElement = treeElement; |
51 this._cookieDomain = cookieDomain; | 51 this._cookieDomain = cookieDomain; |
52 | 52 |
53 this._emptyWidget = new UI.EmptyWidget( | 53 this._emptyWidget = new UI.EmptyWidget( |
54 cookieDomain ? | 54 cookieDomain ? |
55 Common.UIString('This site has no cookies.') : | 55 Common.UIString('This site has no cookies.') : |
56 Common.UIString( | 56 Common.UIString( |
57 'By default cookies are disabled for local files.\nYou could ove
rride this by starting the browser with --enable-file-cookies command line flag.
')); | 57 'By default cookies are disabled for local files.\nYou could ove
rride this by starting the browser with --enable-file-cookies command line flag.
')); |
58 this._emptyWidget.show(this.element); | 58 this._emptyWidget.show(this.element); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 } | 150 } |
151 return cookies; | 151 return cookies; |
152 } | 152 } |
153 | 153 |
154 clear() { | 154 clear() { |
155 this._cookiesTable.clear(); | 155 this._cookiesTable.clear(); |
156 this._update(); | 156 this._update(); |
157 } | 157 } |
158 | 158 |
159 _clearButtonClicked() { | 159 /** |
| 160 * @param {!Common.Event} event |
| 161 */ |
| 162 _clearButtonClicked(event) { |
160 this.clear(); | 163 this.clear(); |
161 } | 164 } |
162 | 165 |
163 _showDeleteButton() { | 166 _showDeleteButton() { |
164 this._deleteButton.setVisible(true); | 167 this._deleteButton.setVisible(true); |
165 } | 168 } |
166 | 169 |
167 _deleteButtonClicked() { | 170 /** |
| 171 * @param {!Common.Event} event |
| 172 */ |
| 173 _deleteButtonClicked(event) { |
168 var selectedCookie = this._cookiesTable.selectedCookie(); | 174 var selectedCookie = this._cookiesTable.selectedCookie(); |
169 if (selectedCookie) { | 175 if (selectedCookie) { |
170 selectedCookie.remove(); | 176 selectedCookie.remove(); |
171 this._update(); | 177 this._update(); |
172 } | 178 } |
173 } | 179 } |
174 | 180 |
| 181 /** |
| 182 * @param {!Common.Event} event |
| 183 */ |
175 _refreshButtonClicked(event) { | 184 _refreshButtonClicked(event) { |
176 this._update(); | 185 this._update(); |
177 } | 186 } |
178 | 187 |
179 _contextMenu(event) { | 188 _contextMenu(event) { |
180 if (!this._cookies.length) { | 189 if (!this._cookies.length) { |
181 var contextMenu = new UI.ContextMenu(event); | 190 var contextMenu = new UI.ContextMenu(event); |
182 contextMenu.appendItem(Common.UIString('Refresh'), this._update.bind(this)
); | 191 contextMenu.appendItem(Common.UIString('Refresh'), this._update.bind(this)
); |
183 contextMenu.show(); | 192 contextMenu.show(); |
184 } | 193 } |
185 } | 194 } |
186 }; | 195 }; |
OLD | NEW |