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(UI.ToolbarButton.Events.Click, this._del
eteButtonClicked, this); | 41 this._deleteButton.addEventListener('click', this._deleteButtonClicked, 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(UI.ToolbarButton.Events.Click, this._clea
rButtonClicked, this); | 45 this._clearButton.addEventListener('click', this._clearButtonClicked, 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(UI.ToolbarButton.Events.Click, this._re
freshButtonClicked, this); | 48 this._refreshButton.addEventListener('click', this._refreshButtonClicked, th
is); |
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 /** | 159 _clearButtonClicked() { |
160 * @param {!Common.Event} event | |
161 */ | |
162 _clearButtonClicked(event) { | |
163 this.clear(); | 160 this.clear(); |
164 } | 161 } |
165 | 162 |
166 _showDeleteButton() { | 163 _showDeleteButton() { |
167 this._deleteButton.setVisible(true); | 164 this._deleteButton.setVisible(true); |
168 } | 165 } |
169 | 166 |
170 /** | 167 _deleteButtonClicked() { |
171 * @param {!Common.Event} event | |
172 */ | |
173 _deleteButtonClicked(event) { | |
174 var selectedCookie = this._cookiesTable.selectedCookie(); | 168 var selectedCookie = this._cookiesTable.selectedCookie(); |
175 if (selectedCookie) { | 169 if (selectedCookie) { |
176 selectedCookie.remove(); | 170 selectedCookie.remove(); |
177 this._update(); | 171 this._update(); |
178 } | 172 } |
179 } | 173 } |
180 | 174 |
181 /** | |
182 * @param {!Common.Event} event | |
183 */ | |
184 _refreshButtonClicked(event) { | 175 _refreshButtonClicked(event) { |
185 this._update(); | 176 this._update(); |
186 } | 177 } |
187 | 178 |
188 _contextMenu(event) { | 179 _contextMenu(event) { |
189 if (!this._cookies.length) { | 180 if (!this._cookies.length) { |
190 var contextMenu = new UI.ContextMenu(event); | 181 var contextMenu = new UI.ContextMenu(event); |
191 contextMenu.appendItem(Common.UIString('Refresh'), this._update.bind(this)
); | 182 contextMenu.appendItem(Common.UIString('Refresh'), this._update.bind(this)
); |
192 contextMenu.show(); | 183 contextMenu.show(); |
193 } | 184 } |
194 } | 185 } |
195 }; | 186 }; |
OLD | NEW |