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

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

Issue 2873843003: [DevTools] Restore tree selection after reload (Closed)
Patch Set: [DevTools] Restore tree selection after reload Created 3 years, 7 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 25 matching lines...) Expand all
36 super(Common.UIString('Cookies'), 'cookiesPanel'); 36 super(Common.UIString('Cookies'), 'cookiesPanel');
37 37
38 this.element.classList.add('storage-view'); 38 this.element.classList.add('storage-view');
39 39
40 this._model = model; 40 this._model = model;
41 this._cookieDomain = cookieDomain; 41 this._cookieDomain = cookieDomain;
42 42
43 this._totalSize = 0; 43 this._totalSize = 0;
44 /** @type {?CookieTable.CookiesTable} */ 44 /** @type {?CookieTable.CookiesTable} */
45 this._cookiesTable = null; 45 this._cookiesTable = null;
46 this._refreshThrottler = new Common.Throttler(300);
47 /** @type {!Array<!Common.EventTarget.EventDescriptor>} */
48 this._eventDescriptors = [];
46 this.setCookiesDomain(model, cookieDomain); 49 this.setCookiesDomain(model, cookieDomain);
47 } 50 }
48 51
49 /** 52 /**
50 * @param {!SDK.CookieModel} model 53 * @param {!SDK.CookieModel} model
51 * @param {string} domain 54 * @param {string} domain
52 */ 55 */
53 setCookiesDomain(model, domain) { 56 setCookiesDomain(model, domain) {
54 this._model = model; 57 this._model = model;
55 this._cookieDomain = domain; 58 this._cookieDomain = domain;
56 this.refreshItems(); 59 this.refreshItems();
60 Common.EventTarget.removeEventListeners(this._eventDescriptors);
61 var networkManager = model.target().model(SDK.NetworkManager);
62 this._eventDescriptors =
63 [networkManager.addEventListener(SDK.NetworkManager.Events.ResponseRecei ved, () => this._onResponseRecieved())];
dgozman 2017/05/12 23:59:17 addEventListener(..., this._onResponseReceived, th
eostroukhov 2017/05/13 00:03:54 Done.
57 } 64 }
58 65
59 /** 66 /**
60 * @param {!SDK.Cookie} newCookie 67 * @param {!SDK.Cookie} newCookie
61 * @param {?SDK.Cookie} oldCookie 68 * @param {?SDK.Cookie} oldCookie
62 * @param {function(?string)} callback 69 * @param {function(?string)} callback
63 */ 70 */
64 _saveCookie(newCookie, oldCookie, callback) { 71 _saveCookie(newCookie, oldCookie, callback) {
65 if (!this._model) { 72 if (!this._model) {
66 callback(Common.UIString('Unable to save the cookie')); 73 callback(Common.UIString('Unable to save the cookie'));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (selectedCookie) 127 if (selectedCookie)
121 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); 128 this._model.deleteCookie(selectedCookie, () => this.refreshItems());
122 } 129 }
123 130
124 /** 131 /**
125 * @override 132 * @override
126 */ 133 */
127 refreshItems() { 134 refreshItems() {
128 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies)); 135 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies));
129 } 136 }
137
138 _onResponseRecieved() {
dgozman 2017/05/12 23:59:17 typo in Received
eostroukhov 2017/05/13 00:03:54 Done.
139 this._refreshThrottler.schedule(() => Promise.resolve(this.refreshItems()));
140 }
130 }; 141 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698