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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js

Issue 2714913002: DevTools: Fixes to Storage panel inconsistencies (Closed)
Patch Set: more feedback 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 * 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!this._model) { 67 if (!this._model) {
68 callback(Common.UIString('Unable to save the cookie')); 68 callback(Common.UIString('Unable to save the cookie'));
69 return; 69 return;
70 } 70 }
71 if (oldCookie && (newCookie.name() !== oldCookie.name() || newCookie.url() ! == oldCookie.url())) 71 if (oldCookie && (newCookie.name() !== oldCookie.name() || newCookie.url() ! == oldCookie.url()))
72 this._model.deleteCookie(oldCookie); 72 this._model.deleteCookie(oldCookie);
73 this._model.saveCookie(newCookie, callback); 73 this._model.saveCookie(newCookie, callback);
74 } 74 }
75 75
76 /** 76 /**
77 * @param {!SDK.Cookie} cookie
78 * @param {function()} callback
79 */
80 _deleteCookie(cookie, callback) {
81 this._model.deleteCookie(cookie, callback);
82 }
83
84 /**
77 * @param {!Array.<!SDK.Cookie>} allCookies 85 * @param {!Array.<!SDK.Cookie>} allCookies
78 */ 86 */
79 _updateWithCookies(allCookies) { 87 _updateWithCookies(allCookies) {
80 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0); 88 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0);
81 89
82 if (!this._cookiesTable) { 90 if (!this._cookiesTable) {
83 const parsedURL = this._cookieDomain.asParsedURL(); 91 const parsedURL = this._cookieDomain.asParsedURL();
84 const domain = parsedURL ? parsedURL.host : ''; 92 const domain = parsedURL ? parsedURL.host : '';
85 this._cookiesTable = new CookieTable.CookiesTable( 93 this._cookiesTable = new CookieTable.CookiesTable(
86 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this. setCanDeleteSelected(true), domain); 94 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this. setCanDeleteSelected(true),
95 this._deleteCookie.bind(this), domain);
87 } 96 }
88 97
89 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo kie.value()} ${cookie.domain()}`); 98 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo kie.value()} ${cookie.domain()}`);
90 this._cookiesTable.setCookies(shownCookies); 99 this._cookiesTable.setCookies(shownCookies);
91 this._cookiesTable.show(this.element); 100 this._cookiesTable.show(this.element);
92 this.setCanFilter(true); 101 this.setCanFilter(true);
93 this.setCanDeleteAll(true); 102 this.setCanDeleteAll(true);
94 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie()); 103 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie());
95 } 104 }
96 105
(...skipping 13 matching lines...) Expand all
110 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); 119 this._model.deleteCookie(selectedCookie, () => this.refreshItems());
111 } 120 }
112 121
113 /** 122 /**
114 * @override 123 * @override
115 */ 124 */
116 refreshItems() { 125 refreshItems() {
117 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies)); 126 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies));
118 } 127 }
119 }; 128 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698