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

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

Issue 2726823004: Show 'inactive' cookies (fix after https://codereview.chromium.org/2714913002 ). (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
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, function())=} deleteCallback 39 * @param {function(!SDK.Cookie, function())=} deleteCallback
40 * @param {string=} cookieDomain
41 */ 40 */
42 constructor(saveCallback, refreshCallback, selectedCallback, deleteCallback, c ookieDomain) { 41 constructor(saveCallback, refreshCallback, selectedCallback, deleteCallback) {
43 super(); 42 super();
44 43
45 this._saveCallback = saveCallback; 44 this._saveCallback = saveCallback;
46 this._refreshCallback = refreshCallback; 45 this._refreshCallback = refreshCallback;
47 this._deleteCallback = deleteCallback; 46 this._deleteCallback = deleteCallback;
48 this._cookieDomain = cookieDomain;
49 47
50 var editable = !!saveCallback; 48 var editable = !!saveCallback;
51 49
52 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([ 50 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([
53 { 51 {
54 id: 'name', 52 id: 'name',
55 title: Common.UIString('Name'), 53 title: Common.UIString('Name'),
56 sortable: true, 54 sortable: true,
57 disclosure: editable, 55 disclosure: editable,
58 sort: DataGrid.DataGrid.Order.Ascending, 56 sort: DataGrid.DataGrid.Order.Ascending,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._rebuildTable, this); 96 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._rebuildTable, this);
99 97
100 if (selectedCallback) 98 if (selectedCallback)
101 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, sel ectedCallback, this); 99 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, sel ectedCallback, this);
102 100
103 /** @type {?string} */ 101 /** @type {?string} */
104 this._lastEditedColumnId = null; 102 this._lastEditedColumnId = null;
105 103
106 this._dataGrid.asWidget().show(this.element); 104 this._dataGrid.asWidget().show(this.element);
107 this._data = []; 105 this._data = [];
106
107 /** @type {string} */
108 this._cookieDomain = '';
108 } 109 }
109 110
110 /** 111 /**
111 * @param {!Array.<!SDK.Cookie>} cookies 112 * @param {!Array.<!SDK.Cookie>} cookies
112 */ 113 */
113 setCookies(cookies) { 114 setCookies(cookies) {
114 this.setCookieFolders([{cookies: cookies}]); 115 this.setCookieFolders([{cookies: cookies}]);
115 } 116 }
116 117
117 /** 118 /**
118 * @param {!Array.<!{folderName: ?string, cookies: !Array.<!SDK.Cookie>}>} coo kieFolders 119 * @param {!Array.<!{folderName: ?string, cookies: !Array.<!SDK.Cookie>}>} coo kieFolders
119 */ 120 */
120 setCookieFolders(cookieFolders) { 121 setCookieFolders(cookieFolders) {
121 this._data = cookieFolders; 122 this._data = cookieFolders;
122 this._rebuildTable(); 123 this._rebuildTable();
123 } 124 }
124 125
125 /** 126 /**
127 * @param {string} cookieDomain
128 */
129 setCookieDomain(cookieDomain) {
130 this._cookieDomain = cookieDomain;
131 }
132
133 /**
126 * @return {?SDK.Cookie} 134 * @return {?SDK.Cookie}
127 */ 135 */
128 selectedCookie() { 136 selectedCookie() {
129 var node = this._dataGrid.selectedNode; 137 var node = this._dataGrid.selectedNode;
130 return node ? node.cookie : null; 138 return node ? node.cookie : null;
131 } 139 }
132 140
133 /** 141 /**
134 * @return {{current: ?SDK.Cookie, neighbor: ?SDK.Cookie}} 142 * @return {{current: ?SDK.Cookie, neighbor: ?SDK.Cookie}}
135 */ 143 */
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 var groupNode = new DataGrid.DataGridNode(groupData); 207 var groupNode = new DataGrid.DataGridNode(groupData);
200 groupNode.selectable = true; 208 groupNode.selectable = true;
201 this._dataGrid.rootNode().appendChild(groupNode); 209 this._dataGrid.rootNode().appendChild(groupNode);
202 groupNode.element().classList.add('row-group'); 210 groupNode.element().classList.add('row-group');
203 this._populateNode(groupNode, item.cookies, selectedCookie, lastEditedCo lumnId); 211 this._populateNode(groupNode, item.cookies, selectedCookie, lastEditedCo lumnId);
204 groupNode.expand(); 212 groupNode.expand();
205 } else { 213 } else {
206 this._populateNode(this._dataGrid.rootNode(), item.cookies, selectedCook ie, lastEditedColumnId); 214 this._populateNode(this._dataGrid.rootNode(), item.cookies, selectedCook ie, lastEditedColumnId);
207 } 215 }
208 } 216 }
209 if (selectedCookie && lastEditedColumnId && !this._dataGrid.selectedNode) 217 if (selectionCookies.current && lastEditedColumnId && !this._dataGrid.select edNode)
210 this._addInactiveNode(this._dataGrid.rootNode(), selectedCookie, lastEdite dColumnId); 218 this._addInactiveNode(this._dataGrid.rootNode(), selectionCookies.current, lastEditedColumnId);
211 if (this._saveCallback) 219 if (this._saveCallback)
212 this._dataGrid.addCreationNode(false); 220 this._dataGrid.addCreationNode(false);
213 } 221 }
214 222
215 /** 223 /**
216 * @param {!DataGrid.DataGridNode} parentNode 224 * @param {!DataGrid.DataGridNode} parentNode
217 * @param {?Array.<!SDK.Cookie>} cookies 225 * @param {?Array.<!SDK.Cookie>} cookies
218 * @param {?SDK.Cookie} selectedCookie 226 * @param {?SDK.Cookie} selectedCookie
219 * @param {?string} lastEditedColumnId 227 * @param {?string} lastEditedColumnId
220 */ 228 */
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 472 }
465 473
466 _refresh() { 474 _refresh() {
467 if (this._refreshCallback) 475 if (this._refreshCallback)
468 this._refreshCallback(); 476 this._refreshCallback();
469 } 477 }
470 }; 478 };
471 479
472 /** @const */ 480 /** @const */
473 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session'); 481 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session');
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698