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

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: 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 * 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 */
79 _deleteCookie(cookie) {
80 this._model.deleteCookie(cookie, () => this.refreshItems());
81 }
82
83 /**
77 * @param {!Array.<!SDK.Cookie>} allCookies 84 * @param {!Array.<!SDK.Cookie>} allCookies
78 */ 85 */
79 _updateWithCookies(allCookies) { 86 _updateWithCookies(allCookies) {
80 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0); 87 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0);
81 88
82 if (!this._cookiesTable) { 89 if (!this._cookiesTable) {
83 const parsedURL = this._cookieDomain.asParsedURL(); 90 const parsedURL = this._cookieDomain.asParsedURL();
84 const domain = parsedURL ? parsedURL.host : ''; 91 const domain = parsedURL ? parsedURL.host : '';
85 this._cookiesTable = new CookieTable.CookiesTable( 92 this._cookiesTable = new CookieTable.CookiesTable(
86 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this. setCanDeleteSelected(true), domain); 93 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this. setCanDeleteSelected(true),
94 this._deleteCookie.bind(this), domain);
87 } 95 }
88 96
89 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo kie.value()} ${cookie.domain()}`); 97 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo kie.value()} ${cookie.domain()}`);
90 this._cookiesTable.setCookies(shownCookies); 98 this._cookiesTable.setCookies(shownCookies);
91 this._cookiesTable.show(this.element); 99 this._cookiesTable.show(this.element);
92 this.setCanFilter(true); 100 this.setCanFilter(true);
93 this.setCanDeleteAll(true); 101 this.setCanDeleteAll(true);
94 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie()); 102 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie());
95 } 103 }
96 104
97 /** 105 /**
98 * @override 106 * @override
99 */ 107 */
100 deleteAllItems() { 108 deleteAllItems() {
101 this._model.clear(this._cookieDomain, () => this.refreshItems()); 109 this._model.clear(this._cookieDomain, () => this.refreshItems());
102 } 110 }
103 111
104 /** 112 /**
105 * @override 113 * @override
106 */ 114 */
107 deleteSelectedItem() { 115 deleteSelectedItem() {
108 var selectedCookie = this._cookiesTable.selectedCookie(); 116 this._cookiesTable.removeSelectedCookie();
eostroukhov 2017/02/24 18:13:46 The call ultimately gets back to this view. Maybe
phulce 2017/02/28 18:55:53 Done, sort key wasn't robust enough to handle all
109 if (selectedCookie)
110 this._model.deleteCookie(selectedCookie, () => this.refreshItems());
111 } 117 }
112 118
113 /** 119 /**
114 * @override 120 * @override
115 */ 121 */
116 refreshItems() { 122 refreshItems() {
117 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies)); 123 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies));
118 } 124 }
119 }; 125 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698