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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/cookie_table/CookiesTable.js

Issue 2714913002: DevTools: Fixes to Storage panel inconsistencies (Closed)
Patch Set: fix merge conflicts Created 3 years, 9 months 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 /* 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 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 /** 31 /**
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 CookieTable.CookiesTable = class extends UI.VBox { 34 CookieTable.CookiesTable = class extends UI.VBox {
35 /** 35 /**
36 * @param {function(!SDK.Cookie, ?SDK.Cookie, function(?string))=} saveCallbac k 36 * @param {function(!SDK.Cookie, ?SDK.Cookie, function(?string))=} saveCallbac k
37 * @param {function()=} refreshCallback 37 * @param {function()=} refreshCallback
38 * @param {function()=} selectedCallback 38 * @param {function()=} selectedCallback
39 * @param {function(!SDK.Cookie)=} deleteCallback
39 * @param {string=} cookieDomain 40 * @param {string=} cookieDomain
40 */ 41 */
41 constructor(saveCallback, refreshCallback, selectedCallback, cookieDomain) { 42 constructor(saveCallback, refreshCallback, selectedCallback, deleteCallback, c ookieDomain) {
42 super(); 43 super();
43 44
44 this._saveCallback = saveCallback; 45 this._saveCallback = saveCallback;
45 this._refreshCallback = refreshCallback; 46 this._refreshCallback = refreshCallback;
47 this._deleteCallback = deleteCallback;
46 this._cookieDomain = cookieDomain; 48 this._cookieDomain = cookieDomain;
47 49
48 var editable = !!saveCallback; 50 var editable = !!saveCallback;
49 51
50 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([ 52 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([
51 { 53 {
52 id: 'name', 54 id: 'name',
53 title: Common.UIString('Name'), 55 title: Common.UIString('Name'),
54 sortable: true, 56 sortable: true,
55 disclosure: editable, 57 disclosure: editable,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 124 }
123 125
124 /** 126 /**
125 * @return {?SDK.Cookie} 127 * @return {?SDK.Cookie}
126 */ 128 */
127 selectedCookie() { 129 selectedCookie() {
128 var node = this._dataGrid.selectedNode; 130 var node = this._dataGrid.selectedNode;
129 return node ? node.cookie : null; 131 return node ? node.cookie : null;
130 } 132 }
131 133
134 removeSelectedCookie() {
135 if (this._dataGrid.selectedNode)
136 this._onDeleteCookie(this._dataGrid.selectedNode);
137 }
138
132 /** 139 /**
133 * @override 140 * @override
134 */ 141 */
135 willHide() { 142 willHide() {
136 this._lastEditedColumnId = null; 143 this._lastEditedColumnId = null;
137 } 144 }
138 145
139 _rebuildTable() { 146 _rebuildTable() {
140 var selectedCookie = this._nextSelectedCookie || this.selectedCookie(); 147 var selectedCookie = this._nextSelectedCookie || this.selectedCookie();
141 var lastEditedColumnId = this._lastEditedColumnId; 148 var lastEditedColumnId = this._lastEditedColumnId;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 data.httpOnly = (cookie.httpOnly() ? checkmark : ''); 313 data.httpOnly = (cookie.httpOnly() ? checkmark : '');
307 data.secure = (cookie.secure() ? checkmark : ''); 314 data.secure = (cookie.secure() ? checkmark : '');
308 data.sameSite = cookie.sameSite() || ''; 315 data.sameSite = cookie.sameSite() || '';
309 316
310 var node = new DataGrid.DataGridNode(data); 317 var node = new DataGrid.DataGridNode(data);
311 node.cookie = cookie; 318 node.cookie = cookie;
312 node.selectable = true; 319 node.selectable = true;
313 return node; 320 return node;
314 } 321 }
315 322
323 /**
324 * @param {!DataGrid.DataGridNode} node
325 */
316 _onDeleteCookie(node) { 326 _onDeleteCookie(node) {
317 var cookie = node.cookie; 327 var cookie = node.cookie;
318 var neighbour = node.traverseNextNode() || node.traversePreviousNode(); 328 var neighbour = node.traverseNextNode(true) || node.traversePreviousNode(tru e);
319 if (neighbour) 329 if (neighbour)
320 this._nextSelectedCookie = neighbour.cookie; 330 this._nextSelectedCookie = neighbour.cookie;
321 cookie.remove(); 331 if (cookie && this._deleteCallback)
322 this._refresh(); 332 this._deleteCallback(cookie);
323 } 333 }
324 334
325 /** 335 /**
326 * @param {!DataGrid.DataGridNode} editingNode 336 * @param {!DataGrid.DataGridNode} editingNode
327 * @param {string} columnIdentifier 337 * @param {string} columnIdentifier
328 * @param {string} oldText 338 * @param {string} oldText
329 * @param {string} newText 339 * @param {string} newText
330 */ 340 */
331 _onUpdateCookie(editingNode, columnIdentifier, oldText, newText) { 341 _onUpdateCookie(editingNode, columnIdentifier, oldText, newText) {
332 this._lastEditedColumnId = columnIdentifier; 342 this._lastEditedColumnId = columnIdentifier;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 437 }
428 438
429 _refresh() { 439 _refresh() {
430 if (this._refreshCallback) 440 if (this._refreshCallback)
431 this._refreshCallback(); 441 this._refreshCallback();
432 } 442 }
433 }; 443 };
434 444
435 /** @const */ 445 /** @const */
436 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session'); 446 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698