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

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

Issue 2662403002: [DevTools] Merge filter bar with the main toolbar (Closed)
Patch Set: [DevTools] Merge filter bar with the main toolbar Created 3 years, 10 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 }, 58 },
59 { 59 {
60 id: 'value', 60 id: 'value',
61 title: Common.UIString('Value'), 61 title: Common.UIString('Value'),
62 sortable: true, 62 sortable: true,
63 longText: true, 63 longText: true,
64 weight: 34, 64 weight: 34,
65 editable: !this._readOnly 65 editable: !this._readOnly
66 }, 66 },
67 {id: 'domain', title: Common.UIString('Domain'), sortable: true, weight: 7 , editable: !this._readOnly}, 67 {id: 'domain', title: Common.UIString('Domain'), sortable: true, weight: 7 , editable: !this._readOnly},
68 {id: 'path', title: Common.UIString('Path'), sortable: true, weight: 7, ed itable: !this._readOnly}, 68 {id: 'path', title: Common.UIString('Path'), sortable: true, weight: 7, ed itable: !this._readOnly}, {
69 {
70 id: 'expires', 69 id: 'expires',
71 title: Common.UIString('Expires / Max-Age'), 70 title: Common.UIString('Expires / Max-Age'),
72 sortable: true, 71 sortable: true,
73 weight: 7, 72 weight: 7,
74 editable: !this._readOnly 73 editable: !this._readOnly
75 }, 74 },
76 {id: 'size', title: Common.UIString('Size'), sortable: true, align: DataGr id.DataGrid.Align.Right, weight: 7}, 75 {id: 'size', title: Common.UIString('Size'), sortable: true, align: DataGr id.DataGrid.Align.Right, weight: 7}, {
77 {
78 id: 'httpOnly', 76 id: 'httpOnly',
79 title: Common.UIString('HTTP'), 77 title: Common.UIString('HTTP'),
80 sortable: true, 78 sortable: true,
81 align: DataGrid.DataGrid.Align.Center, 79 align: DataGrid.DataGrid.Align.Center,
82 weight: 7 80 weight: 7
83 }, 81 },
84 { 82 {
85 id: 'secure', 83 id: 'secure',
86 title: Common.UIString('Secure'), 84 title: Common.UIString('Secure'),
87 sortable: true, 85 sortable: true,
88 align: DataGrid.DataGrid.Align.Center, 86 align: DataGrid.DataGrid.Align.Center,
89 weight: 7 87 weight: 7
90 }, 88 },
91 { 89 {
92 id: 'sameSite', 90 id: 'sameSite',
93 title: Common.UIString('SameSite'), 91 title: Common.UIString('SameSite'),
94 sortable: true, 92 sortable: true,
95 align: DataGrid.DataGrid.Align.Center, 93 align: DataGrid.DataGrid.Align.Center,
96 weight: 7 94 weight: 7
97 } 95 }
98 ]); 96 ]);
99 97
100 if (this._readOnly) { 98 if (this._readOnly) {
101 this._dataGrid = new DataGrid.DataGrid(columns); 99 this._dataGrid = new DataGrid.DataGrid(columns);
102 } else { 100 } else {
103 this._dataGrid = new DataGrid.DataGrid(columns, this._onUpdateCookie.bind( this), this._onDeleteCookie.bind(this), refreshCallback); 101 this._dataGrid = new DataGrid.DataGrid(
102 columns, this._onUpdateCookie.bind(this), this._onDeleteCookie.bind(th is), refreshCallback);
104 this._dataGrid.setRowContextMenuCallback(this._onRowContextMenu.bind(this) ); 103 this._dataGrid.setRowContextMenuCallback(this._onRowContextMenu.bind(this) );
105 } 104 }
106 105
107 this._dataGrid.setName('cookiesTable'); 106 this._dataGrid.setName('cookiesTable');
108 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._rebuildTable, this); 107 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._rebuildTable, this);
109 108
110 if (selectedCallback) 109 if (selectedCallback)
111 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, sel ectedCallback, this); 110 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, sel ectedCallback, this);
112 111
113 this._nextSelectedCookie = /** @type {?SDK.Cookie} */ (null); 112 this._nextSelectedCookie = /** @type {?SDK.Cookie} */ (null);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 158 }
160 159
161 /** 160 /**
162 * @return {?SDK.Cookie} 161 * @return {?SDK.Cookie}
163 */ 162 */
164 selectedCookie() { 163 selectedCookie() {
165 var node = this._dataGrid.selectedNode; 164 var node = this._dataGrid.selectedNode;
166 return node ? node.cookie : null; 165 return node ? node.cookie : null;
167 } 166 }
168 167
168 selectFirstCookie() {
169 if (!this._dataGrid || this._dataGrid.rootNode().children.length === 0)
dgozman 2017/02/03 20:54:53 nit: !.....length
eostroukhov 2017/02/03 22:59:25 Done.
170 return;
171 this._dataGrid.rootNode().children[0].select();
172 }
173
174 /**
175 * @override
176 */
177 focus() {
178 if (this._dataGrid)
179 this._dataGrid.element.focus();
180 }
181
169 /** 182 /**
170 * @param {?string=} domain 183 * @param {?string=} domain
171 */ 184 */
172 clear(domain) { 185 clear(domain) {
173 for (var i = 0, length = this._data.length; i < length; ++i) { 186 for (var i = 0, length = this._data.length; i < length; ++i) {
174 var cookies = this._data[i].cookies; 187 var cookies = this._data[i].cookies;
175 for (var j = 0, cookieCount = cookies.length; j < cookieCount; ++j) { 188 for (var j = 0, cookieCount = cookies.length; j < cookieCount; ++j) {
176 if (!domain || cookies[j].domain() === domain) 189 if (!domain || cookies[j].domain() === domain)
177 cookies[j].remove(); 190 cookies[j].remove();
178 } 191 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 cookie.addAttribute('sameSite', data.sameSite); 453 cookie.addAttribute('sameSite', data.sameSite);
441 cookie.setSize(data.name.length + data.value.length); 454 cookie.setSize(data.name.length + data.value.length);
442 return cookie; 455 return cookie;
443 } 456 }
444 457
445 /** 458 /**
446 * @param {!Object.<string, *>} data 459 * @param {!Object.<string, *>} data
447 * @returns {boolean} 460 * @returns {boolean}
448 */ 461 */
449 _isValidCookieData(data) { 462 _isValidCookieData(data) {
450 return (data.name || data.value) && this._isValidDomain(data.domain) && this ._isValidPath(data.path) && this._isValidDate(data.expires); 463 return (data.name || data.value) && this._isValidDomain(data.domain) && this ._isValidPath(data.path) &&
464 this._isValidDate(data.expires);
451 } 465 }
452 466
453 /** 467 /**
454 * @param {string} domain 468 * @param {string} domain
455 * @returns {boolean} 469 * @returns {boolean}
456 */ 470 */
457 _isValidDomain(domain) { 471 _isValidDomain(domain) {
458 if (!domain) 472 if (!domain)
459 return true; 473 return true;
460 var parsedURL = ('http://' + domain).asParsedURL(); 474 var parsedURL = ('http://' + domain).asParsedURL();
(...skipping 17 matching lines...) Expand all
478 return date === '' || date === CookieTable.CookiesTable._expiresSessionValue || !isNaN(Date.parse(date)); 492 return date === '' || date === CookieTable.CookiesTable._expiresSessionValue || !isNaN(Date.parse(date));
479 } 493 }
480 494
481 _refresh() { 495 _refresh() {
482 if (this._refreshCallback) 496 if (this._refreshCallback)
483 this._refreshCallback(); 497 this._refreshCallback();
484 } 498 }
485 }; 499 };
486 500
487 /** @const */ 501 /** @const */
488 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session'); 502 CookieTable.CookiesTable._expiresSessionValue = Common.UIString('Session');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698