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

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

Issue 2444223002: [Devtools] Cleanup DataGrid's typecast and identifier naming (Closed)
Patch Set: changes Created 4 years, 1 month 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 24 matching lines...) Expand all
35 * @param {function()=} refreshCallback 35 * @param {function()=} refreshCallback
36 * @param {function()=} selectedCallback 36 * @param {function()=} selectedCallback
37 */ 37 */
38 WebInspector.CookiesTable = function(expandable, refreshCallback, selectedCallba ck) 38 WebInspector.CookiesTable = function(expandable, refreshCallback, selectedCallba ck)
39 { 39 {
40 WebInspector.VBox.call(this); 40 WebInspector.VBox.call(this);
41 41
42 var readOnly = expandable; 42 var readOnly = expandable;
43 this._refreshCallback = refreshCallback; 43 this._refreshCallback = refreshCallback;
44 44
45 var columns = [ 45 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([
46 {id: "name", title: WebInspector.UIString("Name"), sortable: true, discl osure: expandable, sort: WebInspector.DataGrid.Order.Ascending, longText: true, weight: 24}, 46 {id: "name", title: WebInspector.UIString("Name"), sortable: true, discl osure: expandable, sort: WebInspector.DataGrid.Order.Ascending, longText: true, weight: 24},
47 {id: "value", title: WebInspector.UIString("Value"), sortable: true, lon gText: true, weight: 34}, 47 {id: "value", title: WebInspector.UIString("Value"), sortable: true, lon gText: true, weight: 34},
48 {id: "domain", title: WebInspector.UIString("Domain"), sortable: true, w eight: 7}, 48 {id: "domain", title: WebInspector.UIString("Domain"), sortable: true, w eight: 7},
49 {id: "path", title: WebInspector.UIString("Path"), sortable: true, weigh t: 7}, 49 {id: "path", title: WebInspector.UIString("Path"), sortable: true, weigh t: 7},
50 {id: "expires", title: WebInspector.UIString("Expires / Max-Age"), sorta ble: true, weight: 7}, 50 {id: "expires", title: WebInspector.UIString("Expires / Max-Age"), sorta ble: true, weight: 7},
51 {id: "size", title: WebInspector.UIString("Size"), sortable: true, align : WebInspector.DataGrid.Align.Right, weight: 7}, 51 {id: "size", title: WebInspector.UIString("Size"), sortable: true, align : WebInspector.DataGrid.Align.Right, weight: 7},
52 {id: "httpOnly", title: WebInspector.UIString("HTTP"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7}, 52 {id: "httpOnly", title: WebInspector.UIString("HTTP"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7},
53 {id: "secure", title: WebInspector.UIString("Secure"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7}, 53 {id: "secure", title: WebInspector.UIString("Secure"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7},
54 {id: "sameSite", title: WebInspector.UIString("SameSite"), sortable: tru e, align: WebInspector.DataGrid.Align.Center, weight: 7} 54 {id: "sameSite", title: WebInspector.UIString("SameSite"), sortable: tru e, align: WebInspector.DataGrid.Align.Center, weight: 7}
55 ]; 55 ]);
56 56
57 if (readOnly) 57 if (readOnly)
58 this._dataGrid = new WebInspector.DataGrid(columns); 58 this._dataGrid = new WebInspector.DataGrid(columns);
59 else 59 else
60 this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onD eleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this)); 60 this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onD eleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this));
61 61
62 this._dataGrid.setName("cookiesTable"); 62 this._dataGrid.setName("cookiesTable");
63 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this); 63 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this);
64 64
65 if (selectedCallback) 65 if (selectedCallback)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return 0; 211 return 0;
212 212
213 if (cookie1.maxAge() && cookie2.maxAge()) 213 if (cookie1.maxAge() && cookie2.maxAge())
214 return sortDirection * (cookie1.maxAge() - cookie2.maxAge()); 214 return sortDirection * (cookie1.maxAge() - cookie2.maxAge());
215 if (cookie1.expires() && cookie2.expires()) 215 if (cookie1.expires() && cookie2.expires())
216 return sortDirection * (cookie1.expires() - cookie2.expires()); 216 return sortDirection * (cookie1.expires() - cookie2.expires());
217 return sortDirection * (cookie1.expires() ? 1 : -1); 217 return sortDirection * (cookie1.expires() ? 1 : -1);
218 } 218 }
219 219
220 var comparator; 220 var comparator;
221 switch (this._dataGrid.sortColumnIdentifier()) { 221 switch (this._dataGrid.sortColumnId()) {
222 case "name": comparator = compareTo.bind(null, WebInspector.Cookie.proto type.name); break; 222 case "name": comparator = compareTo.bind(null, WebInspector.Cookie.proto type.name); break;
223 case "value": comparator = compareTo.bind(null, WebInspector.Cookie.prot otype.value); break; 223 case "value": comparator = compareTo.bind(null, WebInspector.Cookie.prot otype.value); break;
224 case "domain": comparator = compareTo.bind(null, WebInspector.Cookie.pro totype.domain); break; 224 case "domain": comparator = compareTo.bind(null, WebInspector.Cookie.pro totype.domain); break;
225 case "path": comparator = compareTo.bind(null, WebInspector.Cookie.proto type.path); break; 225 case "path": comparator = compareTo.bind(null, WebInspector.Cookie.proto type.path); break;
226 case "expires": comparator = expiresCompare; break; 226 case "expires": comparator = expiresCompare; break;
227 case "size": comparator = numberCompare.bind(null, WebInspector.Cookie.p rototype.size); break; 227 case "size": comparator = numberCompare.bind(null, WebInspector.Cookie.p rototype.size); break;
228 case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.httpOnly); break; 228 case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.httpOnly); break;
229 case "secure": comparator = compareTo.bind(null, WebInspector.Cookie.pro totype.secure); break; 229 case "secure": comparator = compareTo.bind(null, WebInspector.Cookie.pro totype.secure); break;
230 case "sameSite": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.sameSite); break; 230 case "sameSite": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.sameSite); break;
231 default: compareTo.bind(null, WebInspector.Cookie.prototype.name); 231 default: compareTo.bind(null, WebInspector.Cookie.prototype.name);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 }, 280 },
281 281
282 _refresh: function() 282 _refresh: function()
283 { 283 {
284 if (this._refreshCallback) 284 if (this._refreshCallback)
285 this._refreshCallback(); 285 this._refreshCallback();
286 }, 286 },
287 287
288 __proto__: WebInspector.VBox.prototype 288 __proto__: WebInspector.VBox.prototype
289 }; 289 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698